FAILURE MAP
← Case archive

FA-89501 / Instruction set emulation / Open access

Sign extension tests bit 7 for every size · case 01

Halfword and word loads sign-extend based on their low byte.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The sign test uses the byte sign bit regardless of access size.

THE FAILURE

The sign test uses the byte sign bit regardless of access size.

Unsuccessful approach: Testing bit 8*size is never set, so nothing is sign-extended.

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.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    mem, ops = args
    mem = list(mem)
    out = []
    size = {'b': 1, 'h': 2, 'w': 4}
    for op, addr, val in ops:
        n = size[op[1]]
        if addr % n != 0:
            out.append('misaligned')
            continue
        if addr + n > len(mem):
            out.append('fault')
            continue
        if op[0] == 's':
            for k in range(n):
                mem[addr + k] = (val >> (8 * k)) & 0xFF
            out.append(None)
        else:
            v = 0
            for k in range(n):
                v |= mem[addr + k] << (8 * k)
            if not op.endswith('u') and v >> 7:
                v -= 1 << (8 * n)
            out.append(v)
    return [out, mem]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('signed byte load', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lb', 0, 0], ['lb', 1, 0]]], [[-127, 127], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('unsigned byte load', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lbu', 0, 0], ['lbu', 3, 0]]], [[129, 255], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('halfword loads', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 2, 0], ['lhu', 2, 0], ['lh', 6, 0], ['lhu', 4, 0]]], [[-2, 65534, 4660, 32769], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('word loads', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 0, 0], ['lw', 4, 0]]], [[-98431, 305430529], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('misaligned accesses', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 1, 0], ['lw', 2, 0], ['sh', 3, 4369], ['lb', 3, 0]]], [['misaligned', 'misaligned', 'misaligned', -1], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('store then load back', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sw', 8, 2309737966], ['lw', 8, 0], ['lbu', 9, 0], ['sh', 10, 23130], ['lh', 10, 0]]], [[None, -1985229330, 205, None, 23130], [129, 127, 254, 255, 1, 128, 52, 18, 238, 205, 90, 90]]), ('out of range', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 12, 0], ['lb', 11, 0], ['sb', 12, 1]]], [['fault', 0, 'fault'], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('byte store', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sb', 5, 511], ['lbu', 5, 0], ['lh', 4, 0]]], [[None, 255, -255], [129, 127, 254, 255, 1, 255, 52, 18, 0, 0, 0, 0]])], [('signed byte load', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lb', 0, 0], ['lb', 1, 0]]], [[-126, 127], [130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('unsigned byte load', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lbu', 0, 0], ['lbu', 3, 0]]], [[130, 255], [130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('halfword loads', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 2, 0], ['lhu', 2, 0], ['lh', 6, 0], ['lhu', 4, 0]]], [[-2, 65534, 4660, 32769], [130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('word loads', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 0, 0], ['lw', 4, 0]]], [[-98430, 305430529], [130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('misaligned accesses', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 1, 0], ['lw', 2, 0], ['sh', 3, 4369], ['lb', 3, 0]]], [['misaligned', 'misaligned', 'misaligned', -1], [130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('store then load back', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sw', 8, 2309737965], ['lw', 8, 0], ['lbu', 9, 0], ['sh', 10, 23130], ['lh', 10, 0]]], [[None, -1985229331, 205, None, 23130], [130, 127, 254, 255, 1, 128, 52, 18, 237, 205, 90, 90]]), ('out of range', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 12, 0], ['lb', 11, 0], ['sb', 12, 1]]], [['fault', 0, 'fault'], [130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('byte store', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sb', 5, 511], ['lbu', 5, 0], ['lh', 4, 0]]], [[None, 255, -255], [130, 127, 254, 255, 1, 255, 52, 18, 0, 0, 0, 0]])], [('signed byte load', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lb', 0, 0], ['lb', 1, 0]]], [[-125, 127], [131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('unsigned byte load', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lbu', 0, 0], ['lbu', 3, 0]]], [[131, 255], [131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('halfword loads', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 2, 0], ['lhu', 2, 0], ['lh', 6, 0], ['lhu', 4, 0]]], [[-2, 65534, 4660, 32769], [131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('word loads', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 0, 0], ['lw', 4, 0]]], [[-98429, 305430529], [131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('misaligned accesses', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 1, 0], ['lw', 2, 0], ['sh', 3, 4369], ['lb', 3, 0]]], [['misaligned', 'misaligned', 'misaligned', -1], [131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('store then load back', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sw', 8, 2309737964], ['lw', 8, 0], ['lbu', 9, 0], ['sh', 10, 23130], ['lh', 10, 0]]], [[None, -1985229332, 205, None, 23130], [131, 127, 254, 255, 1, 128, 52, 18, 236, 205, 90, 90]]), ('out of range', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 12, 0], ['lb', 11, 0], ['sb', 12, 1]]], [['fault', 0, 'fault'], [131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('byte store', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sb', 5, 511], ['lbu', 5, 0], ['lh', 4, 0]]], [[None, 255, -255], [131, 127, 254, 255, 1, 255, 52, 18, 0, 0, 0, 0]])], [('signed byte load', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lb', 0, 0], ['lb', 1, 0]]], [[-124, 127], [132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('unsigned byte load', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lbu', 0, 0], ['lbu', 3, 0]]], [[132, 255], [132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('halfword loads', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 2, 0], ['lhu', 2, 0], ['lh', 6, 0], ['lhu', 4, 0]]], [[-2, 65534, 4660, 32769], [132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('word loads', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 0, 0], ['lw', 4, 0]]], [[-98428, 305430529], [132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('misaligned accesses', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 1, 0], ['lw', 2, 0], ['sh', 3, 4369], ['lb', 3, 0]]], [['misaligned', 'misaligned', 'misaligned', -1], [132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('store then load back', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sw', 8, 2309737963], ['lw', 8, 0], ['lbu', 9, 0], ['sh', 10, 23130], ['lh', 10, 0]]], [[None, -1985229333, 205, None, 23130], [132, 127, 254, 255, 1, 128, 52, 18, 235, 205, 90, 90]]), ('out of range', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 12, 0], ['lb', 11, 0], ['sb', 12, 1]]], [['fault', 0, 'fault'], [132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('byte store', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sb', 5, 511], ['lbu', 5, 0], ['lh', 4, 0]]], [[None, 255, -255], [132, 127, 254, 255, 1, 255, 52, 18, 0, 0, 0, 0]])], [('signed byte load', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lb', 0, 0], ['lb', 1, 0]]], [[-123, 127], [133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('unsigned byte load', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lbu', 0, 0], ['lbu', 3, 0]]], [[133, 255], [133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('halfword loads', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 2, 0], ['lhu', 2, 0], ['lh', 6, 0], ['lhu', 4, 0]]], [[-2, 65534, 4660, 32769], [133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('word loads', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 0, 0], ['lw', 4, 0]]], [[-98427, 305430529], [133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('misaligned accesses', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 1, 0], ['lw', 2, 0], ['sh', 3, 4369], ['lb', 3, 0]]], [['misaligned', 'misaligned', 'misaligned', -1], [133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('store then load back', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sw', 8, 2309737962], ['lw', 8, 0], ['lbu', 9, 0], ['sh', 10, 23130], ['lh', 10, 0]]], [[None, -1985229334, 205, None, 23130], [133, 127, 254, 255, 1, 128, 52, 18, 234, 205, 90, 90]]), ('out of range', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 12, 0], ['lb', 11, 0], ['sb', 12, 1]]], [['fault', 0, 'fault'], [133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('byte store', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sb', 5, 511], ['lbu', 5, 0], ['lh', 4, 0]]], [[None, 255, -255], [133, 127, 254, 255, 1, 255, 52, 18, 0, 0, 0, 0]])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
signed byte load[[-127, 127], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]][[-127, 127], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]Passed
unsigned byte load[[129, 255], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]][[129, 255], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]Passed
halfword loads[[-2, 65534, -60876, 32769], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]][[-2, 65534, 4660, 32769], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]Failed
word loads[[-98431, -3989536767], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]][[-98431, 305430529], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]Failed
misaligned accesses[['misaligned', 'misaligned', 'misaligned', -1], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]][['misaligned', 'misaligned', 'misaligned', -1], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]Passed
store then load back[[None, -1985229330, 205, None, -42406], [129, 127, 254, 255, 1, 128, 52, 18, 238, 205, 90, 90]][[None, -1985229330, 205, None, 23130], [129, 127, 254, 255, 1, 128, 52, 18, 238, 205, 90, 90]]Failed
out of range[['fault', 0, 'fault'], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]][['fault', 0, 'fault'], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]Passed
byte store[[None, 255, -255], [129, 127, 254, 255, 1, 255, 52, 18, 0, 0, 0, 0]][[None, 255, -255], [129, 127, 254, 255, 1, 255, 52, 18, 0, 0, 0, 0]]Passed

SHA-256 / 748f8278eb4c94354e656047e73d8891df7ae337329a7167bac793f256a135f6

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    mem, ops = args
    mem = list(mem)
    out = []
    size = {'b': 1, 'h': 2, 'w': 4}
    for op, addr, val in ops:
        n = size[op[1]]
        if addr % n != 0:
            out.append('misaligned')
            continue
        if addr + n > len(mem):
            out.append('fault')
            continue
        if op[0] == 's':
            for k in range(n):
                mem[addr + k] = (val >> (8 * k)) & 0xFF
            out.append(None)
        else:
            v = 0
            for k in range(n):
                v |= mem[addr + k] << (8 * k)
            if not op.endswith('u') and v >> (8 * n):
                v -= 1 << (8 * n)
            out.append(v)
    return [out, mem]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('signed byte load', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lb', 0, 0], ['lb', 1, 0]]], [[-127, 127], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('unsigned byte load', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lbu', 0, 0], ['lbu', 3, 0]]], [[129, 255], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('halfword loads', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 2, 0], ['lhu', 2, 0], ['lh', 6, 0], ['lhu', 4, 0]]], [[-2, 65534, 4660, 32769], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('word loads', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 0, 0], ['lw', 4, 0]]], [[-98431, 305430529], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('misaligned accesses', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 1, 0], ['lw', 2, 0], ['sh', 3, 4369], ['lb', 3, 0]]], [['misaligned', 'misaligned', 'misaligned', -1], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('store then load back', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sw', 8, 2309737966], ['lw', 8, 0], ['lbu', 9, 0], ['sh', 10, 23130], ['lh', 10, 0]]], [[None, -1985229330, 205, None, 23130], [129, 127, 254, 255, 1, 128, 52, 18, 238, 205, 90, 90]]), ('out of range', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 12, 0], ['lb', 11, 0], ['sb', 12, 1]]], [['fault', 0, 'fault'], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('byte store', [[129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sb', 5, 511], ['lbu', 5, 0], ['lh', 4, 0]]], [[None, 255, -255], [129, 127, 254, 255, 1, 255, 52, 18, 0, 0, 0, 0]])], [('signed byte load', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lb', 0, 0], ['lb', 1, 0]]], [[-126, 127], [130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('unsigned byte load', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lbu', 0, 0], ['lbu', 3, 0]]], [[130, 255], [130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('halfword loads', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 2, 0], ['lhu', 2, 0], ['lh', 6, 0], ['lhu', 4, 0]]], [[-2, 65534, 4660, 32769], [130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('word loads', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 0, 0], ['lw', 4, 0]]], [[-98430, 305430529], [130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('misaligned accesses', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 1, 0], ['lw', 2, 0], ['sh', 3, 4369], ['lb', 3, 0]]], [['misaligned', 'misaligned', 'misaligned', -1], [130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('store then load back', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sw', 8, 2309737965], ['lw', 8, 0], ['lbu', 9, 0], ['sh', 10, 23130], ['lh', 10, 0]]], [[None, -1985229331, 205, None, 23130], [130, 127, 254, 255, 1, 128, 52, 18, 237, 205, 90, 90]]), ('out of range', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 12, 0], ['lb', 11, 0], ['sb', 12, 1]]], [['fault', 0, 'fault'], [130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('byte store', [[130, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sb', 5, 511], ['lbu', 5, 0], ['lh', 4, 0]]], [[None, 255, -255], [130, 127, 254, 255, 1, 255, 52, 18, 0, 0, 0, 0]])], [('signed byte load', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lb', 0, 0], ['lb', 1, 0]]], [[-125, 127], [131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('unsigned byte load', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lbu', 0, 0], ['lbu', 3, 0]]], [[131, 255], [131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('halfword loads', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 2, 0], ['lhu', 2, 0], ['lh', 6, 0], ['lhu', 4, 0]]], [[-2, 65534, 4660, 32769], [131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('word loads', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 0, 0], ['lw', 4, 0]]], [[-98429, 305430529], [131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('misaligned accesses', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 1, 0], ['lw', 2, 0], ['sh', 3, 4369], ['lb', 3, 0]]], [['misaligned', 'misaligned', 'misaligned', -1], [131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('store then load back', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sw', 8, 2309737964], ['lw', 8, 0], ['lbu', 9, 0], ['sh', 10, 23130], ['lh', 10, 0]]], [[None, -1985229332, 205, None, 23130], [131, 127, 254, 255, 1, 128, 52, 18, 236, 205, 90, 90]]), ('out of range', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 12, 0], ['lb', 11, 0], ['sb', 12, 1]]], [['fault', 0, 'fault'], [131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('byte store', [[131, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sb', 5, 511], ['lbu', 5, 0], ['lh', 4, 0]]], [[None, 255, -255], [131, 127, 254, 255, 1, 255, 52, 18, 0, 0, 0, 0]])], [('signed byte load', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lb', 0, 0], ['lb', 1, 0]]], [[-124, 127], [132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('unsigned byte load', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lbu', 0, 0], ['lbu', 3, 0]]], [[132, 255], [132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('halfword loads', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 2, 0], ['lhu', 2, 0], ['lh', 6, 0], ['lhu', 4, 0]]], [[-2, 65534, 4660, 32769], [132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('word loads', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 0, 0], ['lw', 4, 0]]], [[-98428, 305430529], [132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('misaligned accesses', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 1, 0], ['lw', 2, 0], ['sh', 3, 4369], ['lb', 3, 0]]], [['misaligned', 'misaligned', 'misaligned', -1], [132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('store then load back', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sw', 8, 2309737963], ['lw', 8, 0], ['lbu', 9, 0], ['sh', 10, 23130], ['lh', 10, 0]]], [[None, -1985229333, 205, None, 23130], [132, 127, 254, 255, 1, 128, 52, 18, 235, 205, 90, 90]]), ('out of range', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 12, 0], ['lb', 11, 0], ['sb', 12, 1]]], [['fault', 0, 'fault'], [132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('byte store', [[132, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sb', 5, 511], ['lbu', 5, 0], ['lh', 4, 0]]], [[None, 255, -255], [132, 127, 254, 255, 1, 255, 52, 18, 0, 0, 0, 0]])], [('signed byte load', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lb', 0, 0], ['lb', 1, 0]]], [[-123, 127], [133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('unsigned byte load', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lbu', 0, 0], ['lbu', 3, 0]]], [[133, 255], [133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('halfword loads', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 2, 0], ['lhu', 2, 0], ['lh', 6, 0], ['lhu', 4, 0]]], [[-2, 65534, 4660, 32769], [133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('word loads', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 0, 0], ['lw', 4, 0]]], [[-98427, 305430529], [133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('misaligned accesses', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lh', 1, 0], ['lw', 2, 0], ['sh', 3, 4369], ['lb', 3, 0]]], [['misaligned', 'misaligned', 'misaligned', -1], [133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('store then load back', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sw', 8, 2309737962], ['lw', 8, 0], ['lbu', 9, 0], ['sh', 10, 23130], ['lh', 10, 0]]], [[None, -1985229334, 205, None, 23130], [133, 127, 254, 255, 1, 128, 52, 18, 234, 205, 90, 90]]), ('out of range', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['lw', 12, 0], ['lb', 11, 0], ['sb', 12, 1]]], [['fault', 0, 'fault'], [133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]), ('byte store', [[133, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0], [['sb', 5, 511], ['lbu', 5, 0], ['lh', 4, 0]]], [[None, 255, -255], [133, 127, 254, 255, 1, 255, 52, 18, 0, 0, 0, 0]])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
signed byte load[[129, 127], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]][[-127, 127], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]Failed
unsigned byte load[[129, 255], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]][[129, 255], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]Passed
halfword loads[[65534, 65534, 4660, 32769], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]][[-2, 65534, 4660, 32769], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]Failed
word loads[[4294868865, 305430529], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]][[-98431, 305430529], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]Failed
misaligned accesses[['misaligned', 'misaligned', 'misaligned', 255], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]][['misaligned', 'misaligned', 'misaligned', -1], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]Failed
store then load back[[None, 2309737966, 205, None, 23130], [129, 127, 254, 255, 1, 128, 52, 18, 238, 205, 90, 90]][[None, -1985229330, 205, None, 23130], [129, 127, 254, 255, 1, 128, 52, 18, 238, 205, 90, 90]]Failed
out of range[['fault', 0, 'fault'], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]][['fault', 0, 'fault'], [129, 127, 254, 255, 1, 128, 52, 18, 0, 0, 0, 0]]Passed
byte store[[None, 255, 65281], [129, 127, 254, 255, 1, 255, 52, 18, 0, 0, 0, 0]][[None, 255, -255], [129, 127, 254, 255, 1, 255, 52, 18, 0, 0, 0, 0]]Failed

SHA-256 / 74288b769cdc7ff4ce442b96b9419af680f27e2b12ec15d8d82bd46713c741c7

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

A deterministic bounded teaching model of one emulator rule; the instruction semantics are a stipulated contract inspired by common ISAs and are not a claim of cycle-exact or architectural conformance. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:51:18.061340+00:00.

Case digest / 0caa26e8677008e0856d8824542a427811d08a2090bb922b5c8e61cdff8d5546