#!/usr/bin/env bash # SPDX-License-Identifier: MIT # Rung 5 (the reference's: srg320's P65C816 votes on the first 1,000 # SingleStepTests states of each file). The HDL is a GPL tool kept outside the # family's MIT repositories and is not re-run here: it judges the corpus and # the core, not the transcription. This rung holds the crate to the reference # on exactly those 508,400 states, C4's included and nothing masked: every # cycle's address, value and eight pins, the final registers and the memory, # identical (sst --dump against scripts/reference_sst.py, cached per pin), so # every vote the reference's rung 5 recorded holds for this crate unchanged. set -euo pipefail source "$(dirname "$0")/env.sh" require_reference nice -n 19 cargo build --release -q --manifest-path "$ROOT/Cargo.toml" expected="$REFERENCE_CACHE/sst-1000.txt" mkdir -p "$REFERENCE_CACHE" if [ ! -s "$expected" ]; then nice -n 19 "$REFERENCE_PYTHON" -I "$ROOT/scripts/reference_sst.py" "$SST_65816" --out "$expected" --limit 1000 --jobs "${JOBS:-3}" fi nice -n 19 "$ROOT/target/release/sst" "$SST_65816" --dump "$ROOT/external/rung5.rust.txt" --limit 1000 --jobs "${JOBS:-4}" if cmp -s "$expected" "$ROOT/external/rung5.rust.txt"; then echo "rung 5: passed, $(wc -l < "$expected") states, every cycle identical to the reference's" else cmp "$expected" "$ROOT/external/rung5.rust.txt" || true echo "rung 5: FAILED (the first differing line names the case)" exit 1 fi