The ALU (Arithmetic Logic Unit) is arguably is a heart of any CPU, which is doing the operations on the bits and bytes of data.

Here I am making an Arithmetic half of it, the circuit which, in my case, is going to do additions and subtractions on 8-bit binary numbers.

For it I am using only NAND gates, which are the smallest DTL gates I can make from discrete components -- and these already 7 parts per gate.

Lets start to build up this unit.

Here is the classical schematic for a full adder:

Here no NAND gate in sight. But theoretically, one can make any other gate from NANDs, so this should not discourage us. We can substitute XORs by groups of 4 NAND gates:

And we can also easily substitute AND-OR combination with NAND-NAND, and logical function will stay the same:

And now, one can see that highlighted pairs of NAND gates are doing exactly the same work, and we can safely eliminate two of them without compromising the whole circuit:

For the unit to do subtractions, we need a way to conditionally invert the B input - and this can be done with just one other XOR gate, which in this case will also be 4 NAND gates instead:

After stacking 8 of these units, and making conditional inverting on Carry in +adding C_in enable we are having a full-fledged 8-bit ripple adder-subtractor. If we are also using output from the middle XOR group (right before C_in input), we than have a "free" XOR/XNOR functionality.

On the completion of this stacking we are getting this:

This configuration of gates is almost exactly the same as on the actual board.

Implementing this the way I do, the board looks like this:

On the photo is a complete board during testing. The only additional parts are L7805 voltage regulator with a pair of caps on the lower right, near alligators.

Pin headers are used as convenient connection points; this was done for connecting with some other boards in the future, most prominently, with control panel, which will be described in the next log.

Here is parts count for this board:

Part name | count |
---|---|

Perfboard 78*36 holes | 1 |

2N2222A npn transistor | 110 |

1N4148 diode | 218 |

Resistor 10k | 110 |

Resistor 20k | 109 |

Resistor 47k | 109 |

Red LED (clear) | 109 |

L7805 Voltage regulator | 1 |

Capacitor 0.1uF | 1 |

Capacitor 0.33uF | 1 |

Pin headers x8 | 4 |

Pin headers x4 | 1 |

Power connector | 1 |

Total parts | 775 |

## Discussions

## Become a Hackaday.io Member

Create an account to leave a comment. Already have an account? Log In.