Module trace

Module trace 

Source
Expand description

The lockstep gate’s side of this board: per-frame digests of everything the gate compares, in the spelling scripts/pce_trace.py writes for the reference.

Not a module of the reference: its counterpart there is scripts/state_roundtrip.py’s observe and digest and scripts/presses.py. A frame’s line holds the frame counter, the master clock, the count and SHA-1 of the CPU bus log (Board::bus_log: physical address, value, kind, master clock of every cycle), the SHA-1 of the picture (capture.last_frame: the rows as little-endian u16, then the dividers), the count and SHA-1 of the mixed audio (take_audio, little-endian i16 pairs) and the CPU’s whole CpuState.

Structs§

Press
A press BUTTONS@FRAME+HOLD (the reference’s scripts/presses.py): the buttons, joined with -, are held while the count of completed frames is in FRAME .. FRAME+HOLD-1.
Setup
How a traced machine is built: the command line shared by pce-trace, pce-state-roundtrip and scripts/pce_trace.py (which builds the reference the same way).

Functions§

cpu_text
Every field of the CPU’s state, in CpuState’s order.
detail_lines
The per-cycle lines of Board::bus_detail (the gate’s narrowing mode), emptied.
frame_line
The line of the frame that just ran. Empties the bus log and takes the audio.
held
The buttons down while frame frames have completed.
parse_press
roundtrip
Save states, proven complete (the reference’s scripts/state_roundtrip.py roundtrip): power on, run to frame at plus extra instructions (so the save falls anywhere in a frame, between two instructions), save, then build a second system the same way, load the state into it, and run both to frame to. Every frame after the save must be the same on both, by the gate’s own lines. A third run loads the state into a system that has run elsewhere first (to frame at / 2); and the loaded system, saved at once, must give the same bytes back. Ok says what was compared, Err what differed.
run_frames
Run frames frames with the setup’s presses; a line a frame.
runahead
The snapshot pair in a run-ahead pass: every frame is run, a snapshot taken, ahead more frames run with other buttons held, and the snapshot put back. Each frame’s line, and the state at the end, must equal those of a run that never looked ahead.
set_psg_switch
One of the PSG’s switches by the reference’s attribute name.