Challenge - 5 Problems
Adder Design Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateOutput of Half Adder Module
What is the output of the following half adder module when inputs A=1 and B=0?
Verilog
module half_adder(input A, input B, output Sum, output Carry); assign Sum = A ^ B; assign Carry = A & B; endmodule // Inputs: A=1, B=0 // What are Sum and Carry?
Attempts:
2 left
💡 Hint
Recall that Sum is XOR of inputs and Carry is AND of inputs.
✗ Incorrect
The half adder sums two bits. Sum is A XOR B, Carry is A AND B. For A=1 and B=0, XOR is 1 and AND is 0.
❓ Predict Output
intermediateFull Adder Output for Inputs
Given the full adder module below, what is the output Sum and Carry when A=1, B=1, Cin=1?
Verilog
module full_adder(input A, input B, input Cin, output Sum, output Cout); assign Sum = A ^ B ^ Cin; assign Cout = (A & B) | (B & Cin) | (A & Cin); endmodule // Inputs: A=1, B=1, Cin=1 // What are Sum and Cout?
Attempts:
2 left
💡 Hint
Sum is XOR of all three inputs; Carry out is majority function.
✗ Incorrect
Sum = 1 ^ 1 ^ 1 = 1 ^ 1 = 0 ^ 1 = 1. Carry out is 1 because at least two inputs are 1.
🔧 Debug
advancedIdentify the Error in Full Adder Code
What error will this full adder Verilog code produce when compiled?
Verilog
module full_adder(input A, input B, input Cin, output Sum, output Cout); assign Sum = A ^ B ^ Cin; assign Cout = (A & B) | (B & Cin) | (A & Cin); endmodule
Attempts:
2 left
💡 Hint
Check each line for proper syntax punctuation.
✗ Incorrect
The line assigning Sum is missing a semicolon at the end, causing a syntax error.
🧠 Conceptual
advancedCarry Output Logic in Full Adder
Which expression correctly represents the carry output (Cout) of a full adder?
Attempts:
2 left
💡 Hint
Carry out is true if at least two inputs are 1.
✗ Incorrect
Cout is the majority function of inputs: it is 1 if any two or more inputs are 1, which is expressed by (A & B) | (B & Cin) | (A & Cin).
🚀 Application
expertNumber of Bits in Ripple Carry Adder Output
You design a 4-bit ripple carry adder by connecting four full adders. If inputs A and B are 4-bit numbers and Cin is 0, how many bits does the output sum have?
Attempts:
2 left
💡 Hint
Consider the carry out from the last full adder.
✗ Incorrect
The sum output is 4 bits, but the carry out from the last full adder adds an extra bit, making the total output 5 bits.
