Skip to content

Commit

Permalink
fix stride addressing
Browse files Browse the repository at this point in the history
  • Loading branch information
HidetaroTanaka committed Nov 27, 2023
1 parent ca9cb02 commit e302944
Show file tree
Hide file tree
Showing 9 changed files with 682 additions and 684 deletions.
1,243 changes: 622 additions & 621 deletions src/main/resources/applications_vector/vector_matmul.dump

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int innerProd(const int* vec1, const int* vec2, int n) {
: "r"(vec1));
asm volatile ("vlse32.v v2, (%0), %1"
:
: "r"(vec2), "r"(n));
: "r"(vec2), "r"(n*sizeof(int)));
asm volatile ("vmul.vv v1, v1, v2");
asm volatile ("vredsum.vs v1, v1, v3");
asm volatile ("vmv.x.s %0, v1"
Expand Down
24 changes: 12 additions & 12 deletions src/main/resources/applications_vector/vector_matmul_data.hex
Original file line number Diff line number Diff line change
Expand Up @@ -286,18 +286,18 @@ ffffff80
ffffff9c
ffffffdf
00000001
ffffc170
ffffc1b4
ffffc1f8
ffffc108
ffffc23c
ffffc280
ffffc2c4
ffffc308
ffffc108
ffffc108
ffffc108
ffffc34c
ffffc174
ffffc1b8
ffffc1fc
ffffc10c
ffffc240
ffffc284
ffffc2c8
ffffc30c
ffffc10c
ffffc10c
ffffc10c
ffffc350
4c435943
00203a45
534e490a
Expand Down
81 changes: 41 additions & 40 deletions src/main/resources/applications_vector/vector_matmul_inst.hex
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ f1402573
00b57063
00006137
ff01011b
7680006f
76c0006f
ef010113
00113423
00213823
Expand Down Expand Up @@ -78,7 +78,7 @@ ef010113
34202573
341025f3
00010613
3e0000ef
3e4000ef
34151073
000022b7
8002829b
Expand Down Expand Up @@ -130,46 +130,47 @@ c0002973
b0302473
00004517
2a850513
16c000ef
170000ef
00810593
00090513
11c000ef
120000ef
00810513
158000ef
15c000ef
00004517
29050513
14c000ef
150000ef
00810593
00048513
0fc000ef
100000ef
00810513
138000ef
13c000ef
00004517
28050513
12c000ef
130000ef
00810593
00040513
0dc000ef
0e0000ef
00810513
118000ef
11c000ef
00004517
27050513
10c000ef
110000ef
03813083
03013403
02813483
02013903
04010113
00008067
00050893
04060863
04060a63
00261313
00060793
00000513
0d07f857
0008069b
420561d7
0208e087
0ac5e107
0a65e107
961120d7
0211a0d7
42102557
Expand Down Expand Up @@ -233,7 +234,7 @@ fe010113
c0202673
c00025f3
00004717
13870713
13470713
06300793
100006b7
00f68023
Expand Down Expand Up @@ -265,7 +266,7 @@ fee812e3
00168693
fe071ae3
00004697
0c068693
0bc68693
00a00713
100005b7
00e58023
Expand Down Expand Up @@ -304,7 +305,7 @@ fe010113
00113c23
00050413
00004717
03470713
03070713
04500793
100006b7
00f68023
Expand Down Expand Up @@ -346,14 +347,14 @@ ff0792e3
00b00793
02a7e063
00004717
f1470713
f1070713
00251513
00e50533
00052783
00e787b3
00078067
00004717
09870713
09470713
05500793
100006b7
00f68023
Expand All @@ -369,7 +370,7 @@ fe079ae3
00170713
fe079ae3
00004717
07870713
07470713
00a00793
100006b7
00f68023
Expand All @@ -379,7 +380,7 @@ fe079ae3
fff00513
ec9ff0ef
00004717
f1870713
f1470713
04900793
100006b7
00f68023
Expand All @@ -396,7 +397,7 @@ fc0786e3
fe079ae3
fb9ff06f
00004717
efc70713
ef870713
04900793
100006b7
00f68023
Expand All @@ -413,7 +414,7 @@ f80788e3
fe079ae3
f75ff06f
00004717
ee070713
edc70713
04900793
100006b7
00f68023
Expand All @@ -430,7 +431,7 @@ f40786e3
fe079ae3
f31ff06f
00004717
ebc70713
eb870713
04c00793
100006b7
00f68023
Expand All @@ -447,7 +448,7 @@ f00784e3
fe079ae3
eedff06f
00004717
e9870713
e9470713
04c00793
100006b7
00f68023
Expand All @@ -464,7 +465,7 @@ ec0782e3
fe079ae3
ea9ff06f
00004717
e7470713
e7070713
05300793
100006b7
00f68023
Expand All @@ -481,7 +482,7 @@ e80780e3
fe079ae3
e65ff06f
00004717
e5870713
e5470713
05300793
100006b7
00f68023
Expand All @@ -498,7 +499,7 @@ e2078ee3
fe079ae3
e21ff06f
00004717
e3470713
e3070713
04500793
100006b7
00f68023
Expand Down Expand Up @@ -587,7 +588,7 @@ fee78fa3
fef61ce3
00008067
00004797
d287b783
d247b783
02f70733
fec578e3
00050793
Expand Down Expand Up @@ -647,17 +648,17 @@ b0201073
b0001073
b0301073
00003417
5e040413
5dc40413
00004497
81848493
81448493
00004297
c3028293
c2c28293
00040f13
00004f97
834f8f93
00c00313
830f8f93
03000313
00003e17
7f8e0e13
7f4e0e13
00028e93
000e0513
000f0593
Expand Down Expand Up @@ -688,16 +689,16 @@ f9cf9ee3
030f0f13
03028293
f89f12e3
f20ff0ef
f1cff0ef
b0201073
b0001073
b0301073
a4818913
00090313
00004897
9d088893
9cc88893
00004e17
998e0e13
994e0e13
000e0513
00030813
dc050713
Expand All @@ -717,9 +718,9 @@ fca896e3
03040413
03030313
fa941ce3
eacff0ef
ea8ff0ef
00004697
b5068693
b4c68693
a7818593
00100513
fd068793
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/applications_vector/vector_stride.dump
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ Disassembly of section .text.startup:
a20: fe0718e3 bnez a4,a10 <main+0x100>
a24: 00600713 li a4,6
a28: 0c877057 vsetvli zero,a4,e16,m1,ta,ma
a2c: 00300713 li a4,3
a2c: 00600713 li a4,6
a30: 0aeb5307 vlse16.v v6,(s6),a4
a34: 020bd327 vse16.v v6,(s7)
a38: 00004917 auipc s2,0x4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main(int argc, char** argv) {
: "r"(6));
asm volatile ("vlse16.v v6, (%0), %1"
:
: "r"(charArray0), "r"(3));
: "r"(charArray0), "r"(3*sizeof(short)));
asm volatile ("vse16.v v6, (%0)"
:
: "r"(charArray1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ f9441ce3
fe0718e3
00600713
0c877057
00300713
00600713
0aeb5307
020bd327
00004917
Expand Down
8 changes: 2 additions & 6 deletions src/main/scala/hajime/vectormodules/VectorLdstUnit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,11 @@ class VectorLdstUnit(implicit params: HajimeCoreParams) extends Module with Scal
// sew=2 -> accumulator += 4
// sew=3 -> accumulator += 8
// stride:
// stride * (8 << sew)
// sew=0 -> stride << 0
// sew=1 -> stride << 1
// sew=2 -> stride << 2
// sew=3 -> stride << 3
// accumulator += stride
accumulator := accumulator + Mux(vectorReqReg.vectorDecode.mop === MOP.UNIT_STRIDE.asUInt, MuxLookup(vectorReqReg.vecConf.vtype.vsew, 1.U)(
(0 until 4).map(i => i.U -> (1 << i).U)
), MuxLookup(vectorReqReg.vecConf.vtype.vsew, scalarReqReg.bits.rs2Value)(
(0 until 4).map(i => i.U -> (scalarReqReg.bits.rs2Value << i).asUInt)
(0 until 4).map(_.U -> scalarReqReg.bits.rs2Value)
))
executedNum := (executedNum + (vectorReqReg.vectorDecode.vm || io.readVrf.resp.vm).asUInt)
} .otherwise {
Expand Down
2 changes: 1 addition & 1 deletion submodule/riscv-tests

0 comments on commit e302944

Please sign in to comment.