Codiode

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.

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.

Part of Clocking and Synchronization

Problem 8 of 85 in the Clocking and Synchronization track.

Related problems

Browse all problems · Digital logic design practice problems · Learning tracks

Solve this on a laptopSend yourself the link and continue there.