diff --git a/build.sc b/build.sc index c67eadb..7d6c808 100644 --- a/build.sc +++ b/build.sc @@ -299,10 +299,11 @@ trait PanamaModule extends JavaModule { object rvdecoderdb extends RVDecoderDB -trait RVDecoderDB extends common.RVDecoderDBJVMModule with ScalaModule { - def scalaVersion = T(v.scala) - def osLibIvy = v.oslib - def upickleIvy = v.upickle +trait RVDecoderDB extends common.RVDecoderDBJVMModule with ScalaModule with ScalafmtModule { + def scalaVersion = T(v.scala) + def osLibIvy = v.oslib + def upickleIvy = v.upickle + override def millSourcePath = os.pwd / "rvdecoderdb" / "rvdecoderdb" } diff --git a/cover/tests/src/CoverTest.scala b/cover/tests/src/CoverTest.scala index 6737d8f..d2f4081 100644 --- a/cover/tests/src/CoverTest.scala +++ b/cover/tests/src/CoverTest.scala @@ -3,15 +3,16 @@ package cover.tests -import rvdecoderdb.* +import org.chipsalliance.rvdecoderdb import utest.* +import os.* object RVDecoderDBTest extends TestSuite: val tests = Tests: - test("RVDecoderDB should decode correctly") { - val decoder = new RVDecoderDB() - val instruction = 0x00000013 // NOP instruction in RISC-V - val decoded = decoder.decode(instruction) - assert(decoded.mnemonic == "NOP") + test("rvdecoderdb works") { + val instTable: Iterable[rvdecoderdb.Instruction] = rvdecoderdb.instructions(os.pwd / "rvdecoderdb" / "rvdecoderdbtest" / "jvm" / "riscv-opcodes") + instTable.foreach { case inst: rvdecoderdb.Instruction => + println(inst.toString) + } } \ No newline at end of file diff --git a/nix/zaozi/cover.nix b/nix/zaozi/cover.nix index f54f687..4fad3ce 100644 --- a/nix/zaozi/cover.nix +++ b/nix/zaozi/cover.nix @@ -28,6 +28,7 @@ let ./../../circtlib ./../../mlirlib ./../../cover + ./../../rvdecoder ]; }; diff --git a/rvdecoderdb/rvdecoderdb/src/parser/parse.scala b/rvdecoderdb/rvdecoderdb/src/parser/parse.scala index cb85d94..815d2e2 100644 --- a/rvdecoderdb/rvdecoderdb/src/parser/parse.scala +++ b/rvdecoderdb/rvdecoderdb/src/parser/parse.scala @@ -53,7 +53,7 @@ object parse { val pseudoEncodingMap = collection.mutable.HashMap.empty[(String, String), org.chipsalliance.rvdecoderdb.Encoding] // create normal instructions - rawInstructionSets.foreach { set: RawInstructionSet => + rawInstructionSets.foreach { case set: RawInstructionSet => set.rawInstructions.foreach { case rawInst: RawInstruction if rawInst.isNormal => require( @@ -77,7 +77,7 @@ object parse { } // imported_instructions - these are instructions which are borrowed from an extension into a new/different extension/sub-extension. Only regular instructions can be imported. Pseudo-op or already imported instructions cannot be imported. - rawInstructionSets.foreach { set: RawInstructionSet => + rawInstructionSets.foreach { case set: RawInstructionSet => set.rawInstructions.foreach { case rawInst: RawInstruction if rawInst.importInstructionSet.isDefined => instructionSetsMap.filter(_._2.head == rawInst.importInstructionSet.get).map {