Verilog practice / Problem 15
Small 8-bit ALU
op chooses the operation: 0 is a + b, 1 is a − b, 2 is a AND b, 3 is a OR b. Keep only the low 8 bits of the result in y, so 3 − 5 gives 254. zero is 1 when y is 0.
Ports
| Name | Direction | Bits |
|---|---|---|
a | input | 8 |
b | input | 8 |
op | input | 2 |
y | output | 8 |
zero | output | 1 |
How it's checked
The test tries the input combinations and checks every output for each one.
Stuck? Read the lesson Subtractors, comparators and an ALU.
alu8.vCtrl + Enter runs