浏览代码

Change IF to use input signal as PC

sindre-ex2
父节点
当前提交
75734a9c0a
共有 2 个文件被更改,包括 4 次插入5 次删除
  1. +1
    -1
      src/main/scala/Barriers.scala
  2. +3
    -4
      src/main/scala/IF.scala

+ 1
- 1
src/main/scala/Barriers.scala 查看文件

@@ -51,7 +51,7 @@ class IFBundle extends Bundle {
class IFBarrier extends Barrier(new IFBundle) { class IFBarrier extends Barrier(new IFBundle) {
out.instruction := barrier(in.instruction, false) out.instruction := barrier(in.instruction, false)
out.PC := barrier(in.PC) out.PC := barrier(in.PC)
out.next := Mux(freeze, RegNext(in.next), in.next)
out.next := barrier(in.next)
} }






+ 3
- 4
src/main/scala/IF.scala 查看文件

@@ -23,8 +23,7 @@ class InstructionFetch extends MultiIOModule {
}) })


val IMEM = Module(new IMEM) val IMEM = Module(new IMEM)
val PC = RegInit(UInt(32.W), 0.U)

val PC = WireInit(UInt(32.W), 0.U)


/** /**
* Setup. You should not change this code * Setup. You should not change this code
@@ -32,12 +31,11 @@ class InstructionFetch extends MultiIOModule {
IMEM.testHarness.setupSignals := testHarness.IMEMsetup IMEM.testHarness.setupSignals := testHarness.IMEMsetup
testHarness.PC := IMEM.testHarness.requestedAddress testHarness.PC := IMEM.testHarness.requestedAddress



IMEM.io.instructionAddress := PC IMEM.io.instructionAddress := PC


PC := io.addr PC := io.addr


io.PC := PC
io.PC := RegNext(PC)
io.next := PC + 4.U io.next := PC + 4.U
io.instruction := IMEM.io.instruction.asTypeOf(new Instruction) io.instruction := IMEM.io.instruction.asTypeOf(new Instruction)


@@ -47,6 +45,7 @@ class InstructionFetch extends MultiIOModule {
*/ */
when(testHarness.IMEMsetup.setup) { when(testHarness.IMEMsetup.setup) {
PC := 0.U PC := 0.U
io.next := 0.U
io.instruction := Instruction.NOP io.instruction := Instruction.NOP
} }
} }

正在加载...
取消
保存