Views
No views yet
A[3:0] ──┐
B[3:0] ──┼──► CSA ──┬──► S[3:0] (sum)
C[3:0] ──┘ └──► Cout[3:0] (carry)
Final result: A + B + C = S + (Cout << 1)S[i] = A[i] XOR B[i] XOR C[i]
Cout[i] = MAJ(A[i], B[i], C[i])| A | B | C | S | Cout |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 |
| Component | Count | Neurons |
|---|---|---|
| XOR3 (sum) | 4 | 28 |
| MAJ3 (carry) | 4 | 4 |
1from safetensors.torch import load_file
2
3w = load_file('model.safetensors')
4
5# Example: 15 + 15 + 15 = 45
6# S = 13 (1101), Cout = 7 (0111)
7# Result = 13 + (7 << 1) = 13 + 14 = 27... wait
8# Actually: S + 2*Cout = 13 + 14 = 27, but need final adder
9# CSA output needs one final ripple-carry addthreshold-carrysave-adder/
├── model.safetensors
├── create_safetensors.py
├── config.json
└── README.md