Pseudo-code:
tree[0:63] <- (RB)
- rb_used <- 0b0
+ ra_used <- 0b0
in_bits[0:63] <- (RC|0)
if in_bits = 0 then
in_bits[0:63] <- 1
final_in_bits <- in_bits
- final_rb_used <- rb_used
+ final_ra_used <- ra_used
output <- [0] * 64
out_byte <- 0
decoded[0:7] <- 1
do while out_byte < 8
in_bit <- in_bits[63]
if in_bits = 1 then
- if rb_used | (_RA = 0) then
+ if ra_used | (_RA = 0) then
leave
- rb_used <- 0b1
+ ra_used <- 0b1
in_bit <- (RA)[63]
in_bits <- 0b1 || (RA)[0:62]
else
if decoded <u 64 then
if tree[63 - decoded] then
final_in_bits <- in_bits
- final_rb_used <- rb_used
+ final_ra_used <- ra_used
output[56 - 8 * out_byte:63 - 8 * out_byte] <- decoded
decoded[0:7] <- 1
out_byte <- out_byte + 1
leave
RT <- output
RS <- final_in_bits
- CR0 <- final_rb_used || 0b0 || (output = 0) || so_bit
+ CR0 <- final_ra_used || 0b0 || (output = 0) || so_bit
Special Registers Altered:
expected_RT = int.from_bytes(
[int("1" + code, 2) for code in decoded], 'little')
decoded_bits_len = len("".join(decoded))
- expected_rb_used = False
+ expected_ra_used = False
RB_val = make_tree(*supported_codes)
rev_input_bits = input_bits[::-1]
RA_val = 0
RA_val = int(rev_input_bits[:64], 2)
RA = 7
rev_input_bits = rev_input_bits[64:]
- expected_rb_used = decoded_bits_len > len(rev_input_bits)
- if expected_rb_used:
+ expected_ra_used = decoded_bits_len > len(rev_input_bits)
+ if expected_ra_used:
expected_RS = (RA_val + 2 ** 64) >> decoded_bits_len
RC_val = int("1" + rev_input_bits, 2)
if expected_RS is None:
e = ExpectedState(pc=4, int_regs=gprs)
e.intregs[4] = expected_RT
e.intregs[5] = expected_RS
- e.crregs[0] = expected_rb_used * 8 + expected_EQ * 2 + expected_SO
+ e.crregs[0] = expected_ra_used * 8 + expected_EQ * 2 + expected_SO
with self.subTest(supported_codes=supported_codes,
input_bits=original_input_bits):
self.add_case(Program(lst, False), gprs, expected=e,