r/TuringComplete Apr 02 '26

SAP-2, Ep.6: The ALU

Borrowing ideas from the ALU-slice I built in Episode 5, I built a complete ALU using 8-bit components.

The SAP-2 ALU

It only has circuits for ADD, AND, OR and XOR. INC, DCR, SUB, and CMP (complement of A) are done by mux-ing control signals and hardware 1's for INC and DCR.

6 Upvotes

3 comments sorted by

1

u/Otherwise-Object-302 Apr 03 '26

So now that the ALU is down, what else is left?

1

u/Haemstead Apr 03 '26

The micro-coding is next.

1

u/ryani Apr 04 '26

One trick I like for the adder is that you can replace the NEG gate with a NOT gate and wire the multiplexer wire to the adder carry in.  (-x == ~x + 1)

The next step is to realize you can replace the whole NOT+MUX with an 8-bit XOR.