Generated by python3 tools/encode_check.py; byte addresses are at left. The script encodes R/I/S/B/J fields and calculates expected state from the assembly operations.
| PC | Machine word | Assembly | Purpose |
|---|---|---|---|
| 0 | 00500093 |
addi x1,x0,5 |
loop limit |
| 4 | ffe00113 |
addi x2,x0,-2 |
negative sign extension |
| 8 | 002081b3 |
add x3,x1,x2 |
x3=3 |
| 12 | 40208233 |
sub x4,x1,x2 |
x4=7 |
| 16 | 01000513 |
addi x10,x0,16 |
base address |
| 20 | fe452e23 |
sw x4,-4(x10) |
mem[12]=7 |
| 24 | ffc52283 |
lw x5,-4(x10) |
x5=7 |
| 28 | 00000313 |
addi x6,x0,0 |
loop counter |
| 32 | 00130313 |
addi x6,x6,1 |
count |
| 36 | 00130463 |
beq x6,x1,8 |
exit loop at five |
| 40 | ff9ff06f |
jal x0,-8 |
loop back, discard link |
| 44 | 00208463 |
beq x1,x2,8 |
not taken |
| 48 | 008003ef |
jal x7,8 |
x7=52, skip next word |
| 52 | 06300413 |
addi x8,x0,99 |
must stay skipped |
| 56 | 00900013 |
addi x0,x0,9 |
x0 must remain zero |
| 60 | 0000006f |
jal x0,0 |
completion self-loop |
Independent expected completion: PC remains 60; x0=0, x1=5, x2=-2 (0xfffffffe), x3=3, x4=7, x5=7, x6=5, x7=52, x8=0, x10=16, memory at byte address 12 = 7. The integration test compares each of those values. Expected dynamic instruction count to first observe PC=60 is 26 trace rows, including the completion instruction.