# The GPU: DMP's PICA200 Source: GBATEK "3DS Video", "3DS GPU ..." sections (DOC unless marked). The PICA200 is Digital Media Professionals' design; DMP publishes no register-level document that was found. GBATEK's text is itself partly marked unknown ("Unknown what that means", "The full functionality of PE is not yet understood"): this is the thinnest-documented major block of the machine. ## Blocks and maps - **External registers** (10400000h-10400FFFh, ARM11 only): memory control and status, two memory-fill engines (PSC0/PSC1, interrupts 28h/29h), the two LCD framebuffer set-ups (PDC0 top, PDC1 bottom: formats, addresses for left/right eye, H/V interrupts 2Ah/2Bh), and the memory-copy/"display transfer" engine (PPF, 2Ch) that also tiles, untiles, scales and converts formats. - **Internal registers** (10401000h, also reachable as PICA command numbers 0000h-03FFh in command lists): command-list control and the finalize interrupt (P3D, 2Dh); the geometry pipeline (vertex attribute buffers, index buffers, fixed attributes, immediate mode, primitive configuration); four shader units' registers (GBATEK: "Shader 0 (Geometry Shader)", "Shader 1 (Vertex Shader)", and two more "(Unknown purpose)"; 3dbrew is reported by GBATEK to document only two); the rasteriser; texturing (three texture units plus a procedural texture unit, environment maps); six **texture combiner** stages (TEXENV0-5) with their sources, operands, combine functions and scales, and a combiner buffer; fragment lighting (LUT-driven); fog; the framebuffer (colour, depth and stencil formats, blending and logic ops, alpha/stencil/depth tests, early depth). - **Memory**: VRAM 6 MB at 18000000h in two 3 MB banks; the GPU can also read FCRAM, AXI WRAM and the New 3DS extra memory "most probably slower" (GBATEK). Textures and framebuffers are tiled (GBATEK "3DS Video Texture Swizzling"). ## The programmable part Vertex (and geometry) shaders run on the shader units: 32-bit instructions in a program memory loaded by register writes; operand descriptors (swizzles, negation, write masks) in a separate table; float uniforms, integer uniforms (loop counters), boolean uniforms; an address register (MOVA); flow control (IFU/IFC, LOOP, CALL/CALLC/CALLU, JMPC/JMPU, BREAK/BREAKC); the geometry shader's EMIT/SETEMIT. Arithmetic: ADD, DP3, DP4, DPH, DST, EX2, LG2, LITP, MUL, SGE, SLT, FLR, MAX, MIN, RCP, RSQ, MOV, MAD and the inverted-operand forms (GBATEK "3DS GPU Shader Instruction Set - Opcode Summary"; nihstro (BSD-3) and picasso (MIT) are two independent readings of the same encoding, pinned in reference/src). **Numbers are float24** (1 sign, 7 exponent, 16 mantissa bits: GBATEK's "float24 (float1.7.16) transfer mode"), with float32 and float16 at some interfaces. How the shader units round, what EX2/LG2/RCP/RSQ return exactly, how denormals and infinities behave, and how the rasteriser's fixed-point steps work are **not documented** (U9-U11): a bit-exact PICA200 needs hardware tests. The homebrew tests pinned in reference/src (mikage-hwtests `gpu/`, 3ds-gputest) are the starting point; their verdicts have to be captured on a console (we have none). ## Hangs are behaviour GBATEK "3DS GPU Pitfalls" lists configurations that **freeze** the PICA200: a vertex stride that does not match the attributes, an output component not written exactly once, two adjacent MOVA instructions. A specification models these as a hung GPU (the busy state that never clears), because that is what software observes, and tags each with GBATEK's DOC. ## The modelling level (proposal) - **Front end at transaction level**: register writes and command lists decoded in order, with the time each draw, fill and transfer completes computed from its work (vertex count, fragment count, bytes moved) by a timing model. That model is HYPOTHESIS until measured: no PICA200 timing measurement was found. - **Back end at functional level per fragment**, bit-exact where tests decide, with float24 arithmetic implemented explicitly (integer softfloat, as the VFP). - Split as the N64's RDP and the PlayStation GPU: the front end on the CPU's thread, the back end a producer that runs behind until a join (execution-architecture.md). Whether that split stays exact depends on U12: is the completion time a function of the commands and memory contents alone? ## Other video blocks in the board CAM (camera input, two buses), Y2R (YUV to RGBA), on the New 3DS L2B and MVD (a movie decoder whose function GBATEK marks "or so?"), and LGYFB (legacy GBA/DS video into 3DS framebuffers). Y2R is used by video playback in games; MVD by New 3DS video titles; LGYFB only in legacy modes. All in the board (chip rule: one machine).