Skip to content

chore(tri27): re-vendor tri27_encoding.zig -- the t27 spec closed T27A_CONSUMER_GAP (Refs gHashTag/t27#6507) - #1438

Merged
gHashTag merged 1 commit into
mainfrom
fix/tri27-encoding-regen
Oct 6, 2026
Merged

gHashTag merged 1 commit into
mainfrom
fix/tri27-encoding-regen

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Refs gHashTag/t27#6507

Owner approval, 2026-10-06, on gHashTag/t27#6507: "add the label yourself, do the work, do not ask about labels". Label owner-approved-foreign.

#1437 made src/tri27/emu/decoder.zig take the T736 field table from gHashTag/t27 specs/isa/ternary_encoding.t27. That spec carried a marker, T27A_CONSUMER_GAP, saying the emulator did not use the table yet. With #1437 merged, gHashTag/t27#6895 replaces it with T27A_CONSUMER, which names this decoder. The vendored copy here still carried the old marker, and it is now false.

What

  • src/tri27/emu/tri27_encoding.zig is the t27c gen output of the new spec, byte for byte.
  • src/tri27/emu/decoder.zig: only the two recorded sha256 values and the PR reference in the provenance comment change.

The generated file is not zig fmt clean, the same as on main. It stays byte-identical to t27c output rather than being reformatted by hand.

Tests

All runs use zig 0.15.2, the CI version.

Suite Passed
decoder 24/24
tri27_encoding 14/14
test_encoder_fuzz 31/31
test_comprehensive 66/66
executor 33/33
smoke_tests 37/37
encoder_simple 35/35
emit_verilog 2/2
emit_zig 2/2

gitleaks was run by hand on the commit: no leaks.

Work report

{
  "version": 1,
  "head_sha": "b3d7a4a8f0566107b2c4bcffc0d243ea72719901",
  "summary": "The vendored TRI-27 field table is regenerated from the t27 spec, which now records that this emulator decoder uses the t27a table, so the stale T27A_CONSUMER_GAP marker is gone.",
  "changes": [
    "src/tri27/emu/tri27_encoding.zig is the byte-for-byte t27c gen output of the new gHashTag/t27 specs/isa/ternary_encoding.t27; T27A_CONSUMER_GAP becomes T27A_CONSUMER and nothing else moves.",
    "src/tri27/emu/decoder.zig records the new spec and generated sha256 and points at gHashTag/t27#6895."
  ],
  "tests": [
    {
      "command": "zig test src/tri27/emu/decoder.zig",
      "result": "All 24 tests passed under zig 0.15.2",
      "status": "passed",
      "evidence": "local run on the PR head, zig 0.15.2 as in CI"
    },
    {
      "command": "zig test src/tri27/emu/tri27_encoding.zig",
      "result": "All 14 tests of the generated table passed",
      "status": "passed",
      "evidence": "local run on the PR head, zig 0.15.2 as in CI"
    },
    {
      "command": "zig test src/tri27/emu/test_encoder_fuzz.zig and test_comprehensive.zig",
      "result": "31 and 66 tests passed",
      "status": "passed",
      "evidence": "local run on the PR head, zig 0.15.2 as in CI"
    },
    {
      "command": "zig test executor, smoke_tests, encoder_simple, emit_verilog, emit_zig",
      "result": "33, 37, 35, 2 and 2 tests passed respectively",
      "status": "passed",
      "evidence": "local run on the PR head, zig 0.15.2 as in CI"
    },
    {
      "command": "gitleaks detect --log-opts=-1",
      "result": "one commit scanned, no leaks found",
      "status": "passed",
      "evidence": "run by hand on the PR head commit"
    }
  ],
  "limitations": [
    "The recorded spec sha256 is the spec as it stands on gHashTag/t27#6895; if that PR changes the spec before it merges, this file has to be regenerated again.",
    "The generated file is not zig fmt clean, as on main; it is kept byte-identical to t27c output instead of being reformatted by hand."
  ],
  "tags": [
    "tri27",
    "t27",
    "isa",
    "emulator"
  ],
  "blog": {
    "title": "A spec marker that retires itself once the emulator catches up",
    "summary": "The t27 encoding spec flagged that the Trinity emulator did not yet read the t27a field table. Once the decoder adopted it, the spec dropped the flag and the vendored code was regenerated to match.",
    "outline": [
      "The t27 spec for the TRI-27 instruction word carried a constant named T27A_CONSUMER_GAP, an honest note that the emulator still decoded five opcodes the old way.",
      "Trinity pull request 1437 moved the emulator decoder onto the code t27c generates from that spec, so the note described a problem that no longer existed.",
      "The spec now names the consumer instead, and this change regenerates the vendored Zig table so the copy in Trinity says the same thing as its source.",
      "Every TRI-27 emulator suite, from the decoder to the encoder fuzzer and the executor, still passes under zig 0.15.2 with the regenerated table."
    ]
  }
}

🤖 Generated with Claude Code

…A_CONSUMER_GAP (Refs gHashTag/t27#6507)

#1437 made decoder.zig take the T736 table from gHashTag/t27
specs/isa/ternary_encoding.t27. The spec's T27A_CONSUMER_GAP marker said
the emulator did not yet use that table. With #1437 merged, the spec says
T27A_CONSUMER instead (gHashTag/t27#6895), and the vendored copy here
still carried the old marker, which is now false.

- src/tri27/emu/tri27_encoding.zig: `t27c gen` output of the new spec,
  byte for byte (sha256 0979161d..., equal to gen_hash_zig of t27
  .trinity/seals/isa_Tri27Encoding.json on gHashTag/t27#6895). Only the
  marker constant changes; no field table entry moves.
- src/tri27/emu/decoder.zig: the recorded spec and generated sha256.

zig 0.15.2: decoder 24/24, tri27_encoding 14/14, test_encoder_fuzz 31/31,
test_comprehensive 66/66, executor 33/33, smoke_tests 37/37,
encoder_simple 35/35, emit_verilog 2/2, emit_zig 2/2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gHashTag gHashTag added the owner-approved-foreign Owner approved hand-written non-t27 code in this PR label Oct 6, 2026
@gHashTag
gHashTag enabled auto-merge (squash) October 6, 2026 14:42
@gHashTag gHashTag added the owner-approved-foreign Owner approved hand-written non-t27 code in this PR label Oct 6, 2026
@github-actions github-actions Bot added the status:in-progress 🔵 Agent working label Oct 6, 2026
@gHashTag
gHashTag merged commit d2a930a into main Oct 6, 2026
27 checks passed
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

X Brain Health Check

Score: 100.0/100
Status: 🟢 HEALTHY
Threshold: 80/100

X Brain is above merge threshold

@github-actions github-actions Bot added status:completed Done and removed status:in-progress 🔵 Agent working labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🧪 Brain Stress Test Results

Tests: 261/261 passed, 0 leaked
Status: 🟢 PASS
Gate: every test in zig build test-brain-stress passes and none leaks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

owner-approved-foreign Owner approved hand-written non-t27 code in this PR status:completed Done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant