Working branching.
This commit is contained in:
parent
934593fb6f
commit
92d0dfd9eb
9 changed files with 102 additions and 32 deletions
|
@ -25,6 +25,8 @@ class InstructionFetch extends MultiIOModule {
|
|||
new Bundle {
|
||||
val PC = Output(UInt(32.W))
|
||||
val instruction = Output(new Instruction)
|
||||
val branch = Input(Bool())
|
||||
val branchAddress = Input(UInt(32.W))
|
||||
})
|
||||
|
||||
val IMEM = Module(new IMEM)
|
||||
|
@ -45,7 +47,7 @@ class InstructionFetch extends MultiIOModule {
|
|||
*/
|
||||
io.PC := PC
|
||||
IMEM.io.instructionAddress := PC
|
||||
PC := PC + 4.U
|
||||
PC := Mux(io.branch, io.branchAddress, PC + 4.U)
|
||||
|
||||
val instruction = Wire(new Instruction)
|
||||
instruction := IMEM.io.instruction.asTypeOf(new Instruction)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue