Do memread stalling correctly.

This commit is contained in:
Sebastian Bugge 2024-11-11 01:59:20 +01:00
parent 4cfd8268fd
commit 23656db068
Signed by: kaholaz
GPG key ID: 2EFFEDEE03519691
5 changed files with 25 additions and 12 deletions

View file

@ -10,11 +10,25 @@ class IFBarrier extends MultiIOModule {
val PCout = Output(UInt(32.W))
val instructionIn = Input(new Instruction)
val instructionOut = Output(new Instruction)
val stall = Input(Bool())
})
val PC = RegInit(UInt(32.W), 0.U)
PC := io.PCin
PC := Mux(io.stall, PC, io.PCin)
io.PCout := PC
io.instructionOut := io.instructionIn
val instruction = Reg(new Instruction)
val replay = RegInit(Bool(), false.B)
replay := io.stall
instruction := io.instructionIn
io.instructionOut := Mux(
io.stall,
Instruction.NOP,
Mux(
replay,
instruction,
io.instructionIn
)
)
}