Arithmetic Logic Unit (ALU)
Build a 4-bit ALU that performs arithmetic and logic operations—the computational heart of every CPU.
Overview
The ALU is the CPU's calculator—it performs all arithmetic (add, subtract) and logic (AND, OR, XOR) operations. The classic 74LS181 4-bit ALU can perform 16 different arithmetic and 16 different logic operations selected by 4 function bits. Understanding the ALU is key to understanding how computers compute.
Components Needed
- 1x SN74LS181 IC (4-bit ALU)
- 8x LED
- 12x Switch
- severalx Wires
Instructions
Study the 74LS181 Pinout
The 74LS181 has two 4-bit inputs (A, B), 4-bit output (F), function select (S0-S3), mode (M), carry in/out, and comparison outputs. Review the function table.
Wire Power and Inputs
Connect VCC and GND. Wire 8 switches to A and B inputs (4 each). Connect 4 switches to S0-S3 and one to M.
Connect Outputs and Flags
Wire 4 LEDs to the F output. Add LEDs for carry out, A=B comparison, and other status signals.
Test Arithmetic Mode
Set M=0 for arithmetic. Try addition (S=1001): enter two numbers, verify the sum. Try subtraction and other arithmetic functions.
Test Logic Mode
Set M=1 for logic. Try AND, OR, XOR, NOT operations. Verify bitwise behavior on your test patterns.
Challenges
- Cascade two 74LS181s for 8-bit operations
- Build a simple calculator that displays results
- Implement condition flags (zero, negative, carry, overflow)
- Create an accumulator register that feeds back into one ALU input