Skip to content

Overview

Alex Damhuis edited this page Nov 2, 2026 · 1 revision

One host, n cores

This page describes what the firmware is made of, how a core is loaded, and which cores exist. Architecture is the arc42 architecture description, Framework describes the two applications and their menus, Floorplan shows the floorplan of the FPGA, Cores lists every machine and Screenshots shows the screens.

1. General

1.1 Purpose

This manual describes the architecture of the TRX64 Ultimate MultiCore firmware. It names the blocks, the interfaces between them, and the rules that hold for every core.

1.2 Applicability

The firmware runs on the Ultimate 64 Elite II and on the C64 Ultimate. Both boards have the same mainboard and the same FPGA (XC7A50T). No other FPGA size is supported: the host application refuses a full firmware image that has no bitstream for the XC7A50T.

1.3 Conventions

Note: A NOTE gives information that helps the reader.

Caution: A CAUTION names a condition that can damage data or stop the board from starting.

Layer 1 is the host gateware. Layer 2 is a core. Layer 3 is software. pb_l1 and pb_l2 are the FPGA regions of layers 1 and 2.

2. System description

2.1 Principle

One host stays loaded in the FPGA. A small machine is a core: a partial bitstream for the region pb_l2. The host loads it through the internal configuration port (ICAP). The host keeps its clocks, its DDR2 controller, its USB, SD and Ethernet drivers and its HDMI output while the core changes. A machine that does not fit the region (13,600 LUT, 40 block-RAM tiles, 40 DSP slices) is a large core: a full bitstream of the whole FPGA that the host starts with the ICAP command IPROG (3.5). Ten of the fifteen machines are large cores. The C64 is not built here: it comes as full firmware (.cfw, 3.4).

Note: A core change is a cold start. Nothing of the old core remains. The application of the new core writes ROMs and settings again.

2.2 Layers

flowchart TB
  subgraph L3["Layer 3: applications (RISC-V software in DDR2)"]
    A1["host application"]
    A2["core application, generic"]
    A3["application of a full firmware, .cfw"]
  end
  subgraph L2["Layer 2: core, replaceable (pb_l2)"]
    C1["machine"]
    C2["drive and media engines"]
    C3["picture and audio source"]
    C4["connector pins"]
    C5["null core in the flash, c64ref build only"]
  end
  subgraph L1["Layer 1: host, never reconfigured (pb_l1)"]
    H1["RISC-V and boot ROM"]
    H2["ICAP loader, decoupler"]
    H3["DDR2 arbiter"]
    H4["USB, SD, flash, Ethernet"]
    H5["scaler, overlay, pixel layer, HDMI encoder"]
    H6["pins, clocks"]
  end
  L3 <-->|"contract: 247 ports, decoupler"| L2
  L2 <--> L1
Loading

2.3 Repository layout

Path Content
host/ Layer 1: top level, floorplan (build.tcl), boot ROM, generic core build (core.tcl).
cores/<name>/ One core: layer2_<name>.v, core_sources.tcl (sets l2_dcp), core.toml (id, name, version, contract, application, order, experimental, sources, ROM names).
cores/c64ref/ The reference core, a slim C64U machine. The host is routed together with it. It is built only and never shipped.
cores/<name>/mono/ Flat build of a large core: its descriptor, build_mono.tcl and host/, a copy of the host files it builds with (the file FROM names the host commit). The lint tools/check_large_copies.py guards the copies.
cores/common/ IEC bus and 1541 drive. Several cores read it.
contract/ The port list of the partition (layer2_ports.txt) and its version (VERSION). host_pin.txt pins the host files.
host-app/ Host application: boot menu, package readers, core start, full-firmware start.
coreapp/ Generic core application: shared services and one source file per core.
apps/ultimate Ultimate application (submodule), the base of the host application.
vendor/icepi Third-party HDMI sources that the host also reads.
release/ Release sets and board manifests.
VERSION The SemVer of the firmware, 0.2.0 (section 9).

Caution: A core must not change a host file. contract/host_pin.txt pins the host files, and the lint stage fails when one changes. A core that needs different behavior has its own copy under cores/<name>/. A large core builds from its own copy of the host files, so a host change reaches it only when the copy is updated on purpose.

3. Start-up and core loading

3.1 Start-up of the host

  1. The FPGA configures itself from the flash, address 0x000000. This is the host bitstream.
  2. The boot ROM in the host starts. It first checks for an application that was loaded over JTAG. If there is one, it runs it.
  3. Otherwise the boot ROM reads the host application from the flash, address 0x220000. It starts the application only when the bitstream stamp in the flash is equal to the stamp of the running bitstream.
  4. The host application shows the boot menu (Framework). When a default entry and a countdown are set, it starts the default entry when the countdown ends.

3.2 Start of a core (.cor bundle)

A bundle holds a manifest, the partial bitstream, the core application and an optional icon. The manifest has a SHA-256 for each part. It names the contract version and the host key of the host that the partial was routed against. The SHA-256 of the parts is checked once, when the entry is added to the boot menu (Framework).

  1. Verify. Header, contract version, host key. The stored hash is trusted while the directory entry and the header are unchanged. Nothing is changed yet.
  2. Decouple. Requests masked, outputs idle, pins released. The host waits and reads the status back.
  3. Load. The partial goes through the ICAP. The host compares the word count with the bundle.
  4. Release and jump. The host releases the decoupler, writes the hand-over page and copies the application to its load address.
  5. Seed and run. The core application reads ROMs and settings, writes them to the core and releases the machine reset.

Caution: When the ICAP word count is wrong, the core stays decoupled. The user must pick a core again or switch the board off and on.

3.3 Return to the host

The core application has a menu entry that sends the ICAP command IPROG with the start address 0. The FPGA then loads the host bitstream again from flash address 0.

3.4 Full firmware (.cfw)

A .cfw file is a complete firmware image with its own bitstream. The boot menu lists it beside the .cor files.

  1. The host selects the bitstream whose IDCODE is that of the XC7A50T. A file without such a bitstream, or without an application record, is refused.
  2. The host keeps the bitstream in one scratch file of the flash drive. It rewrites the file only when the bitstream differs, and it compares the file with the bitstream on every start.
  3. The host stages the application in DDR2 under the address map that the bitstream needs.
  4. The host sets both clock synthesizers to their factory default, writes the boot magic and sends IPROG with the flash address of the scratch file.

Note: The way back from a full firmware is a power cycle. The host is not reloaded by the firmware. Firmware images for the C64: Ultimate firmware 3.15, Commodore 1.1.0 and TRX64-Ultimate.

3.5 Large core (large .cor)

A large core is a .cor of kind "large". It holds a manifest, the core application, an optional icon and the full bitstream (record 5). The manifest names the IDCODE of the FPGA and the address map instead of the contract and the host key. The host checks the IDCODE against the running FPGA and against the bitstream, and starts the core by the path of 3.4. The core application is the generic one. The way back is the menu entry of 3.3.

Caution: The hand-over page in DDR2 survives the IPROG of a large core. Seen on the board (2026-10-26): after a ZX core and a return to the host, a large Amiga 1200 core read the page of the ZX core and refused to run. Two cores share the ID AMIG (Amiga 500 and 1200), so the core application also needs the core name in the page to pick its descriptor. The start of a large .cor writes the page itself (path and manifest name) and a .cfw start wipes it. This is on main and proven on the board (the A1200 starts with it).

4. Video chain

The host makes the HDMI output for every core, partial and large (host/hdmi_out.v, one mode table hdmi_modes.vh). A core delivers its picture in one of two ways.

  • Palette raster (C64-type cores, the reference core c64ref): the ports pix_color (4 bit), pix_x, pix_y. This path is locked to the VIC frame and runs at 1080p only.
  • Frame buffer (all other machines): the core writes RGB565 pixels into DDR2 through its port e_*. The host pixel layer reads them and scales them. The ports pix_* then carry an idle raster, to which the output timing locks.
flowchart TB
  C["Core (layer 2): palette raster, or RGB565 frame buffer in DDR2"]
  V["vic_scaler (layer 1): palette raster only. 400 x 270 source pixels x 4 into the 1920 x 1080 frame, locked to the core clock"]
  O["overlay (layer 1): character layer of the application menu, at the whole factor of the mode"]
  P["pix_layer (layer 1): RGB565 picture from DDR2 to any output size. Integer, Fit, Fill, optional smoothing, colour key, global alpha, page flip at frame start"]
  T["c64_text (layer 1): text layer of the freeze menu, scaled 4, 3 or 2 with the mode"]
  H["hdmi_timing, TMDS encoder, tmds_rep, hdmi_gtp (layer 1): timing of the chosen mode, HDMI audio and video packets, TMDS bit repetition for low-rate modes, serializer in the GTP transceiver"]
  C --> V --> O --> P --> T --> H
Loading

Console builds without the VIC path (NO_C64VIDEO) leave vic_scaler and c64_text out. 2640 x 1125 clocks per frame at 50 Hz, 2200 x 1125 at 60 Hz.

4.1 Modes

Nine modes: 576p50, 480p60, 720p50, 720p60, 1080p50, 1080p60 and, at 60 Hz, 800 × 600, 1024 × 768 and 1280 × 1024. A request is one write of family * 6 + hdmi to the register 0x4F00 (family 0 = 50 Hz, 1 = 60 Hz); the status is read at 0x4F04. The request moves the timing generator, the clock synthesizer, the GTP and the pixel clock together. A low-rate mode keeps the TMDS clock in the allowed range by repeating TMDS bits, not pixels, so the signal is plain CEA (AVI pixel repetition 0) and a television accepts it.

  • The applications decide which modes are offered: the nine rows cut with what the screen names in its EDID. A new EDID (another screen, hot-plug) is read again and a running mode that is no longer offered is replaced once by the best fitting one.
  • The host holds a default mode; each core may set its own Picture. A changed mode asks "Keep this picture?" for 8 s and goes back when no key is pressed.
  • C64-type cores stay at 1080p.

Note: A build stops before opt_design when a constraint resolved to no object (host/trx_constraints.tcl).

5. Contract

The contract is the port list of the cell l2 in host/top.v. Version 2 has 247 ports. The lint stage compares every core with contract/layer2_ports.txt. The version is the first part of the host version, and the boot menu refuses a bundle for another version.

Group Ports
Clocks, resets cpu_clk, sys_clk, ui_clk, mclk and their resets. The host owns every clock generator.
Register window cw_*: address, data, read and write strobes, acknowledge, interrupt. One host timeout (section 6).
Device windows drv_io_*, gcr_io_*, dma_*, win_*: drive registers, GCR codec, DMA window, RAM windows.
DDR2 c_* and e_*: two command ports into the host arbiter. The host gates them while the core is decoupled. It does not check addresses.
Video pix_color, pix_x, pix_y, px_* (pixel-layer registers), vmode_sys.
Audio audio_l, audio_r, audio_sample_en; adc_* for the codec input.
Input c64_keys (64-bit key matrix), c64_joy1, c64_joy2.
Connectors SLOT_* (cartridge port), IEC_*, c2n_* (tape), paddle_*, sid_sock*.
Packet port pp_*: Ethernet packets to and from the core.
Identity, debug host_caps, dbg_*, trx_j_*.

Caution: A change of the port list is a host change. It raises the contract version, and every .cor must be built again.

6. Decoupler and timeouts

  • The signal core_decouple is the JTAG bit OR the request of the application. It idles every channel: DDR2 requests are masked, the cartridge and IEC pins go to their idle levels, toggles are re-aligned at release.
  • A read or write to the drive, GCR, cw, DMA or ROM window is answered with 0 at once while the core is decoupled.
  • While the core is not decoupled, the host answers with 0 after 65,536 clocks when the core does not acknowledge.
  • The registers of a core in pb_l2 start at their initial value after a partial load (RESET_AFTER_RECONFIG). Block RAM starts empty.

Register windows seen by the application

Window Address (local) Use
drive 0x020000-0x023FFF 1541 drive registers
core window 0x04C000-0x04CFFF, 0x1A0000-0x1AFFFF, 0x048000-0x0480FF core pages, cartridge EEPROM, sampler bytes
DMA 0x050000-0x05FFFF machine RAM and I/O through the DMA window
GCR 0x060500-0x0605FF GCR codec
ICAP 0x060600-0x0606FF ICAP loader (host)
ROM 0x188000-0x18FFFF BASIC, KERNAL and character ROM seeding

The application reaches a window at 0x10000000 plus the local address.

7. Applications

7.1 Host application

The host application runs from the flash. It owns the boot menu, the file browser, the Ethernet stack with FTP (port 21) and a web page (port 80), and the start of cores and full firmwares. It does not change when a core changes. It is described in Framework.

The boot menu lists only the entries that were added by hand; the application does not search the media. Adding an entry is the full check (SHA-256). A start reads the directory entry (size, modification time) and the package header. R checks the selected entry again.

Note: On the board (2026-10-26) this start check stood for 11 s at "Checking the cores in the menu". The check leaves the start: the menu comes up from boot.cfg alone, no entry is opened before it is shown, and the icon and the state of each entry are read afterwards, one entry at a time. A core still verifies the SHA-256 of every part while it loads, so a changed or missing file is refused at its start with the reason. This is on main.

7.2 Core application

One program serves every core built here, partial and large. The ID block of the loaded core selects the descriptor. A bundle for another core is refused.

  • The menu is a route of areas: F1 Home, F3 Library, F5 machine, F7 Actions, F8 System. An area without entries is not shown.
  • An open menu is a freeze: the machine stops, and it continues unchanged when the menu closes.
  • A descriptor names ROMs, settings, media slots and tasks. Each action is an operation called by name through one registry and one executor.
  • ROMs are searched in <root>/roms/<folder> on the roots /flash, /usb0 to /usb3, /sd. A core with several machine variants starts when one complete set is found.
  • Libraries are files <root>/trx/lib/<name>.u2a. They load at core start in dependency order. A library whose required capability the core does not have is refused. The Commodore key held while the core starts, or a boot-attempt counter after a failed start, skips all libraries.
  • The Picture, Scale and Smoothing items are added to every frame-buffer core. Picture sets the HDMI mode (the list comes from the screen's EDID), Scale chooses Integer, Fit or Fill. Master volume: SHIFT+ and SHIFT- in the menu, the gain sits in the host. The case LED 1 can show drive activity (T159).

7.3 Application of a full firmware

A .cfw carries its own application (menus, file manager, REST, cartridge and drive handling). The host stages it in DDR2 and hands over to it. It is not built from the cores of this repository.

8. Cores

Source: cores/*/core.toml. Every core has contract 2. Experimental means: the core is not yet in a release set. The pipeline builds and reports it like any other core, and its failure turns the run red. The C64U and TRX64 sources are not listed: the C64 comes as full firmware or as the large trx64u.cor and trx64g.cor of TRX64-Ultimate. Cores lists every core with its kind and state.

ID Name Kind Version Application Picture path ROM names (from the user)
c64ref C64 Reference build only 1.0.0 none palette raster none (never shipped)
null Null core (flash filler) build only 1.0.0 none none none
vc20 VIC-20 partial 0.9.0 generic frame buffer vic20 kernal, vic20 basic, vic20 characters
atari800 Atari 800 XL partial 0.0.1 generic frame buffer atarixl.rom
apple2 Apple IIe partial 0.1.0 generic frame buffer apple2e.rom, apple2e-video.rom, diskii.rom
ddt_mandel DDT Mandelbrot partial 0.1.0 generic frame buffer none
ddt_novic DDT Look Ma, No VIC partial 0.1.0 generic frame buffer none
amiga Amiga (OCS/ECS, 68000) large 0.2.0 generic frame buffer Kickstart 1.3
amiga1200 Amiga 1200 (AGA, 68020) large 0.3.0 generic frame buffer Kickstart 3.1
c128 Commodore 128 large 0.1.0 generic frame buffer boot0.rom (72 KiB system ROM)
c264 Commodore 264 (C16, Plus/4) large 0.1.0 generic frame buffer c16 kernal, c16 basic, plus4 3plus1
cpc Amstrad CPC 464 / 664 / 6128 large 0.0.1 generic frame buffer cpc os, basic and amsdos for 464, 664, 6128
zx ZX Spectrum 48K / 128K large 0.0.1 generic frame buffer zx 48.rom, zx 128.rom
zxnext ZX Spectrum Next large 0.0.1 generic frame buffer none; boot ROM in the core, system files on the user's SD image
nes Nintendo Entertainment System large 0.0.1 generic frame buffer none (cartridge image)
snes Super Nintendo large 0.0.1 generic frame buffer none (cartridge image)
neogeo SNK Neo Geo large 0.0.1 generic frame buffer sp-s2.sp1, uni-bios.rom, 000-lo.lo, sfix.sfix

Note: ROMs, Kickstart and disk images are never part of a core bundle or a release. The user puts them on the medium.

9. Status, 2026-11-02

Three words are used. Main: the work is on the main branch. Branch: built or specified on a feature branch that is not merged. Board: seen working on the board. Cores has the state of every core.

Item State Where
Host package 2 (T164) HDMI modes and scaler in the host, TMDS bit repetition, volume, case lamp, port clock, flash lock, NTP time, fail-fast constraint check, a compact menu layout below 960 px (D10a), a mode change that asks for 8 s. Merged into main (run 1139 green). The mode question ("Keep this picture?") was not on the screen after a canvas change on the board; fixed on main, render bench checks the line. Host and c64ref route (run 1122: 12,802 LUT, WNS +0.138 ns). Floorplan has the floorplan. Main; board 2026-11-02
Board session 2026-11-02 (package t164-c83a83c2) Host and Amiga 1200: OK. Update and restore pages in the new look and the start bar over the whole start: OK. USB pads in NES, SNES and Neo Geo: OK. SNES sound: correct. Amstrad CPC: CAT works, a game starts with sound. Floppy LED: only the Amiga 1200 lit it; the other cores had no settings row. Since then every core with a drive has the row LED Load Indicator (Amiga 500, Atari 800 XL, Apple IIe, Amstrad CPC, VIC-20, C16/Plus-4, Commodore 128), not seen on the board again. Commodore 128: black picture; cause found and fixed on main: the DDR2 side of the core lost the first sweep request that came in the DDR2 reset, so the VIC never started (retest open). ZX Spectrum 48K: black picture; cause found (the ULA's blanking lost in Vivado's synthesis, T119 5.15), fix on a branch, not merged. The board issue of the ZX Spectrum Next stopped older images at issue 5; Auto (read from the image's TBBLUE.FW) is merged (T116 D11), board test open. Board
Board session 2026-11-01 Host update through a .txu: OK. 1080p: OK. Partial cores VIC-20, Atari 800 XL, Apple IIe, DDT cores: run. C16/Plus-4 and Amiga 500: run. NES and SNES: run. The core menu was cut at the right edge at 800 x 600 (fixed by the compact layout, board test open). Board
Large cores on host copies Ten large cores, each with its own copy of the host files; console builds without Ethernet and VIC path. Amiga 500, NES, CPC, C16/Plus-4 and ZX Spectrum became large cores with this package. Main
Not on the board yet Floppy LED in every drive core (T159); Port Diagnostics core (T175, merged into main, experimental: gateware and core application are built and pass their benches; Vivado run and board steps open); the menu snapshot in the compact modes (deferred, T164 D10b); a real pad's HID report dump (T156). Main, branch
Tester release t164-c83a83c2 (GitHub, 2026-11-02) Pre-release with the host installer (.cfw and .ue2), 16 cores (14 machines plus trx64u.cor and trx64g.cor), INSTALL.md, ROMS.txt and SHA256SUMS. The Commodore 128 is withheld (black picture). The first installer carried the wrong bitstream (host plus the build-only reference core instead of the host with the null core), so the host menu stayed black on testers' boards; the installer was rebuilt the same day and the assets replaced. tools/check_release_flash.py now compares the installer's bitstream and application byte for byte with the update file that was tested on the board, and fails on purpose in a control run. GitHub; board: install seen working
Recovery boot (T177) Specified and decided, not built: RESTORE held, then F1, at power-on starts recovery.cor from the SD card or stick, else the installer's backup. It never writes the flash and starts the image without flash protection; the case LED shows a pattern, so no picture is needed. Spec (2026-11-02)
Core menu picture (T176) The menus of the core applications on the screen at once from a saved picture (as the host menu has since T146). Split out of T146, deferred, not started. Spec, deferred
Versioning (T172) The file VERSION holds the SemVer, 0.2.0. The build shows 0.2.0+<sha8> on main and <branch>@<sha8> on a branch; a tag v<VERSION> shows <VERSION>. The package step stamps the string into the host application. SemVer binds from 1.0.0; Conventional Commits start with outside pull requests. Main
Board installer on demand (T172) A bundle step builds the installer of any branch on request. Releases are made by hand on GitHub. Main
One folder per core .cor, .cfg and roms/ side by side; the ROM search starts in the core's own folder. Partial and large cores. Main; board steps open
Format a medium as exFAT The File Browser (F3) formats a stick or SD card as exFAT, for images above 4 GiB. Host benches green. Main; board steps open
A folder as an Amiga hard disk The application builds the block device from a folder, for both Amiga cores, with FS-UAE names and .uaem files. Host benches green. Main; board steps open
REST, WebSocket JSON-RPC One registry of operations; the menu, REST and JSON-RPC call the same operation. No authentication: the door is for the home network. Main
Application API description and SDK Planned, for outside developers. Foreign applications load. Nothing written. Plan