Challenge - 5 Problems
Verilog Module Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateOutput of a simple module instantiation
What is the output of this Verilog testbench when simulating the module
and_gate?Verilog
module and_gate(input a, input b, output y); assign y = a & b; endmodule module test; reg a, b; wire y; and_gate uut(.a(a), .b(b), .y(y)); initial begin a = 1'b0; b = 1'b0; #10; $display("Output: %b", y); a = 1'b1; b = 1'b0; #10; $display("Output: %b", y); a = 1'b1; b = 1'b1; #10; $display("Output: %b", y); end endmodule
Attempts:
2 left
💡 Hint
Remember that AND gate output is 1 only when both inputs are 1.
✗ Incorrect
The AND gate outputs 1 only when both inputs are 1. For inputs (0,0) and (1,0), output is 0. For (1,1), output is 1.
🧠 Conceptual
intermediateUnderstanding module ports and connections
Which statement correctly describes the role of ports in a Verilog module?
Attempts:
2 left
💡 Hint
Think about how modules connect to each other.
✗ Incorrect
Ports are the input and output points of a module, allowing it to communicate with other modules or testbenches.
🔧 Debug
advancedIdentify the error in module instantiation
What error will occur when compiling this Verilog code?
Verilog
module inverter(input a, output y); assign y = ~a; endmodule module test; reg a; wire y; inverter uut(a, y); initial begin a = 1'b0; #5; $display("Inverted: %b", y); end endmodule
Attempts:
2 left
💡 Hint
Check if positional port connections are allowed.
✗ Incorrect
Positional port connections without names are allowed if the order matches the module definition. 'reg' and 'wire' types are correctly used here.
❓ Predict Output
advancedOutput of nested module instantiation
What is the output of this Verilog testbench?
Verilog
module or_gate(input a, input b, output y); assign y = a | b; endmodule module top_module(input x, input z, output out); wire w; or_gate u1(.a(x), .b(z), .y(w)); or_gate u2(.a(w), .b(z), .y(out)); endmodule module test; reg x, z; wire out; top_module uut(.x(x), .z(z), .out(out)); initial begin x = 1'b0; z = 1'b0; #5 $display("Output: %b", out); x = 1'b1; z = 1'b0; #5 $display("Output: %b", out); x = 1'b0; z = 1'b1; #5 $display("Output: %b", out); x = 1'b1; z = 1'b1; #5 $display("Output: %b", out); end endmodule
Attempts:
2 left
💡 Hint
Remember OR gate outputs 1 if any input is 1.
✗ Incorrect
The first OR gate outputs 1 if x or z is 1. The second OR gate outputs 1 if w or z is 1. The outputs correspond to the OR logic applied twice.
🧠 Conceptual
expertRole of modules in hierarchical design
Which statement best describes the role of modules in Verilog hierarchical design?
Attempts:
2 left
💡 Hint
Think about how big circuits are built from smaller parts.
✗ Incorrect
Modules are the basic building blocks that can be combined and reused to create complex hardware designs with clear interfaces.
