Do memread stalling correctly.
This commit is contained in:
parent
4cfd8268fd
commit
23656db068
5 changed files with 25 additions and 12 deletions
|
@ -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
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue