Add working 4real.

This commit is contained in:
Sebastian Bugge 2024-09-27 04:47:26 +02:00
parent 44ccf12cad
commit 961ae49523
Signed by: kaholaz
GPG key ID: 2EFFEDEE03519691
4 changed files with 29 additions and 23 deletions

View file

@ -64,9 +64,9 @@ class Decoder() extends Module {
XORI -> List(Y, N, N, N, N, branchType.DC, rs1, imm, ImmFormat.ITYPE, ALUOps.XOR ),
SLTI -> List(Y, N, N, N, N, branchType.DC, rs1, imm, ImmFormat.ITYPE, ALUOps.SLT ),
SLTIU -> List(Y, N, N, N, N, branchType.DC, rs1, imm, ImmFormat.ITYPE, ALUOps.SLTU),
SRAI -> List(Y, N, N, N, N, branchType.DC, rs1, imm, ImmFormat.SHORT_ITYPE, ALUOps.SRA ),
SRLI -> List(Y, N, N, N, N, branchType.DC, rs1, imm, ImmFormat.SHORT_ITYPE, ALUOps.SRL ),
SLLI -> List(Y, N, N, N, N, branchType.DC, rs1, imm, ImmFormat.SHORT_ITYPE, ALUOps.SLL ),
SRAI -> List(Y, N, N, N, N, branchType.DC, rs1, imm, ImmFormat.ITYPE, ALUOps.SRA ),
SRLI -> List(Y, N, N, N, N, branchType.DC, rs1, imm, ImmFormat.ITYPE, ALUOps.SRL ),
SLLI -> List(Y, N, N, N, N, branchType.DC, rs1, imm, ImmFormat.ITYPE, ALUOps.SLL ),
)

View file

@ -16,7 +16,16 @@ class Execute extends MultiIOModule {
)
val ALUOpsMap = Array (
ALUOps.ADD -> (io.op1 + io.op2)
ALUOps.ADD -> (io.op1 + io.op2),
ALUOps.SUB -> (io.op1 - io.op2),
ALUOps.AND -> (io.op1 & io.op2),
ALUOps.OR -> (io.op1 | io.op2),
ALUOps.XOR -> (io.op1 ^ io.op2),
ALUOps.SLT -> (io.op1 < io.op2).asSInt(),
ALUOps.SLTU -> (io.op1.asUInt() < io.op2.asUInt()).asSInt(),
ALUOps.SRA -> (io.op1 >> io.op2(4, 0)),
ALUOps.SRL -> (io.op1.asUInt() >> io.op2(4, 0)).asSInt(),
ALUOps.SLL -> (io.op1.asUInt() << io.op2(4, 0)).asSInt(),
)
io.ALUResult := MuxLookup(io.ALUOp, 0.S(32.W), ALUOpsMap)

View file

@ -59,7 +59,6 @@ class InstructionDecode extends MultiIOModule {
ImmFormat.UTYPE -> decoder.instruction.immediateUType,
ImmFormat.JTYPE -> decoder.instruction.immediateJType,
ImmFormat.SHAMT -> decoder.instruction.immediateZType,
ImmFormat.SHORT_ITYPE -> decoder.instruction.immediateShortIType,
)
val select2Map = Array(
Op2Select.imm -> MuxLookup(decoder.immType, 0.S(32.W), select2ImmMap),

View file

@ -21,7 +21,6 @@ class Instruction extends Bundle(){
def immediateUType = Cat(instruction(31, 12), 0.U(12.W)).asSInt
def immediateJType = Cat(instruction(31), instruction(19, 12), instruction(20), instruction(30, 25), instruction(24, 21), 0.U(1.W)).asSInt
def immediateZType = instruction(19, 15).zext
def immediateShortIType = instruction(24, 20).asSInt
def bubble(): Instruction = {
val bubbled = Wire(new Instruction)
@ -103,7 +102,6 @@ object ImmFormat {
val UTYPE = 3.asUInt(3.W)
val JTYPE = 4.asUInt(3.W)
val SHAMT = 5.asUInt(3.W)
val SHORT_ITYPE = 6.asUInt(3.W)
val DC = 0.asUInt(3.W)
}