Draft preview. Lessons are being written and reviewed.

Verilog practice / Problem 15

MediumArithmetic

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

NameDirectionBits
ainput8
binput8
opinput2
youtput8
zerooutput1

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