Added hex conversion
This commit is contained in:
parent
7f9fb76513
commit
673c2c8d20
@ -166,16 +166,16 @@ pub fn print(ins: Instruction, pc: i32) -> String { //TODO pc should be u64
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
RISCV_LUI => {
|
RISCV_LUI => {
|
||||||
format!("lui x{}, {}", ins.rd.to_string(), ins.imm31_12.to_string()) //TODO Value is supposed to be in hex
|
format!("lui x{}, {:X}", ins.rd.to_string(), ins.imm31_12)
|
||||||
},
|
},
|
||||||
RISCV_AUIPC => {
|
RISCV_AUIPC => {
|
||||||
format!("auipc x{}, {}", ins.rd.to_string(), ins.imm31_12.to_string()) // TODO Value is supposed to be in hex
|
format!("auipc x{}, {:X}", ins.rd.to_string(), ins.imm31_12)
|
||||||
},
|
},
|
||||||
RISCV_JAL => {
|
RISCV_JAL => {
|
||||||
if ins.rd == 0 {
|
if ins.rd == 0 {
|
||||||
format!("j {}", ins.imm31_12.to_string())
|
format!("j {}", ins.imm31_12.to_string())
|
||||||
} else {
|
} else {
|
||||||
format!("jal x{}, {}", ins.rd.to_string(), (pc - 4 + ins.imm21_1_signed).to_string()) // TODO Value is supposed to be in hex
|
format!("jal x{}, {:X}", ins.rd.to_string(), (pc - 4 + ins.imm21_1_signed))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
RISCV_JALR => {
|
RISCV_JALR => {
|
||||||
@ -183,7 +183,7 @@ pub fn print(ins: Instruction, pc: i32) -> String { //TODO pc should be u64
|
|||||||
if ins.rs1 == 1 {
|
if ins.rs1 == 1 {
|
||||||
"ret".to_string()
|
"ret".to_string()
|
||||||
} else {
|
} else {
|
||||||
format!("jr {}", ins.imm31_12.to_string()) // TODO Value is supposed to be in hex
|
format!("jr {:X}", ins.imm31_12)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
format!("jalr {}, (r{})", ins.imm12_I_signed.to_string(), ins.rs1.to_string())
|
format!("jalr {}, (r{})", ins.imm12_I_signed.to_string(), ins.rs1.to_string())
|
||||||
|
Loading…
Reference in New Issue
Block a user