Files
retroDE_ps2/docs/hardware/ps2_feeder_scene_retrigger_test.sh
T
thejayman77 ec82764bef Initial commit: retroDE_ps2 — first-of-its-kind PS2 GS FPGA core (DE25-Nano / Agilex 5)
RTL (GS rasterizer, EE core stub, platform bridge, LPDDR4B path), sim regression
(272 TBs), docs, and tooling. Copyrighted PS2 content (BIOS, game code, GS dumps,
and all dump-derived textures/traces) is excluded via .gitignore and stays local.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 20:10:50 -04:00

49 lines
6.5 KiB
Bash

#!/bin/sh
# retroDE_ps2 — Ch337 board acceptance: CLEAN scene-level retrigger for >FIFO_DEPTH scenes.
#
# Streams two distinct 14-prim (>FIFO_DEPTH = 2-batch) scenes and retriggers each on feeder_ready:
# A: tiles 0-13 RED B: tiles 2-15 BLUE
# Sequence A -> B -> A. Each scene's first (full-flush) batch wipes the WHOLE framebuffer, and the
# Ch337 control FSM only reports ready once the WHOLE multi-batch scene has drained — so the host
# can retrigger without racing the last batch. EXPECTED HDMI after the final stage:
# tiles 0-13 RED, tiles 14-15 background, and ZERO blue anywhere (scene B fully gone).
# A premature-ready race (pre-Ch337) would leave BLUE residue from B or a half-drawn frame.
set -u
BASE="${PS2_BRIDGE_BASE:-0x40000000}"
DEVMEM="${DEVMEM:-busybox devmem}"
OFF_STATUS=0x0D8; OFF_LO=0x0DC; OFF_HI=0x0E4; OFF_GO=0x0E8
w() { $DEVMEM $(printf "0x%X" $(( BASE + $1 ))) w "$2" >/dev/null; }
r() { $DEVMEM $(printf "0x%X" $(( BASE + $1 ))) w; }
SCENE_A="000000000000000e 0000000000010000 0000000000000044 0000000000050000 0000000000000002 0000000088004060 0000000000000053 00000000ff0000ff 0000000000000000 0000500000100010 00000000ff0000ff 0000000000000030 00005000001000e0 00000000ff0000ff 00000000000c0000 0000500000e00010 00000000ff0000ff 0000000000000000 0000510000100110 00000000ff0000ff 0000000000000030 00005100001001e0 00000000ff0000ff 00000000000c0000 0000510000e00110 00000000ff0000ff 0000000000000000 0000520000100210 00000000ff0000ff 0000000000000030 00005200001002e0 00000000ff0000ff 00000000000c0000 0000520000e00210 00000000ff0000ff 0000000000000000 0000530000100310 00000000ff0000ff 0000000000000030 00005300001003e0 00000000ff0000ff 00000000000c0000 0000530000e00310 00000000ff0000ff 0000000000000000 0000540001100010 00000000ff0000ff 0000000000000030 00005400011000e0 00000000ff0000ff 00000000000c0000 0000540001e00010 00000000ff0000ff 0000000000000000 0000550001100110 00000000ff0000ff 0000000000000030 00005500011001e0 00000000ff0000ff 00000000000c0000 0000550001e00110 00000000ff0000ff 0000000000000000 0000560001100210 00000000ff0000ff 0000000000000030 00005600011002e0 00000000ff0000ff 00000000000c0000 0000560001e00210 00000000ff0000ff 0000000000000000 0000570001100310 00000000ff0000ff 0000000000000030 00005700011003e0 00000000ff0000ff 00000000000c0000 0000570001e00310 00000000ff0000ff 0000000000000000 0000580002100010 00000000ff0000ff 0000000000000030 00005800021000e0 00000000ff0000ff 00000000000c0000 0000580002e00010 00000000ff0000ff 0000000000000000 0000590002100110 00000000ff0000ff 0000000000000030 00005900021001e0 00000000ff0000ff 00000000000c0000 0000590002e00110 00000000ff0000ff 0000000000000000 00005a0002100210 00000000ff0000ff 0000000000000030 00005a00021002e0 00000000ff0000ff 00000000000c0000 00005a0002e00210 00000000ff0000ff 0000000000000000 00005b0002100310 00000000ff0000ff 0000000000000030 00005b00021003e0 00000000ff0000ff 00000000000c0000 00005b0002e00310 00000000ff0000ff 0000000000000000 00005c0003100010 00000000ff0000ff 0000000000000030 00005c00031000e0 00000000ff0000ff 00000000000c0000 00005c0003e00010 00000000ff0000ff 0000000000000000 00005d0003100110 00000000ff0000ff 0000000000000030 00005d00031001e0 00000000ff0000ff 00000000000c0000 00005d0003e00110"
SCENE_B="000000000000000e 0000000000010000 0000000000000044 0000000000050000 0000000000000002 0000000088004060 0000000000000053 00000000ffff0000 0000000000000000 0000500000100210 00000000ffff0000 0000000000000030 00005000001002e0 00000000ffff0000 00000000000c0000 0000500000e00210 00000000ffff0000 0000000000000000 0000510000100310 00000000ffff0000 0000000000000030 00005100001003e0 00000000ffff0000 00000000000c0000 0000510000e00310 00000000ffff0000 0000000000000000 0000520001100010 00000000ffff0000 0000000000000030 00005200011000e0 00000000ffff0000 00000000000c0000 0000520001e00010 00000000ffff0000 0000000000000000 0000530001100110 00000000ffff0000 0000000000000030 00005300011001e0 00000000ffff0000 00000000000c0000 0000530001e00110 00000000ffff0000 0000000000000000 0000540001100210 00000000ffff0000 0000000000000030 00005400011002e0 00000000ffff0000 00000000000c0000 0000540001e00210 00000000ffff0000 0000000000000000 0000550001100310 00000000ffff0000 0000000000000030 00005500011003e0 00000000ffff0000 00000000000c0000 0000550001e00310 00000000ffff0000 0000000000000000 0000560002100010 00000000ffff0000 0000000000000030 00005600021000e0 00000000ffff0000 00000000000c0000 0000560002e00010 00000000ffff0000 0000000000000000 0000570002100110 00000000ffff0000 0000000000000030 00005700021001e0 00000000ffff0000 00000000000c0000 0000570002e00110 00000000ffff0000 0000000000000000 0000580002100210 00000000ffff0000 0000000000000030 00005800021002e0 00000000ffff0000 00000000000c0000 0000580002e00210 00000000ffff0000 0000000000000000 0000590002100310 00000000ffff0000 0000000000000030 00005900021003e0 00000000ffff0000 00000000000c0000 0000590002e00310 00000000ffff0000 0000000000000000 00005a0003100010 00000000ffff0000 0000000000000030 00005a00031000e0 00000000ffff0000 00000000000c0000 00005a0003e00010 00000000ffff0000 0000000000000000 00005b0003100110 00000000ffff0000 0000000000000030 00005b00031001e0 00000000ffff0000 00000000000c0000 00005b0003e00110 00000000ffff0000 0000000000000000 00005c0003100210 00000000ffff0000 0000000000000030 00005c00031002e0 00000000ffff0000 00000000000c0000 00005c0003e00210 00000000ffff0000 0000000000000000 00005d0003100310 00000000ffff0000 0000000000000030 00005d00031003e0 00000000ffff0000 00000000000c0000 00005d0003e00310"
wait_ready() {
i=0
while [ $i -lt 300 ]; do st=$(r $OFF_STATUS); [ $(( st & 1 )) -eq 1 ] && return 0; i=$(( i + 1 )); sleep 0.01 2>/dev/null || true; done
echo " !! feeder never reported ready"; return 1
}
stage() { # $1=label $2=words
echo "--- stage $1 ---"
wait_ready || exit 1
w $OFF_STATUS 0x0; n=0
for word in $2; do
lo=$(printf '%s' "$word" | cut -c9-16); hi=$(printf '%s' "$word" | cut -c1-8)
w $OFF_LO 0x$lo; w $OFF_HI 0x$hi; n=$(( n + 1 ))
done
echo " wrote $n words; bridge addr=$(( $(r $OFF_LO) ))"
wait_ready || exit 1 # Ch337: ready only after the PRIOR scene fully drained
w $OFF_GO 0x1
wait_ready || exit 1 # ready again only after THIS >8 scene fully drained
echo " records=$(( $(r $OFF_HI) )) (expect 14)"
}
echo "=== Ch337 clean retrigger: A (RED 0-13) -> B (BLUE 2-15) -> A (RED 0-13) ==="
stage "A (RED tiles 0-13)" "$SCENE_A"
stage "B (BLUE tiles 2-15)" "$SCENE_B"
stage "A again (RED tiles 0-13)" "$SCENE_A"
echo "=== Final HDMI must be EXACTLY scene A: RED tiles 0-13, NO blue anywhere (B fully gone). ==="