
This project implements a 4-bit Arithmetic Logic Unit (ALU) using Verilog HDL for the Tiny Tapeout platform and SKY130 open-source semiconductor process.
The ALU is a combinational digital circuit that performs arithmetic, logical, and bit-shift operations on two 4-bit operands.
The ALU supports eight operations selected using a 3-bit opcode:
| Opcode | Operation | Description |
|---|---|---|
| 000 | ADD | A + B |
| 001 | SUB | A - B |
| 010 | AND | Bitwise AND |
| 011 | OR | Bitwise OR |
| 100 | XOR | Bitwise XOR |
| 101 | NOT | Bitwise NOT of A |
| 110 | SLL | Logical shift left |
| 111 | SRL | Logical shift right |
The design uses combinational logic to select and execute the requested operation. No clock or reset is required.
The Tiny Tapeout interface is mapped as follows:
The design is verified using Cocotb and Icarus Verilog.
The testbench checks all possible combinations of the two operands and eight operations:
16 × 16 × 8 = 2,048 test cases.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | A0 | Y0 | OP0 |
| 1 | A1 | Y1 | OP1 |
| 2 | A2 | Y2 | OP2 |
| 3 | A3 | Y3 | |
| 4 | B0 | CARRY | |
| 5 | B1 | ZERO | |
| 6 | B2 | OVERFLOW | |
| 7 | B3 | UNUSED |