#!/usr/bin/env bash # SPDX-License-Identifier: MIT # Rung 5: the modules, through seeded fuzz. Random programs over every form with random # BSC (ordinary and synchronous DRAM with refresh), cache, FRT, WDT, INTC, DMAC, DIVU and # SCI settings, pins changed between steps, direct register accesses, resets and save-state # round trips (scripts/make_scenarios.py, fuzz family), the same programs with fresh-chip # round trips (its fresh family), and with seed 1 the edge scenarios (its edges family, # DMA address errors among them): every bus cycle, step and slice state identical. FUZZ # scenarios (default 40) and FRESH (default 10) from SEED (default 1). set -euo pipefail source "$(dirname "$0")/env.sh" require_reference [ -n "${BIN:-}" ] || build FUZZ=${FUZZ:-40}; SEED=${SEED:-1} DIR="$ROOT/external/scenarios/fuzz-s$SEED-n$FUZZ" [ -d "$DIR" ] || "$REFERENCE_PYTHON" "$ROOT/scripts/make_scenarios.py" "$SH2_PYTHON" "$DIR" --only fuzz --fuzz "$FUZZ" --seed "$SEED" > /dev/null # With seed 1, the edge family too: the paths random programs seldom reach (rung 6 found one). EDGES="$ROOT/external/scenarios/edges" [ -d "$EDGES" ] || "$REFERENCE_PYTHON" "$ROOT/scripts/make_scenarios.py" "$SH2_PYTHON" "$EDGES" --only edges > /dev/null # The fresh family: the first FRESH (default 10) of these programs, every save-state round # trip into a fresh chip (the reference's complete ChipState, its R1 fix). FRESH=${FRESH:-10} FRESH_DIR="$ROOT/external/scenarios/fresh-s$SEED-n$FRESH" [ -d "$FRESH_DIR" ] || "$REFERENCE_PYTHON" "$ROOT/scripts/make_scenarios.py" "$SH2_PYTHON" "$FRESH_DIR" --only fresh --fuzz "$FRESH" --seed "$SEED" > /dev/null [ "$SEED" = 1 ] && set -- "$EDGES" "$FRESH_DIR" || set -- "$FRESH_DIR" exec python3 "$ROOT/scripts/lockstep.py" "$DIR" "$@" --rust "${BIN:-$ROOT/target/release/sh2-trace}" --label "${LABEL:-main}" ${EXPLAIN:+--explain}