Skip to content

feat(clara-gap4): restraint_ctrl hard-wired (DARPA TA1.4 bounded rationality) - #60

Merged
gHashTag merged 7 commits into
mainfrom
feat/clara-gap4-restraint-ctrl
May 16, 2026
Merged

gHashTag merged 7 commits into
mainfrom
feat/clara-gap4-restraint-ctrl

Conversation

@gHashTag

Copy link
Copy Markdown
Collaborator

CLARA Gap-4 — restraint_ctrl hard-wired (DARPA TA1.4 bounded rationality)

Overview

Implements CLARA Gap-4 from CROWN47_DARPA_DRONE_ANALYSIS.md §3.4:

Hard-wired controller that forces K_UNKNOWN when phi_drift > 0.5%, step_count > 10, or receipt_failure.

t27 spec: gHashTag/t27/specs/ar/restraint.t27 (RestraintType::UNKNOWN_TO_FALSE, threshold 0.5)


Files Changed

File Change
src/restraint_ctrl.v New module — ~91 lines, pure Verilog-2005, R-SI-1 clean
test/restraint_ctrl_tb.v 4-scenario testbench — all 9 assertions PASS (iverilog)
src/tt_um_trinity_max_true.v Instantiate u_restraint, wire phi_dist, fsm_step_count, restraint_rcpt_ok; force_unknown → uio[4]
info.yaml Add restraint_ctrl.v to source_files; update uio[4] pinout

Module: restraint_ctrl

Inputs:
  phi_drift[15:0]   Q1.15 from phi_distance_oracle (already in GAMMA)
  step_count[3:0]   counted from host_in_valid && host_in_ready pulses
  receipt_ok        mesh_rcpt_valid | rcpt_valid_d from crc32_receipt path
  current_state[1:0] 00=IDLE 01=COMPUTE 10=EMIT

Outputs:
  force_unknown     1 when restraint trips
  halt_mac          mirrors force_unknown (not yet gated to MAC for safety)
  reason[2:0]       001=phi_drift  010=step_overflow  100=receipt_fail

Threshold math: 0.5% × 2^15 = 163.84 → 16'd164 (ceiling).
Sticky: once tripped, stays high until rst_n de-asserted.


Testbench Results (iverilog, Verilog-2005)

Scenario Expected Result
1 — Happy path (phi_drift=100, step=5, rcpt_ok=1) force_unknown=0, reason=000 ✅ PASS
2 — phi_drift trigger (165 > 164) force_unknown=1, reason=001 ✅ PASS
3 — step_count overflow (11 > 10) force_unknown=1, reason=010 ✅ PASS
4 — receipt failure (receipt_ok=0) force_unknown=1, reason=100 ✅ PASS
Sticky (input cleared, output holds) force_unknown=1 persists ✅ PASS
Reset clears sticky force_unknown=0 after rst_n ✅ PASS

9/9 assertions PASS.


DARPA CLARA TA1.4 Compliance

This module closes CROWN47 §3.4 Gap 4:

"If AI not confident, chip stays silent" — φ-drift bound checking as formal honesty proof.

CLARA invariant Implementation
restraint_preserves_true force_unknown=0 on clean inputs (Scenario 1)
restraint_transforms_unknown force_unknown=1, sticky on trigger
bounded_rationality MAX_STEPS=10 step_count > 10 trips restraint
receipt_integrity receipt_ok=0 trips restraint

Integration Strategy (first PR — observability only)

  • force_unknown → uio[4] for debug observability (readable by external logic analyzer)
  • halt_mac silenced to _unused — not yet gating MAC clock (too risky for first integration)
  • Subsequent PR will gate MAC after CI confirms synthesis green

R-SI-1 Verification

  • restraint_ctrl.v: zero arithmetic * operators (only always @(*) sensitivity list — compliant)
  • tt_um_trinity_max_true.v: no new * added

Cell Budget Estimate

~100 cells: 3 comparators (16-bit, 4-bit, 1-bit) + 3 sticky FFs + 1 step counter FF + combinational OR = ~8 FFs + ~92 logic cells. GAMMA 5×4 current utilization ~60% → ~0.2% additional.


Anchor

φ² + φ⁻² = 3 · DOI 10.5281/zenodo.19227877


DO NOT MERGE until CI (gds + precheck + gl_test + viewer) all green.

gHashTag added 4 commits May 16, 2026 18:19
CLARA Gap-4 restraint controller. Forces K_UNKNOWN when:
- phi_drift > 164 (0.5% in Q1.15, threshold from CROWN47 §3.4)
- step_count > 10 (CLARA bounded rationality MAX_STEPS=10)
- receipt_ok == 0 (receipt/packet integrity failure)

Sticky until rst_n. reason[2:0] one-hot encodes which condition tripped.
R-SI-1 clean (only  is sensitivity list ).
~91 lines pure Verilog-2005.

t27 spec: gHashTag/t27/specs/ar/restraint.t27
DARPA CLARA TA1.4 bounded rationality.
DOI: 10.5281/zenodo.19227877
Scenario 1: happy path (no trigger)
Scenario 2: phi_drift trigger (165 > 164)
Scenario 3: step_count overflow (11 > 10)
Scenario 4: receipt failure (receipt_ok=0)
All scenarios check force_unknown, halt_mac, reason bits, and sticky.
R-SI-1 clean. Verilog-2005. iverilog 9/9 PASS.
Instantiate restraint_ctrl (CLARA Gap-4) in top module:
- phi_drift <- phi_dist from phi_distance_oracle (already in GAMMA)
- step_count <- fsm_step_count (counts host_in_valid && host_in_ready pulses)
- receipt_ok <- mesh_rcpt_valid | rcpt_valid_d from crc32_receipt path
- force_unknown -> uio[4] (debug observability, does not gate MAC yet)

halt_mac and reason[2:0] routed to _unused for first safe integration.
R-SI-1 clean. Verilog-2005.
DOI: 10.5281/zenodo.19227877
…4] pinout

- Add restraint_ctrl.v to source_files list
- Update uio[4] pinout description: CLARA Gap-4 debug bit
Gap-4 CLARA restraint controller (force K_UNKNOWN on drift/overflow/receipt)
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:
#	info.yaml
#	src/tt_um_trinity_max_true.v
@gHashTag
gHashTag merged commit 6144fb0 into main May 16, 2026
6 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