Build two interlocked clock paths from falling-edge cells so a select change cannot cut a high pulse short.
Hardware context: ap_soc peripheral clock switch. Safe operating mode changes
A boot controller holds sel steady until handoff completes. The two free-running clocks have unrelated phases. Build the cell netlist for one handoff in either direction.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
dut_out_clk | 1 | stimulus, the same for every design |
Full specification
sel=0 requests a, sel=1 requests b. Each branch samples its request qualified by the opposite final grant being low.
Feed that decision through two consecutive falling-edge flops on the local clock. Only the second stage may enable its branch. OR the masked branches together.
allow_if passes want while busy is low. mask_clock ANDs its two inputs. merge_clocks ORs them. invert complements its input.
Active-low asynchronous reset clears all stages. Reset may truncate a pulse. Normal switching starts after reset and must preserve each high interval.
Examples
Example 1
Assert Reset While Both Sources Are Low- Input
Assert reset while both sources are low
- Output
out_clk = 0
Both branches begin disabled.
Example 2
Two A Falls, Then an A Rise- Input
Two A falls, then an A rise
- Output
out_clk = 1
The second local fall admits A, and the next rise passes.
Example 3
Request B While A Is Still High- Input
Request B while A is still high
- Output
out_clk = 1
The old high pulse survives a new request.
Constraints and Contract
- Write a flat netlist with wires and explicit instances of the supplied cells. Use positional or explicit named port connections. The storage cell is
fall_ff(clk,reset_n,d,q). The logic cells areallow_if(want,busy,y),invert(a,y),mask_clock(clk,en,y)andmerge_clocks(a,b,y).
Hints
Hint 1
Mark the first and second falling edges separately.
Hint 2
A request waits until the outgoing branch releases.
Hint 3
Follow the old pulse to its natural falling edge.
What the grader checks: Cell-only grading and edge sweeps cover both directions, simultaneous falls and reset. Digital simulation cannot measure metastability.
106 checks on Icarus Verilog · 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