A computer is, at its core, just a bunch of transistors wired together. Once you have enough transistors on a board, though, one of the first layers of abstraction that arises is the Arithmetic Logic Unit. The ALU takes in two sets of data, performs a chosen math function, and outputs one data set as the result. It really is the core of what makes computers compute.
An ALU is built into modern processors, but that wasn’t always how it was done. If you’re looking to build a recreation of an early computer you may need a standalone, and that’s why [roelh] designed an ALU that fits in a square inch piece of circuit board using five multiplexer chips and two XOR chips.
One of the commonly used components for this purpose, the 74LS181 ALU, is not in production anymore. [roelh’s] ALU is intended to be a small footprint replacement of sorts, and can perform seven functions: ADD, SUB, XOR, XNOR, AND, OR, A, B, and NOT A. The small footprint for the design is a constraint of our recent contest: Return of the Square Inch Project. Of course, this meant extra design challenges, such as needing to move the carry in and carry out lines to a separate header because there wasn’t enough space on one edge.
Exploring the theory behind an ALU isn’t just for people building retrocomputers. It is integral to gaining an intuitive understanding of how all computers work. Everyone should consider looking under the hood by walking through the nand2tetris course which uses simulation to build from a NAND gate all the way up to a functioning computer based on The Elements of Computing Science textbook.
If you’re a homebrew computer builder, it might be worthwhile to use one of these ALUs rather than designing your own. Of course, if building components from scratch is your thing we definitely understand that motivation as well.