Challenge - 5 Problems
Up Counter Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of a 4-bit synchronous up counter
What is the output of the 4-bit synchronous up counter after 5 clock pulses if it starts from 4'b0000?
Verilog
module up_counter(input clk, input reset, output reg [3:0] count); always @(posedge clk or posedge reset) begin if (reset) count <= 4'b0000; else count <= count + 1; end endmodule
Attempts:
2 left
💡 Hint
Count increments by 1 on each clock pulse starting from zero after reset.
✗ Incorrect
The counter starts at 0 and increments by 1 each clock pulse. After 5 pulses, the count is 5 in binary 0101.
🧠 Conceptual
intermediate1:30remaining
Understanding asynchronous reset in up counters
What is the main effect of using an asynchronous reset in an up counter design?
Attempts:
2 left
💡 Hint
Asynchronous means it does not wait for the clock.
✗ Incorrect
An asynchronous reset forces the counter to reset immediately when the reset signal is active, without waiting for a clock edge.
🔧 Debug
advanced2:30remaining
Identify the error in this up counter code
What error will this Verilog code produce when synthesized or simulated?
Verilog
module up_counter(input clk, input reset, output reg [3:0] count); always @(posedge clk) begin if (reset == 1) count = 4'b0000; else count = count + 1; end endmodule
Attempts:
2 left
💡 Hint
Consider the difference between blocking (=) and non-blocking (<=) assignments in sequential logic.
✗ Incorrect
In sequential always blocks triggered by clock edges, non-blocking assignments (<=) must be used to avoid race conditions and synthesis errors.
📝 Syntax
advanced2:00remaining
Syntax error in up counter sensitivity list
Which option correctly fixes the sensitivity list for an asynchronous reset in this up counter?
Verilog
always @(posedge clk or reset) begin if (reset) count <= 0; else count <= count + 1; end
Attempts:
2 left
💡 Hint
Asynchronous reset sensitivity must be on the positive edge of reset signal.
✗ Incorrect
The sensitivity list must include posedge clk and posedge reset to detect clock rising edge and asynchronous reset activation.
🚀 Application
expert1:30remaining
Number of states in a 5-bit up counter
How many unique states does a 5-bit up counter cycle through before repeating?
Attempts:
2 left
💡 Hint
Number of states is 2 raised to the number of bits.
✗ Incorrect
A 5-bit counter can represent 2^5 = 32 unique states from 0 to 31.