FA-89500 / Instruction set emulation / Member archive
Unsigned byte load sign-extends · case 05
lbu of a byte with bit 7 set returns a negative value.
Case contract
Input [mem, ops]: mem is a byte list; ops [op, addr, value] with lb/lbu/lh/lhu/lw loads and sb/sh/sw stores (sizes 1/2/4). An access whose address is not a multiple of its size yields 'misaligned' (checked first); one extending past memory yields 'fault'. Data is little-endian. lb/lh/lw sign-extend from their top bit, lbu/lhu zero-extend. Stores write the low size bytes of value and yield None. Return [results, final memory].
Why this case matters
Memory access emulation must reproduce endianness, extension and alignment traps bit-exactly.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| unsigned byte load | [[-123, -1], [133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]] | [[133, 255], [133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗