# Start here: the VR4300 as the Nintendo 64 uses it Phase 0, 2026-11-25. Page numbers ("UM p.N") are the printed page numbers of NEC's *VR4300, VR4305, VR4310 64-Bit Microprocessor User's Manual*, U10504EJ7V0UMJ1 (7th edition, 2000; `reference/docs/vr4300-users-manual.pdf`, tier 2). "R4400 UM" is MIPS's *R4000/R4400 Microprocessor User's Manual*, 2nd edition (Heinrich, 1994; tier 2), the architecture the VR4300 implements. "n64brew: Page" is the pinned revision of that wiki page (`scripts/pinned_wiki.json`; CC BY-SA 4.0, facts only, tier 3). ## What the chip is - A 64-bit MIPS III CPU (upward compatible with the R3000, "completely compatible" with the VR4400 and VR4200: UM p.32) with a **five-stage pipeline** (IC RF EX DC WB, UM p.90), not the R4000's eight. DOC. - On-chip: a 32-double-entry joint TLB (JTLB) and a 2-entry instruction micro-TLB (UM p.32, p.49: fully associative, LRU, 4 KB per entry); a **16 KB direct-mapped instruction cache, 32-byte lines**; an **8 KB direct-mapped write-back data cache, 16-byte lines**; both virtually indexed, physically tagged (UM p.275-277); a write buffer of four entries (UM p.120); the FPU as CP1; CP0. - External bus: the 32-bit SysAD multiplexed address/data bus (UM chapter 12), clocked by SClock, which "usually has the same frequency as the MasterClock" (UM p.35). - Clocks: PClock = MasterClock x DivMode ratio; the ratio 1:1.5 exists only on the 100 MHz part (UM Table 1-1). On the N64 the MasterClock is 62.5 MHz and PClock 93.75 MHz (n64brew: VR4300, Clock Timing). One pipeline stage per PCycle. The CP0 Count register counts at half PClock (UM p.164: "half the PClock speed"), so 46.875 MHz on the N64. DOC. - The N64 part is "a NEC VR4300 with slight modifications": six pins moved (n64brew: VR4300 > Modifications; tier 3, "more research is required"). PRId reads 0x0B10 (early) or 0x0B22 (later); FCR0 reads 0x0B00 (n64brew: VR4300 > Revision Identifiers, "so far" found on retail units: OBSERVED by the wiki's authors). ## What the core owns, and what the board owns The core is the whole chip, as sh2-python is the whole SH7604: anything inside the package is in the core. | Core (`vr4300_python`) | Board (`n64_python`) | | --- | --- | | GPRs (64-bit), HI/LO, PC, LLbit | the physical memory map (RDRAM, RCP registers, PIF, cartridge) | | the decoder and every MIPS III instruction | the RCP: MI (the interrupt controller), RSP, RDP, VI, AI, PI, SI, RI | | CP0: TLB, exceptions, Count/Compare, Status, Cause, Config, the cache tags (TagLo/TagHi) | which interrupt pin each RCP source drives (MI -> Int0, per n64brew) | | CP1: the FPU, FCSR, its exceptions | the PIF's reset and NMI (and the pre-NMI interrupt) | | the I-cache, the D-cache, the write buffer | the SysAD responder: how long the RCP takes to answer a read | | the pipeline's stalls (interlocks) and their cycle cost | the DivMode ratio and MasterClock (a construction parameter) | | the SysAD transaction issuer (single, block read 8 words for I-cache, 4 words for D-cache, writes) | 64DD and iQue specifics | The boundary is **one bus interface** carrying SysAD transactions (kind, physical address, size, data) with the time each takes, plus five interrupt inputs (Int0-Int4; the N64 wires Int0 to the MI and leaves the others, per n64brew: VR4300 pins, to be confirmed by the board's Phase 0), NMI, Reset and ColdReset. The core never knows what is at an address. ## Address spaces (UM chapter 5) 32-bit mode (the N64's games run here; libultra never sets KX/SX/UX): kuseg 0x00000000-0x7FFFFFFF (TLB mapped), kseg0 0x80000000-0x9FFFFFFF (unmapped, cached, physical = virtual - 0x80000000), kseg1 0xA0000000-0xBFFFFFFF (unmapped, uncached), ksseg and kseg3 (mapped). 64-bit mode adds xkuseg, xksseg, xkphys (unmapped windows with a cache attribute in bits 61-59) and xkseg. Registers are 64 bits wide in both modes; in 32-bit mode a 32-bit result is sign-extended to 64 bits (UM chapter 3). Physical addresses are 32 bits. The exception vectors (UM p.180-181): reset, soft reset and NMI at 0xBFC00000 (0xFFFFFFFFBFC00000 in 64-bit mode); TLB refill +0x000, XTLB refill +0x080, the rest +0x180, from base 0x80000000 (BEV=0) or 0xBFC00200 (BEV=1). On the N64 0xBFC00000 is the PIF boot ROM (board). ## Known N64-observed deviations from the manual (n64brew: VR4300, tier 3, OBSERVED) These are hardware results reported on the wiki, not tested by us: 1. **SRA/SRAV**: the shift takes bits from the whole 64-bit register before sign-extending bit 31 of the result (example on the page: 0x0123456789ABCDEF >> 16 gives 0x00000000456789AB, not the manual's 0xFFFFFFFFFFFF89AB). The manual's description is wrong for this part. Present "in more consoles than the multiplication bug". 2. **MULT/DIV with inputs that are not sign-extended 32-bit values** give results that leak the upper bits (the manual calls such inputs undefined). Reported for PRId revision 2.2. 3. **The load interlock is imprecise**: it compares register fields, not true uses, so two loads into the same register, or a LUI whose `rt` or unused `rs` bits match the load's destination, also stall one cycle. 4. **The multiplication bug** of early steppings (NUS-01..03 boards): a floating-point multiply in some positions after another (with NaN, zero or infinity operands) gives wrong results; GCC's `-mfix4300` pads with NOPs. Not modelled first (handoff-brief U9). ## Read next 1. [isa.md](isa.md): the instruction set and decode. 2. [cp0-tlb.md](cp0-tlb.md): CP0, the TLB, exceptions, interrupts, the CP0 hazards. 3. [fpu.md](fpu.md): CP1. 4. [timing.md](timing.md): pipeline, interlocks, caches, write buffer, SysAD; the modelling level. 5. [validation.md](validation.md): the oracles and their tiers; the rung ladder. 6. [mame-oracle.md](mame-oracle.md): the recipe that ran, and its traps. 7. [handoff-brief.md](handoff-brief.md).