CodiodeCodiode
Home
Problem Solving
Skill Tracks
My Assignments
Contests
Leaderboard
Community
Settings
Codiode/Problems/Sequential Logic

Divide by 5 with 20 Percent Duty Cycle

MediumLogic CircuitBuild

Generating slower timing references from a high-frequency system clock is a standard requirement for peripheral interfaces. A divide-by-5 circuit steps down the clock frequency while maintaining a predictable pulse width for downstream logic.

The circuit must divide the input clock by 5, producing an output clk_out with a 20% duty cycle. The output clk_out must be high for exactly one clock period and low for four clock periods. The circuit must include an asynchronous, active-low reset rst_n. If the internal state machine powers up in or enters an invalid state, it must recover to a valid counting sequence within one clock cycle.

| rst_n | Internal State | Next State | clk_out | |---------|----------------|------------|-----------| | 0 | X | 0 | 0 | | 1 | 0 | 1 | 1 | | 1 | 1 | 2 | 0 | | 1 | 2 | 3 | 0 | | 1 | 3 | 4 | 0 | | 1 | 4 | 0 | 0 | | 1 | >4 | 0 | 0 |

Constraints

  • Implement a 3-bit internal counter to track the current state.
  • Force any invalid state (values greater than 4) to transition to state 0 on the next clock edge.
  • Drive the output clk_out high only when the internal state is 0.
  • Use an asynchronous active-low reset rst_n to initialize the circuit.

Topics

State MachinesClock DividersOdd Division

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.

Sign in to solveSee what Pro unlocks

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.

Related problems

  • 3-bit Ripple Counter from Toggle Flip-FlopsEasy
  • D Latch from a 2:1 MUXEasy
  • 2-bit Ring CounterEasy
  • T Flip-Flop from a D Flip-FlopEasy
  • Handshake Deadlock Due to Early ResetHard
  • Reconvergence of Individually Synchronized BitsHard
  • Debug: Asynchronous Clear GlitchHard
  • Clock Gate Enable Crossing DomainsHard

Browse all problems · Learning tracks