FA-89505 / Instruction set emulation / Member archive
Sign extension tests bit 7 for every size · case 05
Halfword and word loads sign-extend based on their low byte.
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 |
|---|---|---|---|
| halfword loads | [[-2, 65534, -60876, 32769], [133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]] | [[-2, 65534, 4660, 32769], [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 ↗