# silicap/chipathon-2026 architecture

> Architecture diagram of the GitHub repository silicap/chipathon-2026, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/silicap/chipathon-2026
- Repository: https://github.com/silicap/chipathon-2026

## Overview

This repository implements an ML-KEM-oriented NTT chip, plus a host harness for exercising it on a Tiny Tapeout board, an FPGA rig, or a software chip. The principal workflow streams coefficient and operation words through the harness to the chip, which performs NTT, inverse NTT, base multiplication, or scaling and returns sampled output bytes. The README documents the chip and its harness; RTL inter-module wiring is not shown in the supplied excerpts, so those relationships are marked unverified rather than asserted as calls.

Main entry points: [`src/ntt_core.v`](https://github.com/silicap/chipathon-2026/blob/main/src/ntt_core.v) (NTT core), [`rp2350/rp/main.c`](https://github.com/silicap/chipathon-2026/blob/main/rp2350/rp/main.c) (RP2350 firmware), [`rp2350/core/ntt_chip.c`](https://github.com/silicap/chipathon-2026/blob/main/rp2350/core/ntt_chip.c) (Chip job harness), [`rp2350/core/app.c`](https://github.com/silicap/chipathon-2026/blob/main/rp2350/core/app.c) (Test and demo apps)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_rtl_io["Chip interface"]
  node_chip_top["NTT chip top<br/>[tt_um_NTT_Core.v]"]
  node_input_capture["Input capture<br/>[io_in_capture.v]"]
  node_output_pack["Output packing<br/>[io_out_pack.v]"]
end

subgraph group_rtl_control["Chip control"]
  node_controller["NTT control<br/>[ntt_ctrl.v]"]
  node_scheduler["NTT scheduler<br/>[ntt_sched.v]"]
  node_delay["Pipeline delays<br/>[ntt_delay.v]"]
end

subgraph group_rtl_math["NTT datapath"]
  node_core["NTT core<br/>[ntt_core.v]"]
  node_multiplier["Modular multiplier<br/>[modq_mul.v]"]
  node_addsub["Modular add/sub<br/>[modq_addsub.v]"]
  node_accumulator["Modular accumulator<br/>[modq_acc.v]"]
  node_twiddle["Twiddle factors<br/>[ntt_twiddle.v]"]
  node_zeta_rom[("Zeta ROM<br/>[zeta_rom.v]")]
end

subgraph group_host["Host harness"]
  node_rp_firmware["RP2350 firmware<br/>[main.c]"]
  node_demo_apps["Test and demo apps<br/>[app.c]"]
  node_chip_harness["Chip job harness<br/>[ntt_chip.c]"]
  node_rp_transport["PIO DMA transport<br/>[tt_rp.c]"]
  node_software_chip["Software chip<br/>[swchip.c]"]
  node_reference["NTT reference model<br/>[ntt_ref.c]"]
  node_operation_log[("Operation timing log<br/>[oplog.c]")]
  node_pc_runner["PC harness<br/>[pc_main.c]"]
end

node_host_actor(("Host operator"))

node_host_actor -->|"sends commands"| node_rp_firmware
node_rp_firmware -->|"dispatches tests"| node_demo_apps
node_demo_apps -->|"runs chip jobs"| node_chip_harness
node_rp_firmware -->|"selects transport"| node_rp_transport
node_rp_firmware -->|"initializes fallback"| node_software_chip
node_chip_harness -.->|"streams pin words"| node_rp_transport
node_chip_harness -.->|"streams pin words"| node_software_chip
node_pc_runner -->|"dispatches tests"| node_demo_apps
node_demo_apps -.->|"checks results"| node_reference
node_chip_harness -.->|"records timing"| node_operation_log
node_chip_top -.->|"receives inputs"| node_input_capture
node_chip_top -.->|"controls operations"| node_controller
node_controller -.->|"schedules work"| node_scheduler
node_scheduler -.->|"sequences transforms"| node_core
node_core -.->|"uses arithmetic"| node_multiplier
node_core -.->|"uses arithmetic"| node_addsub
node_core -.->|"accumulates results"| node_accumulator
node_core -.->|"applies factors"| node_twiddle
node_twiddle -.->|"reads constants"| node_zeta_rom
node_core -.->|"aligns pipeline"| node_delay
node_output_pack -.->|"returns outputs"| node_chip_top

click node_chip_top "https://github.com/silicap/chipathon-2026/blob/main/src/tt_um_NTT_Core.v"
click node_input_capture "https://github.com/silicap/chipathon-2026/blob/main/src/io_in_capture.v"
click node_output_pack "https://github.com/silicap/chipathon-2026/blob/main/src/io_out_pack.v"
click node_controller "https://github.com/silicap/chipathon-2026/blob/main/src/ntt_ctrl.v"
click node_scheduler "https://github.com/silicap/chipathon-2026/blob/main/src/ntt_sched.v"
click node_delay "https://github.com/silicap/chipathon-2026/blob/main/src/ntt_delay.v"
click node_core "https://github.com/silicap/chipathon-2026/blob/main/src/ntt_core.v"
click node_multiplier "https://github.com/silicap/chipathon-2026/blob/main/src/modq_mul.v"
click node_addsub "https://github.com/silicap/chipathon-2026/blob/main/src/modq_addsub.v"
click node_accumulator "https://github.com/silicap/chipathon-2026/blob/main/src/modq_acc.v"
click node_twiddle "https://github.com/silicap/chipathon-2026/blob/main/src/ntt_twiddle.v"
click node_zeta_rom "https://github.com/silicap/chipathon-2026/blob/main/src/zeta_rom.v"
click node_rp_firmware "https://github.com/silicap/chipathon-2026/blob/main/rp2350/rp/main.c"
click node_demo_apps "https://github.com/silicap/chipathon-2026/blob/main/rp2350/core/app.c"
click node_chip_harness "https://github.com/silicap/chipathon-2026/blob/main/rp2350/core/ntt_chip.c"
click node_rp_transport "https://github.com/silicap/chipathon-2026/blob/main/rp2350/rp/tt_rp.c"
click node_software_chip "https://github.com/silicap/chipathon-2026/blob/main/rp2350/core/swchip.c"
click node_reference "https://github.com/silicap/chipathon-2026/blob/main/rp2350/core/ntt_ref.c"
click node_operation_log "https://github.com/silicap/chipathon-2026/blob/main/rp2350/core/oplog.c"
click node_pc_runner "https://github.com/silicap/chipathon-2026/blob/main/rp2350/pc/pc_main.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_chip_top,node_input_capture,node_output_pack toneBlue
class node_controller,node_scheduler,node_delay toneAmber
class node_core,node_multiplier,node_addsub,node_accumulator,node_twiddle,node_zeta_rom toneMint
class node_rp_firmware,node_demo_apps,node_chip_harness,node_rp_transport,node_software_chip,node_reference,node_operation_log,node_pc_runner toneRose
class node_host_actor toneIndigo
```

## Components

### Chip interface

- [NTT chip top](https://github.com/silicap/chipathon-2026/blob/main/src/tt_um_NTT_Core.v): `src/tt_um_NTT_Core.v`
- [Input capture](https://github.com/silicap/chipathon-2026/blob/main/src/io_in_capture.v): `src/io_in_capture.v`
- [Output packing](https://github.com/silicap/chipathon-2026/blob/main/src/io_out_pack.v): `src/io_out_pack.v`

### Chip control

- [NTT control](https://github.com/silicap/chipathon-2026/blob/main/src/ntt_ctrl.v): `src/ntt_ctrl.v`
- [NTT scheduler](https://github.com/silicap/chipathon-2026/blob/main/src/ntt_sched.v): `src/ntt_sched.v`
- [Pipeline delays](https://github.com/silicap/chipathon-2026/blob/main/src/ntt_delay.v): `src/ntt_delay.v`

### NTT datapath

- [NTT core](https://github.com/silicap/chipathon-2026/blob/main/src/ntt_core.v): `src/ntt_core.v`
- [Modular multiplier](https://github.com/silicap/chipathon-2026/blob/main/src/modq_mul.v): `src/modq_mul.v`
- [Modular add/sub](https://github.com/silicap/chipathon-2026/blob/main/src/modq_addsub.v): `src/modq_addsub.v`
- [Modular accumulator](https://github.com/silicap/chipathon-2026/blob/main/src/modq_acc.v): `src/modq_acc.v`
- [Twiddle factors](https://github.com/silicap/chipathon-2026/blob/main/src/ntt_twiddle.v): `src/ntt_twiddle.v`
- [Zeta ROM](https://github.com/silicap/chipathon-2026/blob/main/src/zeta_rom.v): `src/zeta_rom.v`

### Host harness

- [RP2350 firmware](https://github.com/silicap/chipathon-2026/blob/main/rp2350/rp/main.c): `rp2350/rp/main.c`
- [Test and demo apps](https://github.com/silicap/chipathon-2026/blob/main/rp2350/core/app.c): `rp2350/core/app.c`
- [Chip job harness](https://github.com/silicap/chipathon-2026/blob/main/rp2350/core/ntt_chip.c): `rp2350/core/ntt_chip.c`
- [PIO DMA transport](https://github.com/silicap/chipathon-2026/blob/main/rp2350/rp/tt_rp.c): `rp2350/rp/tt_rp.c`
- [Software chip](https://github.com/silicap/chipathon-2026/blob/main/rp2350/core/swchip.c): `rp2350/core/swchip.c`
- [NTT reference model](https://github.com/silicap/chipathon-2026/blob/main/rp2350/core/ntt_ref.c): `rp2350/core/ntt_ref.c`
- [Operation timing log](https://github.com/silicap/chipathon-2026/blob/main/rp2350/core/oplog.c): `rp2350/core/oplog.c`
- [PC harness](https://github.com/silicap/chipathon-2026/blob/main/rp2350/pc/pc_main.c): `rp2350/pc/pc_main.c`

### Other components

- **Host operator**

## Connections

- Host operator → RP2350 firmware: sends commands (evidence: `rp2350/rp/main.c`)
- RP2350 firmware → Test and demo apps: dispatches tests (evidence: `rp2350/rp/main.c`)
- Test and demo apps → Chip job harness: runs chip jobs (evidence: `rp2350/core/app.c`)
- RP2350 firmware → PIO DMA transport: selects transport (evidence: `rp2350/rp/main.c`)
- RP2350 firmware → Software chip: initializes fallback (evidence: `rp2350/rp/main.c`)
- Chip job harness → PIO DMA transport: streams pin words
- Chip job harness → Software chip: streams pin words
- PC harness → Test and demo apps: dispatches tests (evidence: `rp2350/pc/pc_main.c`)
- Test and demo apps → NTT reference model: checks results
- Chip job harness → Operation timing log: records timing
- NTT chip top → Input capture: receives inputs
- NTT chip top → NTT control: controls operations
- NTT control → NTT scheduler: schedules work
- NTT scheduler → NTT core: sequences transforms
- NTT core → Modular multiplier: uses arithmetic
- NTT core → Modular add/sub: uses arithmetic
- NTT core → Modular accumulator: accumulates results
- NTT core → Twiddle factors: applies factors
- Twiddle factors → Zeta ROM: reads constants
- NTT core → Pipeline delays: aligns pipeline
- Output packing → NTT chip top: returns outputs
