Repository navigation
feat(ternary): spec-first 2-bit ripple-carry adder — multi-bit arithmetic datapath - #1776
Merged
Merged
Conversation
specs/ternary/ternary_ripple_adder.t27: add2(a0,a1,b0,b1) -- a 2-bit
ripple-carry adder = two full adders (each XOR + majority) with the carry
threaded between them, over trit-embedded bits {0->N,1->P}. Output packs
sum0[1:0]+sum1[3:2]+carry-out[5:4]. Extends the stack from a single full adder
into a multi-bit arithmetic datapath.
Verified: typecheck 0 err; icarus-simulate 5/5; seal MATCH; new
tests/ternary_ripple_adder.rs exhaustively drives all 2^4=16 input pairs vs
binary addition = ALL_PASS 16. No compiler change.
Closes #1774
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
specs/ternary/ternary_ripple_adder.t27,add2(a0,a1,b0,b1): a 2-bit ripple-carry adder = two full adders (each = XOR + majority) with the carry threaded between them, over trit-embedded binary bits {0→N, 1→P}. Output packs sum0 in bits[1:0], sum1 in [3:2], carry-out in [5:4].Closes #1774
Extends the spec-first stack from a single full adder into a multi-bit arithmetic datapath — the shape of a real ALU, built entirely from the ternary neural primitives.
Verification
typecheck0 err;icarus-simulate5/5 test blocks;seal3 backends MATCH.tests/ternary_ripple_adder.rsexhaustively drives all 2^4 = 16 input pairs vs binary addition =ALL_PASS 16.Related: filed #1773 (no cross-module imports → each spec re-defines the primitives).
🤖 Generated with Claude Code