Skip to content

Commit

Permalink
Fix branching and jump instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared Barocsi committed Jan 18, 2020
1 parent 2e53b89 commit ae38a50
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/main/scala/components/hazardmemstall.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@ class HazardUnitMemStall extends Module {
io.idex_bubble := true.B
}

// branch flush
when (io.exmem_taken && io.imem_ready && io.dmem_ready) {
io.pcwrite := 1.U // use the PC from mem stage
io.ifid_flush := true.B
io.idex_bubble := true.B
io.exmem_bubble := true.B
}

// imem stall:
// Freeze the PC to preserve the current PC for the entire stall period,
// so that on un-stall the next PC points to the next instruction
Expand All @@ -100,4 +92,13 @@ class HazardUnitMemStall extends Module {
io.idex_bubble := true.B
io.exmem_bubble := true.B
}

// branch flush
when (io.exmem_taken) {
printf ("Hazard: ex_mem is taken\n")
io.pcwrite := 1.U // use the PC from mem stage
io.ifid_flush := true.B
io.idex_bubble := true.B
io.exmem_bubble := true.B
}
}

0 comments on commit ae38a50

Please sign in to comment.