Skip to content

Commit db50158

Browse files
committed
[zvma] enable ZVMA on xsfmm* instruction
Signed-off-by: Avimitin <[email protected]>
1 parent 645d81d commit db50158

File tree

21 files changed

+1209
-130
lines changed

21 files changed

+1209
-130
lines changed

build.mill

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ object t1 extends T1
5151
trait T1 extends common.T1Module with ScalafmtModule {
5252
def scalaVersion = T(v.scala)
5353

54-
def arithmeticIvy = v.arithmetic
55-
def axi4Ivy = v.axi4
56-
def hardfloatIvy = v.hardfloat
57-
def rvdecoderdbIvy = v.rvdecoderdb
58-
def stdlibModule = stdlib
59-
def riscvOpcodesPath = T.input(PathRef(millSourcePath / os.up / "dependencies" / "riscv-opcodes"))
54+
def arithmeticIvy = v.arithmetic
55+
def axi4Ivy = v.axi4
56+
def hardfloatIvy = v.hardfloat
57+
def rvdecoderdbIvy = v.rvdecoderdb
58+
def stdlibModule = stdlib
59+
def riscvOpcodesPath = T.input(PathRef(millSourcePath / os.up / "dependencies" / "riscv-opcodes"))
60+
def riscvCustomOpcodesPath = T.input(PathRef(millSourcePath / os.up / "custom-instructions"))
6061

6162
def chiselModule = None
6263
def chiselPluginJar = None
@@ -77,12 +78,13 @@ trait ConfigGen extends common.ConfigGenModule with ScalafmtModule {
7778
object rocketv extends RocketV
7879

7980
trait RocketV extends common.RocketVModule with ScalafmtModule {
80-
def scalaVersion = T(v.scala)
81-
def rvdecoderdbIvy = v.rvdecoderdb
82-
def riscvOpcodesPath = T.input(PathRef(millSourcePath / os.up / "dependencies" / "riscv-opcodes"))
83-
def hardfloatIvy = v.hardfloat
84-
def axi4Ivy = v.axi4
85-
def stdlibModule = stdlib
81+
def scalaVersion = T(v.scala)
82+
def rvdecoderdbIvy = v.rvdecoderdb
83+
def riscvOpcodesPath = T.input(PathRef(millSourcePath / os.up / "dependencies" / "riscv-opcodes"))
84+
def riscvCustomOpcodesPath = T.input(PathRef(millSourcePath / os.up / "custom-instructions"))
85+
def hardfloatIvy = v.hardfloat
86+
def axi4Ivy = v.axi4
87+
def stdlibModule = stdlib
8688

8789
def chiselModule = None
8890
def chiselPluginJar = None

common.mill

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ trait HasChisel extends ScalaModule {
3333
}
3434

3535
trait HasRVDecoderDB extends ScalaModule {
36-
def rvdecoderdbIvy: Dep
37-
def riscvOpcodesPath: T[PathRef]
36+
def rvdecoderdbIvy: Dep
37+
def riscvOpcodesPath: T[PathRef]
38+
def riscvCustomOpcodesPath: T[PathRef]
3839
def ivyDeps = T(super.ivyDeps() ++ Seq(rvdecoderdbIvy))
39-
def riscvOpcodesTar: T[PathRef] = T {
40+
def riscvOpcodesTar: T[PathRef] = T {
4041
val tmpDir = os.temp.dir()
4142
os.makeDir(tmpDir / "unratified")
4243
os.walk(riscvOpcodesPath().path)
@@ -55,7 +56,21 @@ trait HasRVDecoderDB extends ScalaModule {
5556
os.proc("tar", "cf", T.dest / "riscv-opcodes.tar", ".").call(tmpDir)
5657
PathRef(T.dest)
5758
}
58-
override def resources: T[Seq[PathRef]] = super.resources() ++ Some(riscvOpcodesTar())
59+
def riscvCustomOpcodesTar: T[PathRef] = T {
60+
val tmpDir = os.temp.dir()
61+
os.walk(riscvCustomOpcodesPath().path)
62+
.filter(f =>
63+
f.baseName.startsWith("rv128_") ||
64+
f.baseName.startsWith("rv64_") ||
65+
f.baseName.startsWith("rv32_") ||
66+
f.baseName.startsWith("rv_")
67+
)
68+
.foreach(os.copy.into(_, tmpDir))
69+
os.proc("tar", "cf", T.dest / "riscv-custom-opcodes.tar", ".").call(tmpDir)
70+
PathRef(T.dest)
71+
}
72+
73+
override def resources: T[Seq[PathRef]] = super.resources() ++ Seq(riscvOpcodesTar(), riscvCustomOpcodesTar())
5974
}
6075

6176
// Local definitions
@@ -75,12 +90,6 @@ trait ConfigGenModule extends ScalaModule {
7590
override def ivyDeps = T(super.ivyDeps() ++ Seq(mainargsIvy))
7691
}
7792

78-
// T1 forked version of RocketCore
79-
trait RocketModule extends ScalaModule with HasChisel with HasRVDecoderDB {
80-
def rocketchipModule: ScalaModule
81-
def moduleDeps = super.moduleDeps ++ Seq(rocketchipModule)
82-
}
83-
8493
// The next generation of purely standalone Rocket Core w/ AXI/CHI.
8594
trait RocketVModule extends ScalaModule with HasChisel with HasRVDecoderDB {
8695
def axi4Ivy: Dep

custom-instructions/rv_xsfmm

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# TODO: wait for arg_lut upstream for mtile: https://github.com/riscv/riscv-opcodes/pull/340
2+
vsettn 31=1 30..25=0x02 24..20=0x00 rs1 14..12=7 rd 6..0=0x57
3+
vsettm 31=1 30..25=0x02 24..20=0x01 rs1 14..12=7 rd 6..0=0x57
4+
vsettk 31=1 30..25=0x02 24..20=0x02 rs1 14..12=7 rd 6..0=0x57
5+
vlte8 31..29=0 28=1 27=0 26=0 25=1 rs2 rs1 14..12=7 11..7=0 6..0=0x07
6+
vlte16 31..29=1 28=1 27=0 26=0 25=1 rs2 rs1 14..12=7 11..7=0 6..0=0x07
7+
vlte32 31..29=2 28=1 27=0 26=0 25=1 rs2 rs1 14..12=7 11..7=0 6..0=0x07
8+
vlte64 31..29=3 28=1 27=0 26=0 25=1 rs2 rs1 14..12=7 11..7=0 6..0=0x07
9+
vste8 31..29=0 28=1 27=0 26=0 25=1 rs2 rs1 14..12=7 11..7=0 6..0=0x27
10+
vste16 31..29=1 28=1 27=0 26=0 25=1 rs2 rs1 14..12=7 11..7=0 6..0=0x27
11+
vste32 31..29=2 28=1 27=0 26=0 25=1 rs2 rs1 14..12=7 11..7=0 6..0=0x27
12+
vste64 31..29=3 28=1 27=0 26=0 25=1 rs2 rs1 14..12=7 11..7=0 6..0=0x27
13+
vtmv.v.t 31..26=0x10 25=1 24..20=0x1F rs1 14..12=6 vd 6..0=0x57
14+
vtmv.t.v 31..26=0x17 25=1 vs2 rs1 14..12=6 11..7=0x00 6..0=0x57
15+
mm.e5m2.e5m2 31..26=0x3E 25=1 vs2 vs1 14..12=1 9=0 8=0 7=0 6..0=0x77
16+
mm.e5m2.e4m3 31..26=0x3E 25=1 vs2 vs1 14..12=1 9=0 8=0 7=1 6..0=0x77
17+
mm.e4m3.e5m2 31..26=0x3F 25=1 vs2 vs1 14..12=1 9=0 8=0 7=0 6..0=0x77
18+
mm.e4m3.e4m3 31..26=0x3F 25=1 vs2 vs1 14..12=1 9=0 8=0 7=1 6..0=0x77
19+
mm.u.u 31..26=0x3C 25=1 vs2 vs1 14..12=0 9=0 8=0 7=0 6..0=0x77
20+
mm.s.u 31..26=0x3D 25=1 vs2 vs1 14..12=0 9=0 8=0 7=0 6..0=0x77
21+
mm.u.s 31..26=0x3C 25=1 vs2 vs1 14..12=0 9=0 8=0 7=1 6..0=0x77
22+
mm.s.s 31..26=0x3D 25=1 vs2 vs1 14..12=0 9=0 8=0 7=1 6..0=0x77
23+
p2mm.f.f 31..26=0x3C 25=1 vs2 vs1 14..12=1 8=0 7=1 6..0=0x77
24+
vtzero.t 31..26=0x10 25=1 24..20=0x1E 19..15=0x00 14..12=6 7=0 6..0=0x57
25+
vtdiscard 31..26=0x10 25=1 24..20=0x1C 19..15=0x00 14..12=6 11..7=0x00 6..0=0x57

0 commit comments

Comments
 (0)