Draft preview. Lessons are being written and reviewed.

Verilog practice / Problem 6

EasyArithmetic

4-bit adder with carry

Add the 4-bit numbers a and b and the carry in cin. The low 4 bits of the result go to sum and the fifth bit goes to cout. For example, 9 + 8 + 0 = 17, so sum = 1 and cout = 1.

Ports

NameDirectionBits
ainput4
binput4
cininput1
sumoutput4
coutoutput1

How it's checked

The test tries the input combinations and checks every output for each one.

Stuck? Read the lesson Half, full and ripple adders.

add4.vCtrl + Enter runs