Challenge - 5 Problems
Verilog Port Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateWhat is the output of this Verilog module port declaration?
Consider the following Verilog module declaration. What is the direction of port data?
Verilog
module example_module(clk, data, reset); input clk; output [7:0] data; input reset; endmodule
Attempts:
2 left
💡 Hint
Look at the keyword before the port name in the declaration.
✗ Incorrect
The keyword 'output' before 'data' means it is an output port.
❓ Predict Output
intermediateWhat is the width of the input port
addr?Given this Verilog port declaration, what is the width of the input port
addr?Verilog
module mem_access(addr, data_in, data_out); input [15:0] addr; input [7:0] data_in; output [7:0] data_out; endmodule
Attempts:
2 left
💡 Hint
Check the range inside the square brackets before the port name.
✗ Incorrect
The range [15:0] means the port is 16 bits wide.
❓ Predict Output
advancedWhat error does this Verilog port declaration cause?
Examine this Verilog module port declaration. What error will occur?
Verilog
module test_module( input wire clk, output reg [3:0] out_signal, inout wire data_bus ); endmodule
Attempts:
2 left
💡 Hint
Observe the commas separating the port declarations in the ANSI-style header.
✗ Incorrect
No error, valid port declaration. In ANSI-style module declarations (Verilog-2001), ports are listed with their directions and optional types/net kinds, separated by commas, without semicolons inside the port list.
❓ Predict Output
advancedWhat is the direction and width of
bus in this module?Analyze the port declaration below. What is the direction and bit width of the port
bus?Verilog
module complex_port( input wire clk, inout [7:0] bus, output reg ready ); endmodule
Attempts:
2 left
💡 Hint
Look at the keyword and the range before the port name.
✗ Incorrect
The keyword 'inout' means the port can be input or output, and [7:0] means it is 8 bits wide.
🧠 Conceptual
expertHow many ports are declared in this Verilog module?
Count the total number of ports declared in this Verilog module header.
Verilog
module multi_port( input clk, input reset, output [3:0] status, inout [15:0] data_bus ); endmodule
Attempts:
2 left
💡 Hint
Count each port name listed with its direction keyword.
✗ Incorrect
The ports are clk, reset, status, and data_bus, totaling 4 ports.
