Add stall.

This commit is contained in:
Sebastian Bugge 2024-10-18 08:19:46 +02:00
parent bcbe07b601
commit 1d433dd791
Signed by: kaholaz
GPG key ID: 2EFFEDEE03519691
4 changed files with 29 additions and 7 deletions

View file

@ -27,6 +27,7 @@ class InstructionFetch extends MultiIOModule {
val instruction = Output(new Instruction)
val branch = Input(Bool())
val branchAddress = Input(UInt(32.W))
val stall = Input(Bool())
})
val IMEM = Module(new IMEM)
@ -47,7 +48,7 @@ class InstructionFetch extends MultiIOModule {
*/
io.PC := PC
IMEM.io.instructionAddress := PC
PC := Mux(io.branch, io.branchAddress, PC + 4.U)
PC := Mux(io.stall, PC, Mux(io.branch, io.branchAddress, PC + 4.U))
val instruction = Wire(new Instruction)
instruction := IMEM.io.instruction.asTypeOf(new Instruction)