# sxvirel/segel-ascon architecture

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

- Interactive diagram: https://gitdiagram.com/sxvirel/segel-ascon
- Repository: https://github.com/sxvirel/segel-ascon

## Overview

Segel Ascon is Tiny Tapeout hardware that adds a key-protected Ascon-AEAD128 authentication tag to a SHA-256 design while sharing its 320-bit register state. The principal flow is: a host provisions a key and challenge over the bus, selects Ascon mode and starts authentication, the RTL runs a fixed-round computation, and the host reads the tag. The diagram also preserves the legacy SHA mode and the reference-model/KAT validation capability. RTL internals are described at the level documented in the README; sampled source does not include the RTL implementation itself.

Main entry points: [`work/rtl/project.v`](https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/project.v) (Mode and control), [`work/ref/segel_model.py`](https://github.com/sxvirel/segel-ascon/blob/main/work/ref/segel_model.py) (Register-level model), [`work/rtl/ascon_round.v`](https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/ascon_round.v) (Ascon round), [`work/rtl/sha256_round.v`](https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/sha256_round.v) (SHA-256 round)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Chip interface"]
  node_top["Top-level chip<br/>[project.v]"]
  node_bus["Bus protocol<br/>[project.v]"]
  node_control["Mode and control<br/>[project.v]"]
  node_key["Write-only key<br/>[project.v]"]
  node_status_tag["Status and tag reads<br/>[project.v]"]
end

subgraph group_hardware["RTL datapath"]
  node_state["Shared state registers<br/>[project.v]"]
  node_ascon_fsm["Ascon MAC sequence<br/>[project.v]"]
  node_ascon_round["Ascon round<br/>[ascon_round.v]"]
  node_sha_round["SHA-256 round<br/>[sha256_round.v]"]
end

subgraph group_reference["Reference validation"]
  node_model["Register-level model<br/>[segel_model.py]"]
  node_pyascon["PyAscon implementation<br/>[ascon.py]"]
  node_kat["Ascon KAT vectors"]
end

node_host(("Bus host"))

node_host -->|"transfers bus bytes"| node_bus
node_bus -->|"drives chip interface"| node_top
node_top -->|"dispatches commands"| node_control
node_control -->|"loads or clears"| node_key
node_control -->|"starts MAC"| node_ascon_fsm
node_ascon_fsm -->|"updates shared state"| node_state
node_ascon_fsm -->|"runs one round"| node_ascon_round
node_control -->|"allows SHA rounds"| node_sha_round
node_bus -->|"writes challenge"| node_state
node_bus -->|"writes key bytes"| node_key
node_state -->|"supplies tag bytes"| node_status_tag
node_control -->|"reports status"| node_status_tag
node_status_tag -->|"returns tag and status"| node_host
node_model -->|"imports implementation"| node_pyascon
node_model -->|"loads test vectors"| node_kat

click node_top "https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/project.v"
click node_bus "https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/project.v"
click node_control "https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/project.v"
click node_key "https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/project.v"
click node_state "https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/project.v"
click node_ascon_fsm "https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/project.v"
click node_ascon_round "https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/ascon_round.v"
click node_sha_round "https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/sha256_round.v"
click node_status_tag "https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/project.v"
click node_model "https://github.com/sxvirel/segel-ascon/blob/main/work/ref/segel_model.py"
click node_pyascon "https://github.com/sxvirel/segel-ascon/blob/main/work/ref/pyascon/ascon.py"
click node_kat "https://github.com/sxvirel/segel-ascon/blob/main/work/ref/kat/LWC_AEAD_KAT_128_128.txt"

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_top,node_bus,node_control,node_key,node_status_tag toneBlue
class node_state,node_ascon_fsm,node_ascon_round,node_sha_round toneAmber
class node_model,node_pyascon,node_kat toneMint
class node_host toneIndigo
```

## Components

### Chip interface

- [Top-level chip](https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/project.v): `work/rtl/project.v`
- [Bus protocol](https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/project.v): `work/rtl/project.v`
- [Mode and control](https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/project.v): `work/rtl/project.v`
- [Write-only key](https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/project.v): `work/rtl/project.v`
- [Status and tag reads](https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/project.v): `work/rtl/project.v`

### RTL datapath

- [Shared state registers](https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/project.v): `work/rtl/project.v`
- [Ascon MAC sequence](https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/project.v): `work/rtl/project.v`
- [Ascon round](https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/ascon_round.v): `work/rtl/ascon_round.v`
- [SHA-256 round](https://github.com/sxvirel/segel-ascon/blob/main/work/rtl/sha256_round.v): `work/rtl/sha256_round.v`

### Reference validation

- [Register-level model](https://github.com/sxvirel/segel-ascon/blob/main/work/ref/segel_model.py): `work/ref/segel_model.py`
- [PyAscon implementation](https://github.com/sxvirel/segel-ascon/blob/main/work/ref/pyascon/ascon.py): `work/ref/pyascon/ascon.py`
- [Ascon KAT vectors](https://github.com/sxvirel/segel-ascon/blob/main/work/ref/kat/LWC_AEAD_KAT_128_128.txt): `work/ref/kat/LWC_AEAD_KAT_128_128.txt`

### Other components

- **Bus host**

## Connections

- Bus host → Bus protocol: transfers bus bytes (evidence: `README.md`)
- Bus protocol → Top-level chip: drives chip interface (evidence: `README.md`)
- Top-level chip → Mode and control: dispatches commands (evidence: `README.md`)
- Mode and control → Write-only key: loads or clears (evidence: `README.md`)
- Mode and control → Ascon MAC sequence: starts MAC (evidence: `README.md`)
- Ascon MAC sequence → Shared state registers: updates shared state (evidence: `README.md`)
- Ascon MAC sequence → Ascon round: runs one round (evidence: `README.md`)
- Mode and control → SHA-256 round: allows SHA rounds (evidence: `README.md`)
- Bus protocol → Shared state registers: writes challenge (evidence: `README.md`)
- Bus protocol → Write-only key: writes key bytes (evidence: `README.md`)
- Shared state registers → Status and tag reads: supplies tag bytes (evidence: `README.md`)
- Mode and control → Status and tag reads: reports status (evidence: `README.md`)
- Status and tag reads → Bus host: returns tag and status (evidence: `README.md`)
- Register-level model → PyAscon implementation: imports implementation (evidence: `work/ref/segel_model.py`)
- Register-level model → Ascon KAT vectors: loads test vectors (evidence: `work/ref/segel_model.py`)
