> Snapshot of projects/fog-crypto-core/design/SDD.md — 28 Nov 2026

# Fog-Crypto Core — System and Software Design Description (SDD, IEEE 1016)

> Project instance of `process/templates/sdd-ieee1016.md` — CMMI-DEV v2.0, Level 3.
> This document realizes the Technical Solution (TS) practice area and closes the hardware,
> software, and security findings of `requirements/Audit  Fog-Crypto Core.docx` and engineering
> reviews #1–#4. Requirements are traced in `requirements/RTM.md`; the HW/SW boundary contract is
> `design/ICD.md`. Revision 1.4.

## 1. System overview and strategic alignment

Fog-Crypto Core is a PL/PS accelerator for an embedded-Linux IoT gateway (Zynq UltraScale+ MPSoC,
baseline **ZU3EG**). Its role is data integrity and confidentiality **at the source**:
authenticated encryption at line rate and sensor signal pre-processing on the FPGA fabric,
offloading the Cortex-A53 by ≥ 2× in the MVP (÷ 10 in Phase 2).

Strategic KPIs (targets in `requirements/REQ.md`): host CPU ÷ 2 (PERF-001), 100 MbE line-rate
encryption (PERF-002), bounded latency on both crypto and sensor paths (PERF-003).

> **MVP vs Phase 2 (Rev 2.0)**: this SDD describes the **MVP (Phase 1) baseline** (100 MbE, ÷ 2,
> ≥ 150 MHz, unmasked AES-256-GCM, BBRAM key, CAVP, simple VFIO). The Phase 2 hardening backlog
> (1 GbE, ÷ 10, DPA/FIPS, CSU PUF + AES-256-KW + RTL TZ filter, PMD/batching, SFVC784, 250 MHz) is
> in `REQ.md` §2.1 and is not required for the MVP.

## 2. IEEE 1016 definitions

- **PL / PS** — Programmable Logic / Processing System (Cortex-A53, PetaLinux).
- **Data plane / Control plane** — packet fast path (100 % C) vs slow path (< 100 Hz, Python).
- **SG-DMA** — Scatter-Gather DMA (descriptor rings, coherent, split AxCACHE).
- **CSU / BBRAM / eFUSE / PUF / KEK** — Zynq security primitives for black-key storage + key wrapping.
- **RTL TrustZone filter** — dedicated PL slave-side IP enforcing `AxPROT[1] == 1'b0` (not PG293).
- **ICD** — Interface Control Document (`design/ICD.md`).
- **CDC / XDC** — Clock Domain Crossing / timing constraints.
- **Nonce/IV** — 96-bit AES-GCM IV = `32b session salt ‖ 64b HW monotonic counter`.
- **PL_PS_IRQ0/IRQ1** — ZynqMP PL-to-PS interrupt lines (sensor / crypto).

Stakeholders: Helveticore OÜ engineering, the gateway integrator, and the security reviewer
(IEC 62443 / FIPS 140-3 alignment).

## 3. Architectural viewpoints

### 3.1 Hardware/software partitioning

High-rate packet and sensor streams execute strictly in PL hardware or core-pinned compiled C
(SW-001). Python (SW-002) is isolated to slow-path supervision, telemetry, ARP resolution via
lockless IPC, and threshold configuration.

| Concern | PL (hardware) | PS (software) |
| --- | --- | --- |
| AES-256-GCM | enclave + GHASH + nonce counter | key provisioning via CSU/KEK only |
| DSP (CIC, moving avg) | filter pipeline + threshold alert | threshold configuration |
| Data movement | SG-DMA + Status/Submission rings | VFIO driver + C data plane |
| Network L2/PHY | PL MAC (PAUSE, tx_er) | MDIO via netlink/VFIO; ARP via IPC |

### 3.2 PS/PL boundary and AXI topology

SG-DMA is routed through the coherent **S_AXI_HPCx_FPD** ports (CCI-400 + SMMU/IOMMU). `S_AXI_HPC`
is **ACE-Lite "I/O coherent — no L2 allocation"** (UG1085), so no `AxCACHE` value makes it allocate
new L2 lines; the descriptor rings are therefore either **OCM-resident (256 KB via SMMU)** or read
in **batches of B ≥ 8** with `prfm pldl1keep` / `dc zva` (bounded `L2D_CACHE_REFILL` ≤ 0.25/packet).
Bulk payload writes use `AxCACHE = 4'b1010` (Write-Through, Read-Allocate only — no
Write-Allocate). Plus `AxUSER[0] = 1'b1`, `AxPROT = 3'b010` (hard-wired on the SG-DMA master), and
Device-Tree `dma-coherent`. The full register/descriptor/IV/IRQ contract is `design/ICD.md`.

### 3.3 Data paths and line-rate model

- **Sensor path** (DSP): FMC LPC ADC → HP-bank 1.8 V capture (`IDELAYE3`/`ISERDESE3`) → CIC /
  moving-average → pre/post-trigger sample FIFO → dedicated **`PL_PS_IRQ0`** (≤ 2 µs) + AXI-Lite
  status/telemetry.
- **Crypto path**: Ethernet **100 MbE** ingress (PS GEM via coherent DMA **or** dual-port PL MAC) →
  AES-256-GCM enclave → coherent SG-DMA → PL MAC (hardware 802.3x PAUSE + `tx_er` fail-safe
  poisoning) → egress. Reference line = 100 MbE (≥ 0.149 Mpps @ 64 B; ≥ 97.5 Mbps L2 goodput @
  1518 B); 1 GbE is Phase 2.

### 3.4 Security architecture and key management

- Root of trust: ZynqMP **CSU hardware PUF** (XAPP1333) + `RSA_EN`/`ENC_ONLY` eFUSEs decrypt a
  **per-board Black Key Blob** at boot (TF-A EL3) — never a constant KEK shared across the fleet.
- Session keys are wrapped with **AES-256-KW (NIST SP 800-38F)**, travel **KEK-wrapped** over a
  TrustZone Secure-World APB channel, and are unwrapped **only inside the PL enclave** (never clear
  on AXI/APB). The key aperture is isolated on **`M_AXI_HPM0_LPD`** and fronted by a **dedicated RTL
  AXI4-Lite TrustZone filter** (`s_axi_awprot[1]==0` / `s_axi_arprot[1]==0`, else `SLVERR` +
  `WSTRB=0`) — **not** the Xilinx AXI Protocol Firewall (PG293, an anti-hang IP that does not filter
  `AxPROT`). Tamper → flip-flop zeroization.
- **96-bit IV** = `Session_Epoch_Salt[31:0] ‖ HW_Monotonic_Counter[63:0]` (NIST SP 800-38D);
  eFUSEs never written at runtime; session-key rotation on warm reboot / partial reconfig.
- **Fail-safe + Store-and-Forward**: decryption holds plaintext in a BRAM FIFO until `tag_ok`, and
  purges it silently on tag failure (NIST SP 800-38D §5.2.2); on truncation / parity-KAT fault /
  tag mismatch → halt output, zeroize state, `ERR_CRYPTO_FAULT`, and `tx_er` FCS poisoning.

### 3.5 Signal integrity and clocking

- **CDC**: async FIFOs + 2-FF synchronizers; scoped XDC with `set_bus_skew` on Gray pointers.
- **FMC LPC**: VADJ = 1.8 V; package **XCZU3EG-SFVC784** (3 HP banks = 156 HP pins); high-speed ADC
  LVDS lines wired **exclusively to HP banks** (native `IDELAYE3`/`ISERDESE3`) with **no
  level-shifters on native 1.8 V LVDS pairs**; only 2.5/3.3 V CMOS inputs use SN74AXC/AVC shifters;
  **HD banks restricted to slow GPIOs ≤ 10 MHz**. ZU3EG has **0 GTH transceivers**, so the PL MAC is
  RGMII (1.8 V) or SGMII-over-LVDS on an HP bank (decision D-13).
- **SWaP/timing**: ≤ 70 % on ZU3EG (≤ 49 392 LUTs / ≤ 252 DSP / ≤ 151 BRAM); WNS ≥ 0 ns @ **≥ 150 MHz**
  (250 MHz is Phase 2); gated by the OOC synthesis of the crypto core (the ≤ 15 000 LUT masked-enclave
  budget is Phase 2).

## 4. Modular decomposition

### 4.1 PL — crypto enclave (AES-256-GCM + GHASH + firewall)

Right-sized masked AES-256 (iterative / 2-round-per-cycle, **≥ 1 block / 16 cycles** ≈ 2 Gbps) +
**single 4-stage pipelined GF(2¹²⁸) GHASH** using **H⁴ across interleaved blocks** (or 4-cycle
iterative reduction). 2-share DOM masking with **≥ 256 bits/cycle fresh entropy** + LFSR clock
jitter; **masked GHASH subkey H = H0 ⊕ H1**; `(* DONT_TOUCH = "yes" *)` + post-synthesis TCL check
against share merging; 96-bit IV (`salt ‖ counter`); store-and-forward `tag_ok` gate; `tx_er`
fail-safe; **RTL AXI4-Lite TrustZone filter** (not PG293) on the key path. Traces to
`src/crypto-engines/`.

### 4.2 PL — DSP pre-processing (CIC + threshold alert)

CIC / moving-average pipeline on the FMC LPC ADC stream, fixed-point; threshold crossing asserts
`PL_PS_IRQ0` (≤ 2 µs) and freezes a pre/post-trigger sample window in BRAM, readable via AXI-Lite.
Traces to `src/crypto-engines/` (DSP).

### 4.3 PL — SG-DMA engine + descriptor rings

Scatter-Gather DMA with **split Status (HW-write-only) / Submission (SW-write-only) rings**, 64-byte
cache-line aligned, **OCM-resident or batched (B ≥ 8) with prefetch** (HPC does not allocate L2),
interrupt coalescing (N descriptors / T µs) on the crypto path + NAPI-style polling. Traces to
`src/rtl/`.

### 4.4 PS — kernel driver (VFIO)

`vfio-platform` + `libvfio` across all PL apertures; IOMMU groups; **no UIO, no `/dev/mem`**.
Traces to `src/host-integration/`.

### 4.5 PS — data-plane middleware (C)

Isolated (`isolcpus`, `nohz_full`, `rcu_nocbs`), core-pinned, `SCHED_FIFO`; drives SG-DMA + PL MAC
via VFIO; PMD uses `ldar`/`stlr` with **zero syscalls**; the **doorbell MMIO is amortized over
B ∈ [8, 32] descriptor batches**; the **EtherType is carried in the Status Ring** (no DDR4 payload
read to classify control vs data); the `vfio-platform` device provides a **`vfio_reset_handler`**
kernel module; punt of ARP (`0x0806`) / LLDP (`0x88CC`) via a lockless POSIX shared-memory ring.
Traces to `src/host-integration/`.

### 4.6 PS — control plane (Python / control daemon)

Supervision, telemetry, key-rotation trigger, DSP threshold config, `PL_PS_IRQ0` alert handling,
and PHY MDIO (kernel `mdio_bus`/`netlink` or shared VFIO aperture — never `/dev/uio`); ARP
processed via the lockless IPC ring; **IEEE 802.3x PAUSE handled 100 % in the PL MAC hardware**.
Traces to `src/host-integration/` (control).

## 5. Resilience and local loop

The sensor path is a local fast loop (PL filter + threshold detect + `PL_PS_IRQ0`, no CPU/cloud
dependency). The crypto path is fail-safe (fault → halt + zeroize + `tx_er` poisoning). Key material
survives power cycles in the CSU/BBRAM; eFUSEs are never written at runtime.

## 6. Decision log (DAR)

Structuring decisions are recorded in `design/decision-log.md` (D-1 … D-15): reference line, target
FPGA, AES sizing, key management + firewall, DMA caching, driver model, data-plane language, build,
memory model, nonce construction, 64-byte polling, FMC bank routing, network fail-safe, L2/PHY
split, and DSP sensor alert path.

## 7. Document control and traceability

- **Verification**: UVM + SVA + coverage ≥ 95 % + fault injection (VV-001), golden-model
  co-simulation (VV-002), HIL benchmark with PMU counters (VV-003).
- **Traceability**: bidirectional matrix in `requirements/RTM.md`.
- **Interface contract**: `design/ICD.md`.
- **Measurement**: KPI evidence archived in `performance/`.
- **Revision history & approvals**: tracked in Git; changes to frozen acceptance criteria are DAR
  decisions.
