Simple ALU (2-bit opcode)

A 4-bit ALU with four operations selected by a 2-bit opcode: 00 add, 01 subtract, 10 AND, 11 OR. Results wrap to 4 bits (no carry output).

Inputs: a and b, 4 bits; op, 2 bits.
Output: y, 4 bits.

The testbench applies all 1024 combinations.

Contributed by Indicore

Compiler Output
Waveform Viewer