4-bit Synchronous Counter
intermediate · sequential · 150 XP
Sign in to write your solution, run it in the simulator and submit it for grading.
Sign in or create a free account →Problem
4-bit Synchronous Counter
Implement a 4-bit synchronous up-counter with synchronous reset and enable.
Interface
| Port | Direction | Width | Description |
|----------|-----------|-------|-------------------------------------|
| `clk` | input | 1 | Clock — active on rising edge |
| `rst` | input | 1 | Synchronous reset — forces count = 0 |
| `en` | input | 1 | Enable — counter only increments when high |
| `count`| output | 4 | Current count value (0–15) |
Behaviour
- On rising edge:
- If `rst=1`: count → 0
- Else if `en=1`: count → count + 1
- Else: count holds
- The counter wraps from 15 → 0 naturally (4-bit overflow)
Notes
The enable input is critical in real hardware — it allows the counter to pause without losing state. This pattern is used in frequency dividers, timers, and pipeline stall logic.
Constraints
- Use always @(posedge clk) with synchronous reset.
- Use non-blocking assignments (<=).
- rst has higher priority than en.
- Output must be declared as output reg [3:0].
Examples
Input: clk↑, rst=1, en=X
Output: count=0
Reset always wins
Input: clk↑, rst=0, en=1
Output: count=prev+1
Input: clk↑, rst=0, en=0
Output: count=prev
Hold
Common questions
- What does the 4-bit Synchronous Counter problem ask you to build?
- 4-bit Synchronous Counter Implement a 4-bit synchronous up-counter with synchronous reset and enable.
- What constraints does 4-bit Synchronous Counter have?
- Use always @(posedge clk) with synchronous reset.; Use non-blocking assignments (<=).; rst has higher priority than en.; Output must be declared as output reg [3:0].
- What is an example input and output for 4-bit Synchronous Counter?
- Input clk↑, rst=1, en=X gives output count=0. Reset always wins
- Which Verilog concepts does 4-bit Synchronous Counter practise?
- sequential, counter, enable, reset.