Add single cycle stall to branching.

This commit is contained in:
Sebastian Bugge 2024-11-12 12:28:38 +01:00
parent 9e12c60d27
commit e0b6634a93
Signed by: kaholaz
GPG key ID: 2EFFEDEE03519691
2 changed files with 4 additions and 14 deletions

View file

@ -46,9 +46,9 @@ class InstructionFetch extends MultiIOModule {
*
* You should expand on or rewrite the code below.
*/
io.PC := PC
IMEM.io.instructionAddress := PC
PC := Mux(io.branch, io.branchAddress, Mux(io.stall, PC, PC + 4.U))
io.PC := Mux(io.branch, io.branchAddress, PC)
IMEM.io.instructionAddress := io.PC
PC := Mux(io.branch, io.branchAddress + 4.U, Mux(io.stall, PC, PC + 4.U))
val instruction = Wire(new Instruction)
instruction := IMEM.io.instruction.asTypeOf(new Instruction)