Skip to content

lab: Milestone 2 — SYT realism: TxTimingModel, simulated timeline, P5 verification (stacked on #24)#25

Merged
mrmidi merged 1 commit into
mrmidi:DICEfrom
boggspa:lab/m2-syt-realism
Jun 10, 2026
Merged

lab: Milestone 2 — SYT realism: TxTimingModel, simulated timeline, P5 verification (stacked on #24)#25
mrmidi merged 1 commit into
mrmidi:DICEfrom
boggspa:lab/m2-syt-realism

Conversation

@boggspa

@boggspa boggspa commented Jun 10, 2026

Copy link
Copy Markdown

What

Milestone 2 per the lab README — SYT realism, the piece you flagged as important for testing ZTS and SYT behavior. Stacked on #24 (M3 bring-up); review the top commit.

Every constant comes from your Saffire-decompile ground truth (SYTGenerator.hpp, TxOutputPhaseLoop.hpp, tools/debug/tx_phase_loop_model.py) — nothing re-derived.

The pieces

  • Ports/ICycleTimeline — time as an explicit port (unwrapped 24.576 MHz ticks). Lab/SimulatedCycleTimeline synthesizes it from audio frame position (6 frames/cycle at 48 kHz); epoch + jitter are constructor/test inputs per the README's adversarial-schedule design.
  • Core/TxTimingModel — the frame→cycle→SYT unit under research:
    • seed = now + presentation delay (4096), then the constant device sub-cycle graft: phase − phase%3072 + 0x0B0 (your reference model's exact formula)
    • fixed 4096-tick step per data packet in the 16-cycle (49152) SYT domain → the +1,+1,+2 cycle pattern with offsets {0x0B0, 0x4B0, 0x8B0}
    • lead health: tight ≤3071 · accept <7620 (the real rejection threshold) · gate ≥7620 · escalate ≥12287 (advisory-only, per your correction)
    • WHO DECIDES THE WIRE: not the model. Cadence stays authoritative — callers Peek the SYT, the packetizer decides DATA/NO-DATA, only emitted data packets Commit. The model tracks, it never decides (mirrors TxOutputPhaseLoop's contract).
  • Verifier P5 (config-gated): data SYTs must step by exactly 4096 in the 16-cycle domain on the graft lattice; data-with-0xFFFF in a timing-valid run is a violation. Self-tests prove each P5 counter fires exactly once per injected fault (skipped step, off-lattice offset, lost clock).
  • Lab/WriteEndTraceReplayer — allocation-free trace-text parser + replay (malformed lines counted, never absorbed); scenario H replays a recorded WriteEnd sequence through the full timed pipeline — the regression harness the M3-captured trace will drop into.
  • Dext wiring: timing + P5 on; the simulated bus rides the exposure cursor (the packet's projected transmit position, per FillFirewireBuffers) so lead sits at the grafted seed by construction; StopIO dump grows p5_step/p5_graft and a timing: line.

Verification

18010 checks, 0 failures   (was 17440)

Unit tests pin the contract exactly: seed SYT 0x10B0 at lead 3248; the 12-packet/16-cycle wrap; all five lead-health boundaries at their exact tick values (3071/3072/7619/7620/12286/12287); graft-disabled mode; the monotonic guard; re-arm/reseed. The timed pump soak holds P1–P5 at zero violations with the lead pinned at the seed across ~65k data packets. All three targets build.

🤖 Generated with Claude Code

… verification

Implements the M2 scope per the lab README, with every constant taken from
the DICE tree's Saffire-decompile ground truth (SYTGenerator.hpp,
TxOutputPhaseLoop.hpp, tools/debug/tx_phase_loop_model.py):

- Ports/ICycleTimeline: time as an explicit port (unwrapped 24.576 MHz
  ticks). Lab/SimulatedCycleTimeline synthesizes it from audio frame
  position (6 frames per cycle at 48 kHz; epoch + jitter knobs are test
  inputs, per the README's adversarial-schedule design).
- Core/TxTimingModel: the frame->cycle->SYT unit under research. Seeds at
  now + presentation delay (4096), grafts the device's constant sub-cycle
  (phase - phase%3072 + 0x0B0, the reference-model formula), advances by
  the fixed 4096-tick blocking step in the 16-cycle (49152) SYT domain,
  and reports transmit-lead health: tight <=3071, accept <7620 (the real
  rejection threshold), gate >=7620, escalate >=12287 (advisory only).
  WHO DECIDES THE WIRE: not the model — cadence stays authoritative;
  callers Peek the SYT, the packetizer decides data/no-data, and only
  emitted data packets Commit (the model tracks, it never decides),
  mirroring TxOutputPhaseLoop's contract.
- Verifier P5 (config-gated): data SYTs must step by exactly 4096 in the
  16-cycle domain and sit on the graft lattice (offset = 0x0B0 mod 1024);
  data packets carrying 0xFFFF in a timing-valid run are violations.
  Self-tests prove each P5 counter fires exactly once per injected fault.
- Controller: EnableLabTiming/PrepareLabPacketTimed/TimingCounters — the
  timed prepare path peeks, prepares, commits-on-data, and records lead
  health telemetry (seeds counted at peek: the seeding peek can land on a
  no-data cycle).
- Lab/WriteEndTraceReplayer: allocation-free trace-text parser
  (sample_time host_time frames; comments; malformed lines counted, never
  absorbed) + Replay — the regression harness Milestone 3's captured
  trace will drop into. Scenario H replays a trace through the full
  timed pipeline.
- Dext wiring: timing + P5 enabled in VirtualAudioDevice; the simulated
  bus rides the exposure cursor (the packet's projected transmit
  position, per Saffire FillFirewireBuffers); StopIO dump grows p5 and
  timing lines.

Unit tests pin the contract exactly: seed SYT 0x10B0 at lead 3248, the
+1,+1,+2 cycle pattern with offsets {0x0B0,0x4B0,0x8B0}, the 12-packet
16-cycle wrap, all five lead-health boundaries, graft-disabled mode, the
monotonic guard, and re-arm/reseed. The timed pump soak holds P1-P5 at
zero violations with the lead pinned at the seed value across ~65k data
packets.

Suite: 18010 checks, 0 failures (was 17440). All three targets build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mrmidi mrmidi merged commit af4ef40 into mrmidi:DICE Jun 10, 2026
2 checks passed
mrmidi added a commit that referenced this pull request Jun 12, 2026
lab: Milestone 2 — SYT realism: TxTimingModel, simulated timeline, P5 verification (stacked on #24)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants