BitFlow

Up Counter — Asynchronous (Ripple)

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

Up Counter — Asynchronous (Ripple) Unlike the synchronous counter where all FFs share a clock, a **ripple counter** chains T flip-flops so each stage's output drives the next stage's clock. This creates **propagation delay** through the chain — the counter is asynchronous. Implement a **4-bit ripple up-counter**: - Each stage is a T flip-flop with T=1 (toggles on every trigger) - Stage 0 toggles on `negedge clk` - Stage N toggles on `negedge q[N-1]` - Count increases by 1 each clock cycle **Interface** | Port | Direction | Width | Description | |-----------|-----------|-------|----------------------| | `clk` | input | 1 | Master clock | | `rst` | input | 1 | **Async** active-high reset (each FF resets immediately) | | `count[3:0]` | output | 4 | Current count (0–15) | **Key insight:** Using `negedge` for the ripple makes it an up-counter. Using `posedge` would make it a down-counter. **Trade-off vs synchronous:** Ripple counters use less power and fewer resources but have timing glitches between clock edges that make them unsuitable for high-speed logic.

Constraints

  • Use four always blocks, one per bit.
  • Each stage triggers on negedge of the previous stage's output.
  • rst is asynchronous (in sensitivity list).
  • T=1 for all stages (always toggle on trigger).

Examples

Input: clk cycle 1

Output: count=1

Input: clk cycle 15

Output: count=15

Input: clk cycle 16

Output: count=0 (wrap)

Common questions

What does the Up Counter — Asynchronous (Ripple) problem ask you to build?
Up Counter — Asynchronous (Ripple) Unlike the synchronous counter where all FFs share a clock, a **ripple counter** chains T flip-flops so each stage's output drives the next stage's clock. This creates **propagation delay** through the chain — the counter is asynchronous.
What constraints does Up Counter — Asynchronous (Ripple) have?
Use four always blocks, one per bit.; Each stage triggers on negedge of the previous stage's output.; rst is asynchronous (in sensitivity list).; T=1 for all stages (always toggle on trigger).
What is an example input and output for Up Counter — Asynchronous (Ripple)?
Input clk cycle 1 gives output count=1.
Which Verilog concepts does Up Counter — Asynchronous (Ripple) practise?
sequential, counter, async, ripple, negedge.