diff --git a/riscemu/decoder/formats.py b/riscemu/decoder/formats.py index 0b67d6a..296e6ca 100644 --- a/riscemu/decoder/formats.py +++ b/riscemu/decoder/formats.py @@ -55,12 +55,11 @@ def imm_u(ins: int): def imm_j(ins: int): - imm = ins >> 12 return sign_extend( - ((imm >> 8) & 0b1111111111) + - ((imm & 1) << 10) + - ((imm & 0b11111111) << 11) + - (imm & 0b10000000000000000000), 20 + (((ins >> 21) & 0b1111111111) << 1) + + (((ins >> 20) & 1) << 11) + + (((ins >> 12) & 0b11111111) << 12) + + (((ins >> 31) & 1) << 20), 21 )