| Glitch free safe clock switching |
|
|
|
Page 2 of 3 Glitch free safe clock switch implementation
The logic is little complex than the simple clock switch, the clock switching will not happen immediately after switching the select signal. This circuit allows both clock settle down and switches the new clock to the circuit. It eliminates glitch or spikes in the clock signal. The safe clock switch circuit is implemented as in the following diagram.
Following figure shows the simulation of glitch free safe clock switch. For both implementations same test bench is used. Code for the test bench is available at end of the article.
Above circuit works well with related and unrelated clock. Related clocks means both clocks come from the same clock source (they are in phase) un-related clocks (they are not in the phase) are not come from the same clock source.
module clk_switch (
input clk_a;
output out_clk;
reg q1,q2,q3,q4;
always @ (posedge clk_a)
always @ (posedge clk_b)
assign or_one = (!q1) | (!select); assign out_clk = or_three & or_four; endmodule
|




