Challenge - 5 Problems
Watchdog Timer Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateWatchdog timer reset signal behavior
Given the following VHDL snippet for a watchdog timer process, what is the output of the signal
reset_out after 5 clock cycles if kick is never asserted?VHDL
process(clk, reset_n) begin if reset_n = '0' then counter <= 0; reset_out <= '0'; elsif rising_edge(clk) then if kick = '1' then counter <= 0; reset_out <= '0'; else if counter < 4 then counter <= counter + 1; reset_out <= '0'; else reset_out <= '1'; end if; end if; end if; end process;
Attempts:
2 left
💡 Hint
Think about when the counter reaches the limit and what happens to reset_out.
✗ Incorrect
The counter increments each clock cycle when kick is '0' until it reaches 4. On the 5th cycle, counter = 4 which is not < 4, so reset_out <= '1'.
🧠 Conceptual
intermediatePurpose of the kick signal in a watchdog timer
In a watchdog timer design, what is the main purpose of the
kick (or refresh) signal?Attempts:
2 left
💡 Hint
Think about how the system avoids unwanted resets.
✗ Incorrect
The kick signal resets the watchdog timer counter, preventing the timer from reaching its timeout and resetting the system.
🔧 Debug
advancedIdentify the error in this watchdog timer VHDL code
What error will occur when compiling this VHDL watchdog timer process?
VHDL
process(clk, reset_n) begin if reset_n = '0' then counter <= 0; reset_out <= '0'; elsif rising_edge(clk) then if kick = '1' then counter <= 0; reset_out <= '0'; else if counter <= 4 then counter <= counter + 1; reset_out <= '0'; else reset_out <= '1'; end if; end if; end if; end process;
Attempts:
2 left
💡 Hint
Check the condition controlling the counter increment and possible overflow.
✗ Incorrect
The code compiles without syntax errors. However, there is a logic issue: using <= 4 allows counter to increment from 4 to 5 before reset_out goes '1', delaying the timeout by one cycle. Additionally, counter is not assigned in the 'else' branch, which may infer a latch in synthesis.
📝 Syntax
advancedCorrect syntax for asynchronous reset in watchdog timer process
Which option shows the correct syntax for an asynchronous active-low reset in a VHDL watchdog timer process?
Attempts:
2 left
💡 Hint
Asynchronous reset must be checked outside the clock edge condition.
✗ Incorrect
Option D correctly checks reset_n asynchronously before the rising edge of clk.
🚀 Application
expertCalculate watchdog timer timeout period
A watchdog timer uses a 16-bit counter clocked at 1 MHz. The timer resets the system when the counter reaches its maximum value. What is the approximate timeout period in seconds before reset occurs?
Attempts:
2 left
💡 Hint
Calculate the max count value and divide by clock frequency.
✗ Incorrect
A 16-bit counter counts from 0 to 65535 (2^16 = 65536 cycles to reach max and trigger). At 1 MHz (1,000,000 Hz), timeout = 65536 / 1,000,000 ≈ 0.0655 seconds.
