diff --git a/npc/core/anno.json b/npc/core/anno.json new file mode 100644 index 0000000..57608d3 --- /dev/null +++ b/npc/core/anno.json @@ -0,0 +1,4 @@ +[{ + "class": "firrtl.transforms.DontTouchAnnotation", + "target": "~Flow|Control" +}] diff --git a/npc/core/src/main/scala/Main.scala b/npc/core/src/main/scala/Main.scala index 71c2a63..5e5288c 100644 --- a/npc/core/src/main/scala/Main.scala +++ b/npc/core/src/main/scala/Main.scala @@ -47,15 +47,13 @@ class Control(width: Int) extends Module { val ControlMapping: Array[(BitPat, T)] = Array( // Regs :: PC :: Exe // writeEnable :: writeSelect :: srcSelect :: - (addi, false.B :: rAluOut :: pStaticNpc :: aOpAdd :: HNil), - // ("", false.B :: rAluOut :: pStaticNpc :: aOpNop :: HNil), + (addi, false.B :: rAluOut :: pStaticNpc :: aOpAdd :: HNil), ) def toBits(t: T): BitPat = { val list: List[Data] = t.toList - list.map(x => BitPat(x.litValue.toInt.U(x.getWidth.W))).reduce(_ ## _) + list.map(x => BitPat(x.litValue.toInt.U(x.getWidth.W))).reduceLeft(_ ## _) } - // val default = toBits(false.B :: rAluOut :: pStaticNpc :: aOpAdd :: HNil).getWidth val default = BitPat("b???????") reg.writeEnable := false.B @@ -90,7 +88,7 @@ class Flow extends Module { numReadPorts = 2, numWritePorts = 1, numReadwritePorts = 0, - // memoryFile = HexMemoryFile(memoryFile) + memoryFile = HexMemoryFile("../resource/addi.txt") ) val control = Module(new Control(32)) val reg = RegisterFile(32, dataType, 2, 2) @@ -128,4 +126,6 @@ class Flow extends Module { alu.in.a := reg.out.src(0) alu.in.b := reg.out.src(1) + printf("Yes\n") + dontTouch(control.out) } diff --git a/npc/core/src/main/scala/RegisterFile.scala b/npc/core/src/main/scala/RegisterFile.scala index 00bf529..509ceaa 100644 --- a/npc/core/src/main/scala/RegisterFile.scala +++ b/npc/core/src/main/scala/RegisterFile.scala @@ -66,6 +66,7 @@ class RegisterFileCore[T <: Data](size: Int, tpe: T, numReadPorts: Int) extends for (readPort <- readPorts) { readPort.data := regFile(readPort.addr) } + dontTouch(regFile) } object RegisterFile { diff --git a/npc/core/src/test/scala/Main.scala b/npc/core/src/test/scala/Main.scala index 8477d57..0cab4ef 100644 --- a/npc/core/src/test/scala/Main.scala +++ b/npc/core/src/test/scala/Main.scala @@ -39,7 +39,7 @@ class RV32CPUSpec extends AnyFreeSpec with ChiselScalatestTester { } } "should compile" in { - test(new Flow).withAnnotations(Seq(WriteVcdAnnotation)) { c => + test(new Flow) { c => c.clock.step(1) } }