#!/usr/bin/env bash # SPDX-License-Identifier: MIT # Rung 4: the real-chip capture lockstep (the reference's rungs 4 and 4b), then # interrupt, WAI and STP scenarios traced against the reference. # # Part 1: David Banks's captures of a BBC Master's G65SC12 (G65SC02 row) and a # BBC B's Rockwell R65C02 (R65C02 row), all eight, to the end (168 million # instructions), and George Foot's data-only capture on W65C02S and R65C02, # replayed with the reference's method (src/bin/capture.rs): no mismatch, no # model difference, and every report line equal to the reference's at e49aceb, # unchanged since 9ca4a2f (conformance/expected/capture.txt). MAX_INSTRUCTIONS=N replays a sample. # # Part 2: the interrupt workout under seeded random requests (between steps # and inside bus cycles), RDY stalls of reads and writes, and resets; WAI and # STP; one-cycle NOPs before a pending IRQ; 16 random-memory programs per row: # on every row, traces compared by the reference's first_trace_divergence. set -euo pipefail source "$(dirname "$0")/env.sh" require_reference nice -n 19 cargo build --release -q --manifest-path "$ROOT/Cargo.toml" mkdir -p "$ROOT/external" starts="$ROOT/external/capture-starts.json" if [ ! -s "$starts" ]; then nice -n 19 "$REFERENCE_PYTHON" "$ROOT/scripts/capture_starts.py" "$starts" fi out="$ROOT/external/rung4-capture.txt" status=0 nice -n 19 "$ROOT/target/release/capture" "$CAPTURES" "$starts" "$CAPTURES/foot_data14.bin" \ ${MAX_INSTRUCTIONS:+--max-instructions "$MAX_INSTRUCTIONS"} | tee "$out" || status=$? if [ "$status" != 0 ]; then echo "rung 4: FAILED (a capture replay found a mismatch or a model difference)" exit 1 fi if [ -z "${MAX_INSTRUCTIONS:-}" ]; then if diff "$out" "$ROOT/conformance/expected/capture.txt"; then echo "rung 4, captures: passed, 10 of 10 replays to the end, every line the reference's" else echo "rung 4: FAILED (the replay reports differ from the reference's, above)" exit 1 fi else echo "rung 4, captures: passed on the first $MAX_INSTRUCTIONS instructions of each" fi python3 "$ROOT/scripts/make_scenarios.py" > /dev/null python3 "$ROOT/scripts/lockstep.py" "$ROOT"/conformance/scenarios/interrupts-*.json \ "$ROOT"/conformance/scenarios/wai-stp-*.json "$ROOT"/conformance/scenarios/one-cycle-nops-*.json \ "$ROOT"/external/scenarios/random-memory-*.json --python "$REFERENCE_PYTHON" --jobs "${JOBS:-4}" echo "rung 4: passed"