# Domains and channels The charter's "Domains and channels": parts that keep their own time and meet the others only at channels. This page names the PS2's, with the sync points each channel implies (JIT proposal J2, J6). execution-architecture.md puts numbers on them. ## Time base and the order of record One integer time base, the **EE cycle** (294.912 MHz): a bus cycle is 2, an IOP cycle 8 (memory-map.md). PS1 mode multiplies the base by 147 (an IOP cycle = 1,280 units, an EE cycle = 147). The **order of record** (x-python, serial): the EE Core steps by instruction pairs; at each channel access it first brings the other domain up to its own time ("catch up at the channel", as in sega32x-python, psx-python and n64-python); producers run at their joins and at frame ends. Every later backend must reach the same states at the same moments (`-fast`) or the same observables (turbo). ## The domains | Domain | What is in it | Why together | | --- | --- | --- | | **A: EE** | EE Core (ee-python) with COP1 and the COP2 socket, **VU0** (macro mode is a coprocessor; its micro mode is started and polled by the EE), DMAC, INTC, EE timers, IPU front end (registers, FIFOs, busy model), SIF's EE side, the scratchpad, main RAM and its controller | the DMAC steals the EE's bus and shares the scratchpad port cycle by cycle (ECUM §6.4.2, EEUM §5.2.1); VU0 macro instructions interlock with the EE pipeline | | **B: VPU1 and the GIF** | VIF1, **VU1**, the GIF with its three-path arbitration, PATH3 masking, the **GS front end** (register state, setup/rasteriser timing model, CSR events, FINISH/SIGNAL/LABEL, host-local transfer state, privileged registers, PCRTC timing) | VIF1 writes VU1 memory while VU1 runs (double buffering); XGKICK, PATH2 and PATH3 arbitrate per packet; the GS's input order is decided here (vif-gif.md) | | **C: GS back end** (producer) | pixel work: rasterising, texturing, blending, tests, writes to local memory; PCRTC scan-out pixels | it changes nothing any other domain reads until a join | | **D: IOP** | IOP CPU (r3000a-python, IOP configuration), IOP DMA, IOP timers, IOP INTC, SIO2 and the pads/cards, SIF's IOP side, the CDVD's register front end and its HLE command engine | the PS1-style I/O complex; it meets A only through the SIF and SBUS interrupts | | **E: SPU2** | both cores' voices, envelopes, ADMA, effects | inline with D at each register access (psx-python's rule); its host-rate mix is a producer | | **F: drive** | the disc mechanics and, later, the MechaCon (LLE) | events only (sector ready, seek done); stepped on D's clock in the order of record, as segacd-python steps its drive on the sub CPU's clock | VU0 is in A, not B: in macro mode it is part of the EE's pipeline, and in micro mode the EE starts it with VCALLMS and waits on it with interlocked moves; its data memory is DMA'd by VIF0 (ch. 0) from A's DMAC. ## The channels and their sync points | Channel | Between | Sync points | | --- | --- | --- | | DMA ch. 1 (VIF1) and ch. 2 (GIF PATH3) | A -> B | every slice (8 qwords) the DMAC hands to the VIF1/GIF FIFOs; FIFO full/empty back-pressure; D_STAT completion | | EE stores to VU1 memory (1100C000h), VIF1/GIF registers, GS privileged registers (12000000h) | A -> B | each access (uncached, so each is a bus transaction: ee-python's WBB/UCAB rules shape them) | | INT_VIF1, INT_VU1, INT_GS (INTC bits 5, 7, 0), V-blank (bits 2, 3) | B -> A | the event times, predicted by B's front end and by the PCRTC timing | | CSR/SIGLBLID reads, GIF_STAT and VIF1_STAT reads | A reads B | each read: B must be at A's time | | GS joins: local-to-host transfers (via VIF1 ch. 1 reversed by BUSDIR), PCRTC scan-out of a buffer being drawn, a texture read of a region the back end has pending writes for (the GS's internal RAW hazard), FINISH if its time depends on pixel results (gs.md U19) | B <-> C | the join: C finishes every primitive started before the reader's time | | SIF mailboxes (MSCOM, SMCOM, MSFLG, SMFLG, SIF_CTRL) | A <-> D | each access | | SIF0/SIF1/SIF2 FIFOs (EE ch. 5/6/7, IOP ch. 9/10/2) | A <-> D | each FIFO qword (or each DMA slice) with back-pressure; DICR/INT_SBUS | | SPU2 registers, IOP DMA ch. 4/7 | D -> E | each access (inline) | | CDVD registers, IOP DMA ch. 3, IRQ2 | D <-> F | command issue, event times | ## Memory kinds and who writes them memory-map.md, "Memory kinds". The two facts that matter most for speed: **all game code is in main RAM and the I-cache does not snoop** (DMA into code is seen only after the game invalidates: a cached interpreter keyed by I-cache line is exact by construction), and **VU micro memory is rewritten constantly** by VIF MPG uploads (a VU block cache must be keyed by content, as n64-python keys RSP blocks).