Select S1
Toggle 0 / 1
Select S0
Toggle 0 / 1
| S1 | S0 | Selected Y | Cin | Operation |
|---|---|---|---|---|
| 0 | 0 | B | 0 | Addition (A + B) |
| 0 | 1 | B̅ | 1 | Subtraction (A + B̅ + 1) |
| 1 | 0 | 0000 | 1 | Increment (A + 1) |
| 1 | 1 | 1111 | 0 | Decrement (A - 1) |
A [A3:A0]
5 (0101)
A3 (MSB)
A2
A1
A0 (LSB)
B [B3:B0]
3 (0011)
B3 (MSB)
B2
B1
B0 (LSB)
Active operand B
CARRY (C)
0
OVERFLOW (V)
0
ZERO (Z)
0
SIGN (S)
1
| Stage | A | Y | Cin | P (A⊕Y) | G (A·Y) | Sum | Cout |
|---|---|---|---|---|---|---|---|
| FA0 (LSB) | 1 | 1 | 0 | 0 | 1 | 0 | 1 |
| FA1 | 0 | 1 | 1 | 1 | 0 | 0 | 1 |
| FA2 | 1 | 0 | 1 | 1 | 0 | 0 | 1 |
| FA3 (MSB) | 0 | 0 | 1 | 0 | 0 | 1 | 0 |
Total = A + Y + Cin = 5 + 3 + 0 = 8 | S[3:0] = 8 (Cout = 0)
Loading circuit calculations...
Verification Suite (1,024 Automated Test Cases)
100% PASSED (1,024 / 1,024 TESTS)
Exhaustive verification across all 16 values of A × 16 values of B for Addition, Subtraction, Increment, and Decrement.
Modular Python Implementation Architecture
Repository Reference Code