Crate long

Crate long 

Source
Expand description

Rung 5 without MAME traces: a long synthetic program on a seeded bus.

long SEED STEPS [--alternate]

Every read is answered from a 64-bit linear congruential generator, so the core runs a random instruction stream with random operands, through every opcode, T and D both ways, with the mapper changing under it. Every 1,024 cycles the bus takes one more value from the generator and drives the interrupt inputs with it (the three lines, now and then the disable register, an NMI, rarely a reset). Every cycle is folded into a digest (address, value, and what the callback sees in the pins: the cycle’s kind, the clock switch, the opcode) and so is the whole CpuState after every step; the digest is printed every 250,000 steps and at the end. scripts/reference_long.py does the same on the reference core, and the two outputs are compared line for line.

Block transfers would swallow the run (65,536 bytes each, on average half that): a read that returns one of the five block opcodes is changed to the opcode before it 63 times in 64, on both sides alike.

Structs§

Noise 🔒

Constants§

PRIME 🔒

Functions§

fold_state 🔒
Every field of the state, in the order the reference’s script folds them.
main 🔒
seen 🔒
What a callback can see of the CPU, for the digest: the cycle’s kind as Pins::kind gives it, the clock switch and the opcode.
tri 🔒