A project log for The 74LS181 ALU

Taming the 74LS181 ALU chip

agp.cooperagp.cooper 08/13/2016 at 10:020 Comments


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:

  1. A ADD B
  2. A ADD !B (i.e. A MINUS B MINUS 1)
  3. OR
  4. AND
  5. XOR
  6. B
  7. !B
  8. A

The result was:

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:

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.