# Timing: what is known and what the specification can claim ## What ARM says about its own numbers DDI 0360F chapter 15 opens: "Complex instruction dependencies and memory system interactions make it impossible to describe briefly the exact cycle timing behavior for all instructions in all circumstances. The timings described in this chapter are accurate in most cases. If precise timings are required you must use a cycle-accurate model of the MP11 CPUs." Its counts are **best case**: no outstanding dependencies, no resource conflicts, MicroTLB and cache hits (15.1). The manufacturer's document is therefore an instruction-level timing source with interlock rules, not a cycle-exact one, and it says so. ## What the chapter gives - Per-instruction issue cycles and result latencies for data processing, saturating, media, SAD, multiplies, branches, PSR updates, loads and stores (single, double, multiple), RFE/SRS, synchronization and coprocessor instructions, SWI/BKPT/undefined, and Thumb (15.3-15.17). - Register interlocks with worked examples (15.2). - Branch prediction: a 128-entry direct-mapped dynamic predictor indexed by VA[9:3] with 2-bit saturating counters; only constant-offset branches predicted; a dynamically predicted branch takes one cycle, or zero when folded; static prediction issues from Iss and a statically predicted branch costs four cycles; a 3-entry return stack (pushed by BL/BLX, popped by BX lr, MOV pc,lr, LDR pc,[sp],#c, LDMIA sp!,{..,pc}), a correctly predicted pop costing four cycles (15.1.1). ## What was measured on a 3DS (by others) - GBATEK "ARM CPU Instruction Cycle Times", ARM11: a SUBS+BNE wait loop takes 4 clocks per iteration without branch prediction and 2.5 with it (DOC; GBATEK's own measurement, method not stated). That is the only 3DS ARM11 timing measurement found. ## The memory side Cache hits are modelled by the core. Misses go out on the AXI ports to the board's memories (FCRAM, VRAM, AXI WRAM, the DSP memory, I/O), whose latency and contention are the board's (n3ds-python memory-map.md, unknown list). The New 3DS's L2C-310 sits between them. ## Proposal: the modelling level **Instruction level with an interlock scoreboard and transaction-level memory**, as vr4300-python and arm946es-python chose: - Each instruction's issue cost from chapter 15, plus interlock stalls computed from a per-register "ready at" time (the scoreboard), plus branch-prediction outcomes from a modelled BTAC and return stack (state, deterministic), plus memory stalls from the cache model and the board's transaction times. - No stage-by-stage pipeline simulation in the reference. The N64 and SH-2 work showed that simulating stages is where exact interpreters spend their time (n64-python execution-architecture.md, citing sh2-rust-fast's profile: 37 % in the stage scheduler); timing as data keeps the Rust tiers cheap. - Every count carries DOC (chapter 15) or FITTED (to a named test) or HYPOTHESIS. **What the core claims**, plainly: "results exact to the ARM ARM; time per instruction as DDI 0360F's best-case tables with interlocks and the modelled predictor and caches; not cycle-exact, because no public cycle-exact description of the MP11 exists". A title whose behaviour depends on exact ARM11 cycle counts (a timing loop calibrated against a timer, a race between cores) is the place this shows; such cases go to the unknown list when met.