Challenge - 5 Problems
Verilog Gate Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateOutput of a simple combinational logic module
What is the output of this Verilog module when inputs A=1 and B=0?
Verilog
module simple_and(input A, input B, output Y); assign Y = A & B; endmodule
Attempts:
2 left
💡 Hint
AND gate outputs 1 only if both inputs are 1.
✗ Incorrect
The module implements an AND gate. Since A=1 and B=0, output Y = 1 & 0 = 0.
🧠 Conceptual
intermediateMapping Verilog always block to gates
Which physical gate does this Verilog always block represent?
Verilog
always @(*) begin Y = ~(A | B); end
Attempts:
2 left
💡 Hint
The output is the negation of the OR of inputs.
✗ Incorrect
The expression Y = ~(A | B) is the definition of a NOR gate.
🔧 Debug
advancedIdentify the error in gate-level mapping
What error will occur when synthesizing this Verilog code?
Verilog
module error_module(input A, input B, output Y); assign Y = A & B | ; endmodule
Attempts:
2 left
💡 Hint
Check the assign statement for completeness.
✗ Incorrect
The assign statement ends with an operator '|' without a right operand, causing a syntax error.
❓ Predict Output
advancedOutput of a D flip-flop module
What is the output Q after the rising edge of clk if D=1 and initial Q=0?
Verilog
module dff(input clk, input D, output reg Q); always @(posedge clk) begin Q <= D; end endmodule
Attempts:
2 left
💡 Hint
D flip-flop captures input D on rising clock edge.
✗ Incorrect
On the rising edge of clk, Q takes the value of D, which is 1.
🧠 Conceptual
expertPhysical gate count from Verilog code
How many 2-input NAND gates are needed to implement this Verilog expression in CMOS?
Verilog
assign Y = ~(A & B);
Attempts:
2 left
💡 Hint
A NAND gate outputs the negation of AND inputs.
✗ Incorrect
The expression Y = ~(A & B) is exactly a NAND gate, so only one 2-input NAND gate is needed.
