Sunday, September 9, 2012

4-bit ALU - Demonstration, Schematics

I'm happy to say I've successfully built a 4-bit version of my ALU. It computes all 18 functions detailed in the truth table from "The Elements of Computing Systems" and outputs them on a 7-segment LED display and 2 single LED's; the number that results from the ALU's computation appears on the 7-segment LED, and the 2 single LED's indicate whether that number is 0 and/or negative.

All and all, the ALU was actually less time consuming that I had feared. It still took an annoyingly long time, but I had a bunch of free time the past 2 days and really wanted to get it done. I had a nice setup with Chappelle's show and Star Trek TNG alternating on my computer that made it a lot easier. Below are the schematics detailing which gate is where on the breadboard and which switch does what. I also numbered the wires according to the variable names for the connections in the hdl code I posted earlier. I was not in the mood to write down all those wires on this schematic, and saw no point as the connections were detailed in the hdl code, so I didn't.

Since I intend to use a different display unit (some sort of lcd screen) later in the project, I didn't add any circuitry so that negative numbers would be properly displayed on the 7-seg; I used 2's compliment to represent negative numbers, so any number displayed larger than 7 actually represents a negative number. Therefore the range of the outputs is from [0]-[15] rather than [-8]-[7]. This means that the 7-seg has to output 2 digit numbers, though it only has room for 1 digit, so for any number greater than 9 it uses special characters.

I also forgot to demonstrate the function x-y; whoops. You'll have to trust me; it works. It took about an hour for me to edit the video and upload it and I'm not planning on doing it again.

Thanks to those of you who gave me advice on reddit, a special thanks to IX for his continued contribution to the blog. Next stop, 16-bit version/CPU!


  1. I just finished reading that book myself! It really is fantastic. I was working toward an ALU like yours, but apparently you were more efficient with parts ;)

  2. **oh and really,
    Congrats. Incredible work!

    1. Awesome, thanks! Hope your project goes well too.