BitFlow

BCD Decade Counter with Carry

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

BCD Decade Counter with Carry A BCD (Binary-Coded Decimal) counter counts in decimal: **0, 1, 2, 3, 4, 5, 6, 7, 8, 9**, then resets to 0. It **never** reaches binary values 10–15. The `carry` output is a single-cycle pulse at the 9→0 rollover, allowing decade counters to be chained: carry of the units digit clocks the tens digit, carry of the tens clocks the hundreds, and so on. **Interface** | Port | Direction | Description | |------------|-----------|----------------------------------------------| | `clk` | input | Clock (rising-edge) | | `rst` | input | Synchronous reset (active-high) | | `en` | input | Count enable | | `q[3:0]` | output | BCD digit output (0–9) | | `carry` | output | 1-cycle pulse on 9→0 rollover | **Key:** reset condition is `q == 4'd9`, **not** `q == 4'd10` — the counter must never reach 10.

Constraints

  • q must never reach 4'd10 or above.
  • carry fires for exactly one cycle on the 9→0 transition.
  • carry does not fire when en=0, even when q=9.
  • Reset is synchronous.

Examples

Input: Count from 0 with en=1

Output: 0,1,2,3,4,5,6,7,8,9,0,1,...

BCD sequence

Input: q=9, en=1, posedge clk

Output: q=0, carry=1

Rollover with carry

Input: q=9, en=0, posedge clk

Output: q=9, carry=0

No carry when disabled

Common questions

What does the BCD Decade Counter with Carry problem ask you to build?
BCD Decade Counter with Carry A BCD (Binary-Coded Decimal) counter counts in decimal: **0, 1, 2, 3, 4, 5, 6, 7, 8, 9**, then resets to 0. It **never** reaches binary values 10–15.
What constraints does BCD Decade Counter with Carry have?
q must never reach 4'd10 or above.; carry fires for exactly one cycle on the 9→0 transition.; carry does not fire when en=0, even when q=9.; Reset is synchronous.
What is an example input and output for BCD Decade Counter with Carry?
Input Count from 0 with en=1 gives output 0,1,2,3,4,5,6,7,8,9,0,1,.... BCD sequence
Which Verilog concepts does BCD Decade Counter with Carry practise?
sequential, counter, BCD, decade, carry.