Decade Up/Down Counter
Digital panel meters and bidirectional event counters require tracking values in human-readable base-10 format. The decade up/down counter handles non-power-of-two modulus arithmetic, requiring distinct wrap-around logic for each direction.
The circuit maintains a 4-bit state (Q3, Q2, Q1, Q0) that updates on the rising edge of the clock. A synchronous rst signal forces the state to 0. The dir signal controls the counting direction: 1 for UP, 0 for DOWN. The terminal flags COUT and BOUT are combinational outputs that assert only when the counter reaches its limit for the active direction.
Combinational Terminal Logic:
| Current State (Q3:Q0) | dir | COUT | BOUT | |---------------------------|-------|--------|--------| | 9 (1001) | 1 | 1 | 0 | | 0 (0000) | 0 | 0 | 1 | | All other valid states | X | 0 | 0 |
Sequential State Transitions:
| rst | dir | Current State | Next State (Q3:Q0) | |-------|-------|---------------|------------------------| | 1 | X | X | 0 (0000) | | 0 | 1 | 0 to 8 | State + 1 | | 0 | 1 | 9 | 0 (0000) | | 0 | 0 | 1 to 9 | State - 1 | | 0 | 0 | 0 | 9 (1001) |
Constraints
- Implement using D flip-flops for the 4-bit state register.
COUTandBOUTmust be implemented as purely combinational logic based on the current state anddir.- The counter must not enter states 10 through 15 during normal operation.
Topics
Solve this problem
Place the gates, wire them up and watch the signals settle. Every submission runs on the same simulation engine that grades it.
This problem is part of Codiode Pro. The statement above is free to read.
The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.