A 4-bit ALU with a carry output: opcode 00 AND, 01 OR, 10 XOR, 11 ADD. cout is the carry out of the addition and must be 0 for the logic operations.
Inputs: a and b, 4 bits; op, 2 bits.
Outputs: y, 4 bits; cout.
The testbench applies all 1024 combinations and checks both outputs.
Contributed by Indicore