BitFlow

Down Counter — Synchronous

intermediate · sequential · 130 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

Down Counter — Synchronous Implement a 4-bit **synchronous down-counter**. Instead of incrementing, it decrements by 1 each enabled clock cycle and wraps from 0 → 15 (natural 4-bit underflow). **Interface** | Port | Direction | Width | Description | |-----------|-----------|-------|------------------------------------| | `clk` | input | 1 | Clock — rising edge | | `rst` | input | 1 | Synchronous reset — loads max value (15) | | `en` | input | 1 | Enable — decrement only when high | | `count[3:0]`| output | 4 | Current count (15 → 0 → 15 → ...) | **Behaviour on posedge clk:** - rst=1 → count = 4'hF (reset to max) - rst=0, en=1 → count = count - 1 - rst=0, en=0 → count holds Note: 0 - 1 naturally wraps to 15 in 4-bit arithmetic — no special case needed.

Constraints

  • Use always @(posedge clk) — synchronous.
  • rst loads 4'hF (max value), not 0.
  • Use non-blocking assignments (<=).

Examples

Input: rst=1, clk↑

Output: count=15

Input: en=1, count=5, clk↑

Output: count=4

Input: en=1, count=0, clk↑

Output: count=15 (wrap)

Common questions

What does the Down Counter — Synchronous problem ask you to build?
Down Counter — Synchronous Implement a 4-bit **synchronous down-counter**. Instead of incrementing, it decrements by 1 each enabled clock cycle and wraps from 0 → 15 (natural 4-bit underflow).
What constraints does Down Counter — Synchronous have?
Use always @(posedge clk) — synchronous.; rst loads 4'hF (max value), not 0.; Use non-blocking assignments (<=).
What is an example input and output for Down Counter — Synchronous?
Input rst=1, clk↑ gives output count=15.
Which Verilog concepts does Down Counter — Synchronous practise?
sequential, counter, down, synchronous, reset.