Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Urbanczyk committed Mar 31, 2024
1 parent 83aeeae commit dd47bf7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ def push_instr(self, opcode):

def push_register_load_imm(self, reg_id, val):
addi_imm = signed_to_int(val & 0xFFF, 12)
lui_imm = (val & 0xFFFFF000) >> 12
# handle addi sign extension, see: https://stackoverflow.com/a/59546567
if val & 0x800:
lui_imm = (lui_imm + 1) & (0xFFFFF)

yield from self.push_instr(UTypeInstr(opcode=Opcode.LUI, rd=reg_id, imm=lui_imm << 12).encode())
yield from self.push_instr(
Expand Down

0 comments on commit dd47bf7

Please sign in to comment.