# Timing: what "cycle exact" can mean for an out-of-order core Evidence tags as in the methodology. DOC citations are to the pinned Intel manuals (`reference/docs/`, scripts/pinned_files.json): **245127-001** is the Intel Architecture Optimization Reference Manual (02/99, Pentium II and III), **SDM 1/2/3** the IA-32 Software Developer's Manual volumes of 2003 (245470/1/2-012), **242690** the Pentium Pro Family Developer's Manual vol. 1. ## What the hardware does (as far as Intel says) - **Front end, in order.** Fetch from 16-byte-aligned blocks; three decoders, the first takes instructions of up to four micro-ops, the other two one micro-op each and up to eight bytes ("4-1-1"); up to three instructions and six micro-ops decoded per clock; instructions over seven bytes or of more than four micro-ops decode slower (micro-code sequencer). DOC 245127-001 ch. 1, "Decoders"; appendix C gives each instruction's micro-op count. - **Branch prediction.** A 512-entry BTB with four-bit history per entry, a return stack buffer, static prediction (backward taken, forward not taken) for branches missing from the BTB. Correctly predicted taken: about one clock of fetch lost. Mispredicted: at least nine clocks, typically 10-15, up to 26. Static-predicted, not in BTB: about 5-6. DOC 245127-001 ch. 1, "Branch Prediction Overview". - **Out-of-order core.** Micro-ops wait in a 20-entry reservation station; up to five dispatch per clock, one per port (0: ALU, LEA, shifts, IMUL, x87 FADD/FMUL/FDIV, MMX ALU and multiplier, SSE multiply/divide/sqrt; 1: ALU, MMX ALU and shifter, SSE add, reciprocal, shuffle; 2: loads; 3: store address; 4: store data). A 40-entry reorder buffer retires up to three micro-ops per clock in program order. DOC 245127-001 Table 1-1, Figure 1-2, appendix A. - **Latencies (DOC 245127-001 Table 1-1).** ALU 1; IMUL 4 (throughput 1); FADD 3; FMUL 5 (one every two clocks); FDIV 18/32/38 for single/double/extended, not pipelined; MMX ALU 1, MMX multiply 3; load 3 on an L1 hit; store data 1. SSE in appendix D. - **Caches.** L1 instruction and data caches of 16 KB each, 4-way, 32-byte lines, pseudo-LRU, write-back; the data cache in eight banks interleaved on four bytes (245127-001 ch. 1, "Caches"; SDM 3 Table 10-1). L2: on the die on Coppermine, **128 KB on the Xbox's part** (xboxdevwiki `CPU` r7347). Its associativity is contested (C1). TLBs: instruction 32 entries 4-way for 4 KB pages and 2 fully associative for 4 MB pages; data 64 entries 4-way and 8 entries 4-way for 4 MB pages (SDM 3 Table 10-1, "P6 family"). Twelve store buffers, four write-combining buffers (same table). - **Memory ordering.** Processor ordering: reads may pass buffered writes, writes leave in program order, write hits cannot pass write misses (245127-001 ch. 1, "Store Buffers"); memory types from the MTRRs and PAT (UC, WC, WT, WP, WB; SDM 3 ch. 10). - **The bus.** The P6 front-side bus: 64 data bits, split transactions with deferred replies, cache-line bursts (242690). On the Xbox it runs at 133 MHz with the CPU at 5.5 times that (MAME's `xbox` machine lists the CPU at 733,333,333 Hz, OBSERVED; xboxdevwiki `Motherboard` r7356 says "733MHz CPU 133MHz FSB", tier 3 with no measurement cited; U2). ## What none of the sources gives - The scheduler's policy (which ready micro-op goes first when two compete for a port), the exact retirement and recovery timing after a mispredict, the BTB's index and replacement rules, the L1 pseudo-LRU's exact bits, the L2's timing on the Xbox's part, the bus's arbitration and DRAM timing behind the NV2A's memory controller. - Any hardware capture of a P6's bus cycles or of per-instruction cycle counts in a form that could be a corpus. SingleStepTests 80386 is a 386EX on a 16-bit bus; its README says itself that it is "unlikely to be particularly informative for anyone attempting cycle-accurate CPU emulation of the most common 386 variant", and the P6 is three generations later. So **no oracle at any tier can judge a P6's timing cycle by cycle**, and the family has no Xbox to measure. That is the honest starting point. ## Three possible meanings of "cycle exact", and the one proposed 1. **Every bus cycle identical to the hardware** (the Z80, the 6502, the 68000 in this family). *Not reachable*: no judge exists, and the hardware's cycle behaviour depends on state no document describes. Claiming it would break "never claim more certainty than the evidence supports". 2. **A microarchitectural simulation** (decoders, RS, ports, ROB, predictor, as a cycle model). *Possible to write, impossible to check*: every parameter beyond Intel's tables would be FITTED to nothing. It would also cost the Rust tiers dearly (the SH-2 lesson: the time-keeping is the work; late-era method, section 6). 3. **A defined timing model, exact between tiers.** *Proposed.* The specification states, as data: - per instruction form: micro-op count (245127-001 appendix C), a base cost, and result latency (Table 1-1, appendix D), with a small scoreboard for the few dependency stalls that software can observe in aggregate (FDIV and FSQRT not pipelined; IMUL and FMUL latency); - the cache and TLB **state** exactly as the architecture exposes it (contents matter for WBINVD, INVD, CLFLUSH-less flushes, self-modifying code and DMA coherence) and a fixed miss cost per level, FITTED; - the front-side bus as **transactions with times**: every uncached and write-combined access, every line fill and write-back, every locked cycle, with the model's time stamp. These are what the board sees. Under this meaning the charter's tier rule still holds exactly: x86-p3-rust emits the same bus transactions at the same model times as x86-p3-python, and the -fast tier keeps them. What changes is the claim the README makes: **"time is the specification's model, FITTED in aggregate, not the hardware's cycles"**, and every timing constant carries FITTED or HYPOTHESIS. ## What Xbox software can observe of time (why option 3 is enough) - **RDTSC.** The kernel's performance counter is the TSC at the CPU clock (HYPOTHESIS: KeQueryPerformanceFrequency returns 733,333,333; to read on the board). A title that measures a loop with RDTSC sees the model's cost of that loop. - **Polling another domain.** Loops on NV2A or APU registers, or on memory a DMA master writes, see how many iterations fit before the other side changes. That is set by the bus transactions' times and the other domain's timing, both of which the model defines. - **Interrupt arrival points.** Interrupts are taken at instruction boundaries in the model (the hardware takes them at retirement boundaries: DOC SDM 3 ch. 5); which instruction an interrupt follows is part of the model's determinism, not a hardware claim. - **Write-combining flush points.** The push buffer and vertex buffers are written through write-combining memory (HYPOTHESIS from the D3D model; the board will show the MTRR and PAT settings). When a WC buffer drains decides when the NV2A can see the data. The model drains on the architectural triggers (SFENCE, a UC access, a locked instruction, an interrupt, a full set of four buffers, CPUID and other serialising instructions: SDM 3 ch. 10) and at no other time. That is deterministic and documented; exactly when the hardware drains otherwise is unknown (U5). Nothing in Microsoft's libraries can depend on the P6's per-instruction cycle counts: they were written for one CPU but through a C compiler, for a machine whose GPU and APU run asynchronously. Games that break under a different timing model would break under xemu's too (xemu's CPU is QEMU's TCG or a hardware hypervisor: OBSERVED from xboxdevwiki `Emulators` r7319, neither cycle-timed). So the board's judges are its own test programs and pictures (xbox-python validation.md), not cycle counts. ## Aggregate judges for the model - **abaire's Xbox tests** report pass/fail per case on results only: none of the sources at `d7a6e7e` uses RDTSC (checked 2026-11-26), so they judge no timing. - **Benchmarks written for the Xbox**, run on hardware by someone who owns one, with their numbers published: none found. A small RDTSC probe suite (dependent chains of IMUL, FDIV, loads that miss L1 and L2, mispredicted branches, WC write bursts) would be the first tier-1 timing data; it needs an Xbox, which the family does not have (decision 6). - **The P6 latency tables** (245127-001) for the in-core costs: tier 2. - **MAME** charges about 1.2 cycles per instruction over the BIOS 4134 boot window (mame-oracle.md): a model, not a measurement, and a detector only. ## Interrupts, exceptions and the reset - Precise exceptions in program order with the documented error codes and priorities (SDM 3 ch. 5); fault vs trap EIP rules; the interrupt shadow after MOV SS, POP SS and STI; double fault and shutdown (triple fault), which the Xbox's MCPX ROM uses on its error path ("intends to triple-fault": xboxdevwiki `Boot Process` r7377). - Reset state from SDM 3 Table 9-1 (P6 column): EIP 0000FFF0h, CS selector F000h base FFFF0000h, CR0 60000010h, EFLAGS 00000002h, EDX 000006xxh (the CPUID signature), x87 control word 0040h at power-up. MAME's first trace line shows CR0 = 60000010h and EIP FFFFFFF0h (OBSERVED).