Half-working load.

This commit is contained in:
Sebastian Bugge 2024-09-27 07:51:25 +02:00
parent 961ae49523
commit f7c93b1292
Signed by: kaholaz
GPG key ID: 2EFFEDEE03519691
8 changed files with 112 additions and 36 deletions

View file

@ -22,12 +22,15 @@ class InstructionDecode extends MultiIOModule {
val pc = Input(UInt(32.W))
val op1 = Output(SInt(32.W))
val op2 = Output(SInt(32.W))
val r2Value = Output(UInt(32.W))
val ALUOp = Output(UInt(4.W))
val writeAddrIn = Input(UInt(5.W))
val writeAddrOut = Output(UInt(5.W))
val writeEnableIn = Input(Bool())
val writeEnableOut = Output(Bool())
val writeData = Input(UInt(32.W))
val memWrite = Output(Bool())
val memRead = Output(Bool())
}
)
@ -47,8 +50,9 @@ class InstructionDecode extends MultiIOModule {
decoder.instruction := io.instruction
val select1Map = Array(
Op1Select.rs1 -> registers.io.readData1.asSInt(),
Op1Select.PC -> io.pc.asSInt(),
Op1Select.rs1 -> registers.io.readData1.asSInt(),
Op1Select.PC -> io.pc.asSInt(),
Op1Select.Zero -> 0.S
)
io.op1 := MuxLookup(decoder.op1Select, 0.S(32.W), select1Map)
@ -65,8 +69,11 @@ class InstructionDecode extends MultiIOModule {
Op2Select.rs2 -> registers.io.readData2.asSInt(),
)
io.op2 := MuxLookup(decoder.op2Select, 0.S(32.W), select2Map)
io.r2Value := registers.io.readData2
io.ALUOp := decoder.ALUop
io.writeAddrOut := decoder.instruction.registerRd
io.writeEnableOut := decoder.controlSignals.regWrite
io.memRead := decoder.controlSignals.memRead
io.memWrite := decoder.controlSignals.memWrite
}