DIY ALU II
I had a play with Logic Friday investigating a DIY ALU that matched the 8 functions selected for the 4 Bit CPU II.
For reference the 74181 has 100 NAND gate equivalents (by my count).
I coded a 1 bit ALU for:
In(A), In(B), In(Carry), In(A>B), In(A<B), S0, S1, S2 -> Out(C), Out(Carry), Out(A>B), Out(A<B
Where for S0-2:
- A ADD B
- A ADD !B (i.e. A MINUS B MINUS 1)
The result was:
- 29 "prime implicants" (i.e. boolean equations)
That translates to 37 NAND gates (with as many inputs as necessary).
(The 37 equates to 8 inputs, 4 outputs and 29 prime implicants or PIs.)
Therefore scaling up my ALU would result in 148 gates. Not unexpected as my ALU has no useless functions.
Some experimentation (functions and function order) may reduce the PIs a little.
Logic Friday also can produce a rationalise schematic based on standard packages, suggesting:
- 2x Hex Inverter
- 8x Quad 2-Input NAND
- 4x Triple 3-Input NAND
- 1x Dual 4-Input NAND
So I will need 60 packages for my 4 bit DIY ALU! Perhaps I should just "close my eyes" and get to like the 74181!
Or I could just copy the 74181 design and add my "pre-selector code" for 106 NAND gates (about 30 packages).
No real headache using four 256x4 PROMs or a small PLA chip.