← Back to documentation
Snapshot of projects/fog-crypto-core/design/ICD.md — 28 Nov 2026

Fog-Crypto Core — Interface Control Document (ICD)

Interface contract frozen before RTL implementation (REQ-FOG-IF-006). This document is the single authoritative HW/SW boundary contract referenced by both the RTL (src/rtl/, src/crypto-engines/) and the C data-plane driver (src/host-integration/). Revision 1.4 — incorporates engineering reviews #1–#4.

1. Scope and status

The ICD fixes every hardware/software boundary of the accelerator:

  1. Crypto path — AES-256-GCM enclave, coherent SG-DMA, PL MAC, descriptor rings.
  2. Sensor path — FMC LPC ADC, DSP CIC / moving-average, threshold alert, pre/post-trigger FIFO.

Status: Approved for RTL implementation. Any change to a frozen field is a DAR decision.

2. Register map

2.1 Crypto SG-DMA / enclave control (AXI-Lite slave, base 0xA001_0000)

OffsetRegisterWidthAccessDescription
0x00CTRL32RWEnable, mode (encrypt/decrypt), soft reset
0x04STATUS32ROFault flags (ERR_CRYPTO_FAULT, KAT fail, tag mismatch)
0x08KEY_LOAD32W-onlyKey-load trigger (never holds key material)
0x0CIV_HI / IV_LO32 ×2W-only96-bit IV shadow (salt ‖ counter)
0x14COAL_N32RWInterrupt coalescing: IRQ after N descriptors
0x18COAL_T32RWInterrupt coalescing: IRQ timeout (µs)
0x1CRING_BASE64RWStatus/Submission ring base address
0x24RING_TAIL32RWSubmission ring tail pointer (SW → HW)
0x28RING_HEAD32ROStatus ring head pointer (HW → SW)

2.2 DSP CIC / threshold (AXI-Lite slave, base 0xA002_0000)

OffsetRegisterWidthAccessDescription
0x00DSP_CTRL32RWCIC stages, decimation ratio, moving-average window
0x04THRESH_LO32RWLower threshold (fixed-point)
0x08THRESH_HI32RWUpper threshold (fixed-point)
0x0CALERT_STATUS32ROThreshold-crossing latched flags + timestamp
0x10TRIG_DEPTH32RWPre/post-trigger sample window depth
0x14TRIG_FIFO32×NROFrozen pre/post-trigger sample window

3. Descriptor format (Status Ring / Submission Ring)

  • Alignment: every descriptor is 64-byte cache-line aligned (Cortex-A53) — prevents false sharing on the ownership flag.
  • Split ownership: Status Ring is HW-write-only; Submission Ring is SW-write-only — no bidirectional writes on the same 64-byte line.
  • Submission descriptor (SW → HW): {addr_lo, addr_hi, len, iv_tag, flags, next}.
  • Status descriptor (HW → SW): {owner, status, len, tag_result, err_code}.
  • Ownership semantics: the SW↔HW flip uses ARMv8 Inner-Shareable acquire/release — ldar when polling Status Ring ownership, stlr (or dmb ishst) when publishing the Submission tail pointer. Stalling dmb osh is not used.

4. Coherence attributes (HPC = ACE-Lite "no L2 allocation")

S_AXI_HPCx_FPD is ACE-Lite "I/O coherent — no L2 allocation" (UG1085): no AxCACHE value makes it allocate new L2 lines. Therefore:

ResourcePolicy
Descriptor ringsOCM-resident (256 KB via SMMU) or batched reads B ≥ 8 with prfm pldl1keep / dc zva → L2D_CACHE_REFILL ≤ 0.25/packet
Bulk payload writesAxCACHE = 4'b1010 (Write-Through, Read-Allocate only — no Write-Allocate)

AxUSER[0] = 1'b1, AxPROT = 3'b010 (hard-wired on the SG-DMA master), Device-Tree dma-coherent.

5. Interrupt model

  • PL_PS_IRQ0 — Sensor path: dedicated, non-coalesced threshold-crossing alert, level triggered, cleared by writing 1 to ALERT_STATUS; latency ≤ 2 µs (PL assertion) / ≤ 50 µs (userspace handler).
  • PL_PS_IRQ1 — Crypto path: coalesced (IRQ after COAL_N descriptors or COAL_T µs), with NAPI-style transition to busy-polling PMD at 64-byte saturation.

6. IV / nonce contract (AES-GCM, 96-bit)

IV[95:0] = Session_Epoch_Salt[31:0] || HW_Monotonic_Counter[63:0] — the full 96-bit GCM IV (NIST SP 800-38D), with J0 = IV ∥ 0x00000001. The 64-bit monotonic counter lives in the PL; the 32-bit salt is rotated per session. On every warm reboot / partial reconfiguration / counter wrap-warning, a new session key + new salt is mandatory (eFUSEs are never written at runtime). The source is fixed here (decision D-10).

7. Data format

  • Bus width: 128-bit crypto datapath, 64-bit AXI data, 32-bit register access.
  • DSP fixed-point: signed Q15.16 (CIC/moving-average), documented per register.
  • Endianness: little-endian; AES-GCM block order and GHASH X_i/Y_i per NIST SP 800-38D.

8. IDELAYE3 / ISERDESE3 capture calibration

High-speed ADC clock/data lines are routed exclusively to 1.8 V HP banks (native IDELAYE3/ISERDESE3) on package XCZU3EG-SFVC784 (156 HP pins). Per-lane calibration: sweep IDELAYE3 taps, detect the data-eye edges, and center the sampling point; the tap values are stored in DSP_CTRL and re-applied on boot. HD banks (no IDELAYE3/ISERDESE3) are restricted to slow GPIOs ≤ 10 MHz.

9. Fail-safe (fault containment) & TrustZone filter

Store-and-Forward decryption: plaintext is held in a BRAM FIFO until the GCM tag verifies (tag_ok == 1'b1); on tag_ok == 0 it is silently purged — no unverified plaintext reaches the LAN (NIST SP 800-38D §5.2.2). On ingress truncation, internal parity/KAT fault, or tag mismatch, the enclave halts output, zeroizes state, sets ERR_CRYPTO_FAULT, and asserts tx_er (egress path).

TrustZone filter: the enclave key aperture (isolated on M_AXI_HPM0_LPD) is fronted by a dedicated RTL AXI4-Lite TrustZone filter — s_axi_awprot[1]==0 / s_axi_arprot[1]==0, otherwise SLVERR + WSTRB = 0. This is not the Xilinx AXI Protocol Firewall (PG293), which is an anti-hang IP and does not filter AxPROT (REQ-FOG-SEC-001).

10. Traceability

This ICD realizes REQ-FOG-IF-006 and is referenced by REQ-FOG-IF-001/002/003/004/005, REQ-FOG-SEC-005, REQ-FOG-FUNC-002/003, REQ-FOG-HW-001. Bidirectional matrix: requirements/RTM.md.

Source: raw markdown — published as-is from the source repository.