
This design implements a configurable 32-bit Watchdog Timer (WDT) with optional password protection.
The WDT is a 32-bit down-counter. It loads a predefined value (WDTLOAD) and decrements on each tick. If the counter reaches zero without being fed, a timeout event (OE) is generated.
Selects access control behavior:
Selects timeout duration:
| TIME_SEL | Timeout |
|---|---|
| 000 | WDTLOAD = tick_per_sec / 10 |
| 001 | WDTLOAD = tick_per_sec |
| 010 | WDTLOAD = tick_per_sec × 10 |
| 011 | WDTLOAD = tick_per_sec × 100 |
| others | default = tick_per_sec |
Controls tick generation speed:
| DIV | tick_per_sec |
|---|---|
| 00 | 32,000,000 |
| 01 | 16,000,000 |
| 10 | 8,000,000 |
| 11 | 1,000,000 |
Password used when password mode is enabled.
The design is verified using Cocotb-based simulation. The testbench validates reset behavior, watchdog enable, timeout operation, password protection modes, and feed functionality.
Objective: Ensure the system starts in a known safe state.
Steps:
rst_n = 0 for at least 10 clock cyclesrst_n = 1Expected results:
OE = 0AE = 0Objective: Verify watchdog activation control.
Steps:
ui[0] = 1 (WDTEN = 1)Expected results:
uo[0] reflects enabled stateObjective: Verify watchdog triggers timeout when not fed.
Configuration:
ui[0] = 1 (enable watchdog)ui[7:6] = 2'b00 (fastest clock divider)ui[5:3] = 3'b000 (shortest timeout setting)ui[2:1] = 2'b00 (no password mode)uio[0] = 0 (no feed)Steps:
Expected results:
OE = 1 when timeout occursObjective: Ensure feed works without authentication.
Configuration:
ui[2:1] = 2'b00 or 2'b10uio[7:1]Steps:
uio[0] = 1 (feed request)7'b1111011)Expected results:
AE = 0Default password: 1010_110
Steps:
ui[2:1] = 2'b01uio[7:1] = 7'b1010110uio[0] = 1Expected results:
AE = 0Steps:
ui[2:1] = 2'b01uio[7:1] = any invalid value (e.g. 7'b1111111)uio[0] = 1Expected results:
AE = 1OR = OE | AE becomes active when error existsObjective: Validate dynamic password sequence checking.
Fibonacci sequence used: 0, 1, 1, 2, 3, 5, 8, 13, 21, ...
Note: Initial value
0may appear due to internal reset state.
Steps:
ui[2:1] = 2'b11uio[0] = 1uio[7:1]Expected results:
AE = 0 throughout operationSteps:
ui[2:1] = 2'b11uio[0] = 1Expected results:
AE = 1 for invalid inputsOR = 1 is assertedObjective: Verify watchdog reset behavior after successful authentication.
Steps:
ui[0] = 1)uio[0] = 1 for one clock cycleExpected results:
OE = 0 remains stableObjective: Validate combined operation of all features.
Steps:
DIV)TIME_SEL)PWD_SEL)FEED)Expected results:
OE, AE, and ORAll built-in, we are all in-house, no need to outsource, because we are strong enough
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | WDTEN - Enable Watchdog Timer | WDTEN status (mirrored input) | FEED - Feed watchdog signal |
| 1 | PWD_SEL[0] - Password mode select bit 0 | OE - Timeout event (Watchdog expired) | PWD[0] - Password bit 0 |
| 2 | PWD_SEL[1] - Password mode select bit 1 | AE - Access error (wrong password) | PWD[1] - Password bit 1 |
| 3 | TIME_SEL[0] - Timeout selection bit 0 | OE OR AE - Combined error flag | PWD[2] - Password bit 2 |
| 4 | TIME_SEL[1] - Timeout selection bit 1 | PWD[3] - Password bit 3 | |
| 5 | TIME_SEL[2] - Timeout selection bit 2 | PWD[4] - Password bit 4 | |
| 6 | DIV[0] - Clock divider select bit 0 | PWD[5] - Password bit 5 | |
| 7 | DIV[1] - Clock divider select bit 1 | PWD[6] - Password bit 6 |