Skip to content

feat(clara-gap5): DARPA CLARA TA1.2 — 5-tuple proof-trace emitter (explainability_unit) - #62

Merged
gHashTag merged 4 commits into
mainfrom
feat/clara-gap5-explainability
May 16, 2026
Merged

gHashTag merged 4 commits into
mainfrom
feat/clara-gap5-explainability

Conversation

@gHashTag

Copy link
Copy Markdown
Collaborator

CLARA Gap-5 — Explanation Generation (DARPA TA1.2)

What this PR adds

src/explainability_unit.v — Pure Verilog-2005, R-SI-1 clean
5-tuple proof-trace emitter for DARPA CLARA TA1.2 (Explanation Generation).

Each inference step emits one 20-bit record:

{step_id[3:0], premise_id_a[3:0], premise_id_b[3:0], rule_id[3:0], conclusion[3:0]}

Buffer: 10 × 20-bit shift register (buf0 = newest, buf9 = oldest)
Counter: step_count[3:0]
Overflow: overflow=1 when push arrives at full (feeds restraint_ctrl Gap-4)
Serial output: trace_out[1:0] — 2 bits/cycle, MSB-first, 10-cycle frame

test/tb_explainability_unit.v — 12 scenarios, 26 assertions

Scenario Description Result
S01 Empty after reset PASS
S02 Push 1 step PASS
S03 Push 5 steps, head correct PASS
S04 Push 10 steps (full, no overflow) PASS
S05 Push 11th step → overflow=1 PASS
S06 Reset clears overflow PASS
S07 10 pushes, count maxes out PASS
S08 Serial trace matches head_record slices PASS
S09 step_id field correct PASS
S10 premise_id_a/b fields correct PASS
S11 rule_id/conclusion fields correct PASS
S12 Double overflow: sticky, count 10 PASS
PASS 26/12 — CLARA Gap-5 explainability_unit all green

Integration: src/tt_um_trinity_max_true.v

  • u_clara_expl instantiated (MAX_STEPS=10)
  • Inputs wired from mesh_rcpt_* signals (demo proof-trace source)
  • trace_out[1:0] → uio[7:6] (serial 2-bit/cycle)
  • overflow wire preserved for future restraint_ctrl Gap-4 hook

Constraints met

  • R-SI-1: zero * arithmetic operators in new RTL
  • Pure Verilog-2005: no SystemVerilog, no multi-var logic blocks
  • Cell budget: ~180 cells ≈ 0.37% of GAMMA's ~48 000 cell budget
  • MAX_STEPS = 10: matches t27/specs/ar/explainability.t27 MAX_EXPLANATION_STEPS
  • Coq anchor: proofs/clara_max_steps.v invariant reference

t27 anchor

gHashTag/t27:specs/ar/explainability.t27 — const MAX_EXPLANATION_STEPS: int = 10

DOI

10.5281/zenodo.19227877 — φ²+φ⁻²=3

Implements explainability_unit.v per Gap-5 spec:
- 5-tuple record: {step_id[3:0], premise_id_a[3:0], premise_id_b[3:0],
  rule_id[3:0], conclusion[3:0]} = 20-bit per step
- MAX_STEPS=10 hard limit; 10×20-bit shift register (buf0..buf9)
- overflow=1 when 11th push arrives; feeds restraint_ctrl Gap-4 wire
- Serial 2-bit/cycle output on trace_out[1:0] (MSB first, 10-cycle frame)
- Pure Verilog-2005, R-SI-1 clean (no arithmetic * operators)
- ~180 cells, well within 0.4% of GAMMA's 48k cell budget

Testbench: test/tb_explainability_unit.v — 12 scenarios, 26 assertions
  PASS 26/12 — CLARA Gap-5 explainability_unit all green

Integration: tt_um_trinity_max_true.v
- u_clara_expl instantiated, inputs wired from mesh_rcpt_* signals
- trace_out[1:0] → uio[7:6] (serial 2-bit/cycle)
- overflow wire preserved for restraint_ctrl Gap-4

t27 anchor: specs/ar/explainability.t27  MAX_EXPLANATION_STEPS=10
Coq ref:    proofs/clara_max_steps.v (invariant anchor)
DOI:        10.5281/zenodo.19227877   φ²+φ⁻²=3
gHashTag and others added 3 commits May 17, 2026 03:56
- Fix sim/tb_canonical.v: Split 'reg stable = 1' into declaration + assignment
- Fix src/bitnet_encoder.v:
  - Replace indexed part-select x[2*i +: 2] with shift/mask approach
  - Remove size casts (10'(), 16'sd1)
  - Replace indexed part-select y_out[8*j +: 8] with case statement
  - Add newline at end of file

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix src/gf16_popcount.v: Replace a_row[2*k +: 2] with shift/mask
- Fix src/gf16_popcount16.v: Replace a_row[2*k +: 2] with shift/mask
- Fix src/blake3_anchor.v: Replace m_in[32*i +: 32] with shift/mask
- Fix src/vsa_matmul_8x8.v: Replace indexed part-select with intermediate wires and case statement
- Fix src/vsa_matmul_16x16.v: Replace indexed part-select with intermediate wires and case statement

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts:
#	src/tt_um_trinity_max_true.v
@gHashTag
gHashTag merged commit 955a702 into main May 16, 2026
7 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant