The full adder in one table
A reminder from Module 2. The full adder adds three bits, a, b and a carry-in cin, producing a sum and a carry-out cout. Its truth table:
| a | b | cin | cout | sum |
|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 1 |
| 0 | 1 | 0 | 0 | 1 |
| 0 | 1 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 | 1 |
| 1 | 0 | 1 | 1 | 0 |
| 1 | 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 1 |
Read cout and sum together and they are the count of how many inputs are 1.
Confirm it in the circuit
Toggle a, b and cin. The two lamps read as cout sum, the 2-bit count of how many inputs are high. Check a few rows against the table.
Sum and carry-out
sum is 1 whenever an odd number of inputs are 1. Chained XOR captures exactly that, and it is written for you in the exercise:
assign sum = a ^ b ^ cin;
cout is 1 whenever at least two of the three inputs are 1. Look at the table: that happens when a and b are both 1, or when cin arrives together with a single 1 coming out of a ^ b. Turning those two cases into a Boolean equation is your job.
Build a full adder
From the truth table, write the carry-out. The sum assignment is done for you; add the cout assignment in design.v.
Use &, | and ^. cout is high when a and b are both 1, or when cin and a ^ b are both 1. The testbench checks all eight input combinations and passes when it prints VULKOS_RESULT: PASS.