Place both transitions of an odd divider so a sampling peripheral gets equal high and low time.
Hardware context: ap_soc peripheral clock switch. Safe operating mode changes
A peripheral needs a stoppable clock. It samples on each divided rise and fall, three input half-periods apart. You may adapt a continuous divider. You also own restart phase and the last pulse before a stop.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
dut_divided | 1 | stimulus, the same for every design |
Full specification
The input has equal high and low times. Reset is active low and clears the output immediately.
When idle, start on the first rising input edge with run high. Each active period contains three high half-periods followed by three low half-periods.
Sample run again at the rising edge that would start the next period. If run is low, stay idle until a rising edge samples it high. Ignore changes during an active period.
Examples
Example 1
Assert Reset with Clock Low- Input
Assert reset with clock low
- Output
divided = 0
Reset establishes the phase origin.
Example 2
First Rising Edge- Input
First rising edge
- Output
divided = 1
The first complete high interval starts here.
Example 3
Before the First Falling Edge- Input
Before the first falling edge
- Output
divided = 1
The input clock is still high.
Constraints and Contract
- Use synthesizable edge-triggered state. No delays or secondary oscillators. Reset may interrupt either half of the output cycle.
Hints
Hint 1
Locate the midpoint of one divided period.
Hint 2
Restart on the first rise after release.
Hint 3
Check both widths through a wrap and a reset.
What the grader checks: The fixture samples both edges over repeated periods, run changes, restart and reset.
The submitted design must synthesize with 0 latches and no combinational loop. Counts come from the pinned open-source synthesis flow. They are proxies for logic size and depth, not physical area or timing.
144 checks on Icarus Verilog + Yosys · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 3 problems on this path