# CPU cores the Saturn needs The chip rule: CPUs always get their own core repository. The Saturn holds seven processors with their own instruction streams. Two are covered, one cannot be built, and three are new. This document is the Phase 0 section on each new core; none of them is created tonight. | Processor | Where | Core | Status | | --- | --- | --- | --- | | SH7604 (SH-2) x 2 | main CPUs | **sh2-python**, sh2-rust (sh2-rust-fast being built) | exists; rungs 0-4 pass (its README) | | MC68EC000 | sound | **m68000-python**, -rust, -rust-fast | exists; the 68EC000 runs here as a 16-bit-bus 68000 (scsp.md) | | HD404920FS (4-bit) | SMPC | none | firmware not dumped: model functionally (smpc.md) | | SH-1 (SH7032 or SH7034) | CD block | **sh1-python** (new, deferred) | only for a low-level CD block | | SCU DSP | SCU | **scudsp-python** (new) or inside the board | open decision 4 | | SCSP DSP | SCSP | inside the board (or a future scsp-python) | not a separate core: see below | | MPEG card decoders | optional card | none | out of scope | ## sh1-python: the CD block's SH-1 **What it is.** The SH-1 is the first SuperH: the SH-2's instruction set minus nine instructions the SH-2 added (DT, MAC.L, DMULS.L, DMULU.L, MUL.L, BF/S, BT/S, BRAF, BSRF: DOC: PM, the "SH-2 CPU only" notes on each), a MAC.W whose MACH keeps 10 bits (PM "Functions Listed by CPU Type", as sh2-python's start-here quotes it), and its own pipeline figures for the multiplier (PM figures 7.14-7.22 and 7.45-7.52, which sh2-python skips as the SH-1's). The chip around it is different from the SH7604: SH1HM describes the SH7032/SH7034's bus state controller (with DRAM and a 16-bit external bus), a four-channel DMAC, the ITU (five 16-bit timer channels), two SCIs, an A/D converter, the TPC, PFC and I/O ports, a WDT and an interrupt controller, plus on-chip ROM and RAM (DOC: SH1HM ch. 1). The Saturn's CD block uses it at 20 MHz (OVW) or 16 MHz (MAME), C3. **Proposed shape.** Like 65816-python on 6502-python's frame: `sh1-python` pins sh2-python for the instruction core (decode table and handlers), restricts it to the SH-1's forms through a CPU-type switch, adds the SH-1 multiplier timing, and owns the SH7032/SH7034 peripherals as modules beside the CPU (the same call sh2-python made for the SH7604's on-chip modules). This needs one change upstream: sh2-python must expose its instruction core separately from the SH7604's modules, or accept a CPU-type option. That is sh2-python's decision and is a proposal in this repository's report, not a change made here. **Evidence.** Hitachi's SH-1/SH-2 programming manual (pinned by sh2-python) and SH1HM (pinned here, 631-page scan with an OCR layer). No SH-1 single-step corpus is known. Detectors: MAME's SH-1 (its `cdbcpu`, run as a closed box). Other users in the family: none known; the SH-1 was used widely in 1990s embedded designs (printers, drives), not in other consoles the family plans. **Rungs** (same shape as sh2-python's): 0 decode table from PM with the SH-1 subset marked; 1 generated single-instruction cases against MAME's SH-1 and the manual's rulings; 2 a replay of the CD block firmware's instruction stream from a MAME trace (`scripts/mame_trace.py --cpu cdb` records it); 3 PM's SH-1 pipeline figures state for state; 4 the peripherals' documented examples (ITU, DMAC). Exit: the CD block ROM runs its reset path to its main loop in lockstep with MAME's trace. **Why deferred.** The SH-1 core is small work given sh2-python; what a low-level CD block lacks is knowledge of the gate array and the drive (cdblock.md). Build `sh1-python` when that knowledge exists or when the board has shown that the high-level block fails on timing. ## scudsp-python: the SCU DSP **What it is.** A fixed-point coprocessor in the SCU: 256 x 32-bit program RAM, four 64 x 32-bit data RAM banks, a 32 x 32 -> 48-bit multiplier, a 48-bit ALU and accumulator, X/Y/D1 bus moves in parallel with the ALU in one 32-bit instruction, conditional jumps, LOOP, END/ENDI, and a DMA instruction between its data RAM and the buses (DOC: SCU ch. 4; OVW table 3.2). It runs at half the CPU clock (DOC: OVW 3.2). The SCU manual's chapter 4 gives the full command list with encodings and the operand rules; the DSP assembler manuals (ST-240-A and its addendum) add the assembler's view. **Evidence.** Sega's manual is tier 2 and complete for the instruction set. Corner cases (overflow, carry, what the DMA instruction does with odd counts, timing of the end interrupt) are where the MiSTer and Ymir developers asked for hardware tests (sources.md: news reports of Celeriyacon's private tests). No public hardware-captured DSP test is known. Detectors: MAME's `scudsp` (OBSERVED: present in the `saturn` and `stvbios` device lists). **Where it lives (open decision 4).** It is a programmable processor, so the rule says its own core. Against that: it exists only inside the SCU, which only the Saturn and ST-V use, and it is small (an afternoon's worth of handlers). Recommendation: its own repository `scudsp-python`, because the rule is plain ("CPUs always get their own core"), because a separate core gets its own single-step corpus and gate, and because the JIT proposal's handler subset and generated interpreters apply to it as to any CPU. The board's SCU then owns only the DSP's ports, its DMA requests and its end interrupt. **Rungs.** 0 decode table from SCU ch. 4; 1 generated cases per instruction against MAME's scudsp and the manual's rulings; 2 the board's games' DSP programs (captured by the board as it runs them) replayed against MAME; 3 any hardware-captured results that appear. ## The SCSP DSP: not a separate core It runs a fixed 128-step program once per sample, with no branches (dAsms's command list has only multiply, add, subtract, store and the three loads LDI, LDY, LDA: DOC: ST-228 p. 14-15), so it is closer to a configurable datapath than to a CPU. Recommendation: it stays inside the SCSP model, as the SCSP stays in the board. Its instruction encoding is undocumented by Sega (scsp.md, U13); that gap blocks it more than any question of where it lives. If the SCSP is ever extracted as `scsp-python` (open decision 5), the DSP goes with it. ## The SMPC's MCU: no core The HD404920FS's mask ROM is not dumped (MAME 0.285 models the SMPC at a high level), so a core would have nothing to run. The SMPC is modelled from its manual (smpc.md).