Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare a module named half_adder.
Verilog
module [1](input a, input b, output sum, output carry);Attempts:
3 left
💡 Hint
Common Mistakes
Using full_adder instead of half_adder
Using generic names like adder or sum_carry
✗ Incorrect
The module name for a half adder is half_adder.
2fill in blank
mediumComplete the code to assign the sum output as XOR of inputs a and b.
Verilog
assign sum = a [1] b;Attempts:
3 left
💡 Hint
Common Mistakes
Using AND (&) instead of XOR
Using OR (|) instead of XOR
✗ Incorrect
The sum in a half adder is the XOR (^) of inputs a and b.
3fill in blank
hardFix the error in the carry assignment for the half adder.
Verilog
assign carry = a [1] b;Attempts:
3 left
💡 Hint
Common Mistakes
Using OR (|) instead of AND
Using XOR (^) instead of AND
✗ Incorrect
The carry output in a half adder is the AND (&) of inputs a and b.
4fill in blank
hardFill both blanks to complete the full adder sum and carry assignments.
Verilog
assign sum = a [1] b [2] cin; assign carry = (a & b) | (b & cin) | (a & cin);
Attempts:
3 left
💡 Hint
Common Mistakes
Using AND or OR operators for sum
Using plus (+) operator which is not bitwise XOR
✗ Incorrect
The sum in a full adder is the XOR of inputs a, b, and cin.
5fill in blank
hardFill all three blanks to complete the full adder module port list and internal wire declaration.
Verilog
module full_adder(input [1], input [2], input [3], output sum, output carry); wire w1, w2, w3;
Attempts:
3 left
💡 Hint
Common Mistakes
Using output names as inputs
Using carry out (cout) as input
✗ Incorrect
The full adder inputs are a, b, and cin (carry in).
