Skip to content

Commit

Permalink
fixed int cast error in lui
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphjzhang committed May 24, 2023
1 parent 89213aa commit 52270dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cpu.zig
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ pub const Cpu = struct {
} else return Exception.illegal_instruction;
},
0x37 => { // lui
const imm = @intCast(i64, @truncate(u32, inst & 0xffff_f000));
self.regs[rd] = @bitCast(u64, imm);
const imm = @bitCast(i32, inst & 0xffff_f000);
self.regs[rd] = @bitCast(u64, @intCast(i64, imm));
},
0x3b => {
const rs1_u = self.regs[rs1];
Expand Down

0 comments on commit 52270dc

Please sign in to comment.