Changed hexa format to lowercase

This commit is contained in:
Samy Solhi 2023-02-07 22:00:53 +01:00
parent f9046f411a
commit 89aaa4e821

View File

@ -68,13 +68,13 @@ pub fn print(ins: Instruction, pc: i32) -> String { //TODO pc should be u64
}
},
RISCV_LUI => {
format!("lui\t{}, 0x{:X}", REG_X[rd], ins.imm31_12)
format!("lui\t{}, 0x{:x}", REG_X[rd], ins.imm31_12)
},
RISCV_AUIPC => {
format!("auipc\t{}, {:X}", REG_X[rd], ins.imm31_12)
format!("auipc\t{}, {:x}", REG_X[rd], ins.imm31_12)
},
RISCV_JAL => {
format!("jal\t{},{:X}", REG_X[rd], (pc + ins.imm21_1_signed))
format!("jal\t{},{:x}", REG_X[rd], (pc + ins.imm21_1_signed))
},
RISCV_JALR => {
format!("jalr\t{},{}({})", REG_X[rd], ins.imm12_I_signed, REG_X[rs1])
@ -174,8 +174,8 @@ mod test {
fn test_lui() {
let lui = decode::decode(0b01110001000011111000_11100_0110111);
let lui_negatif = decode::decode(0b11110001000011111000_11100_0110111);
assert_eq!("lui\tt3, 0x710F8000", print::print(lui, 0));
assert_eq!("lui\tt3, 0xF10F8000", print::print(lui_negatif, 0));
assert_eq!("lui\tt3, 0x710f8000", print::print(lui, 0));
assert_eq!("lui\tt3, 0xf10f8000", print::print(lui_negatif, 0));
}
#[test]