How to constrain the phase shift to synchronized/generated non-overlapping clocks in SDC?
Hello!
I'm currently struggling to properly set up my SDC file for a non-overlapping clock generator:
What I have is a 100Mhz clock for the FPGA (used for the synchronizer) and an external 0,987Mhz clock:
// Synchronizer for external clock
always @(posedge clk_100MHz_i)
begin
phi0_del0 <= clk_phi0_i;
phi0_del1 <= phi0_del0;
phi0_del2 <= phi0_del1;
endusing this now synchronized external clock I create two NEW non-overlapping clock signals clk_phi1+clk_phi2:
// Generate non overlapping clocks
reg clk_phi1 = 1'bX;
reg clk_phi2 = 1'bX;
always @(negedge clk_100MHz_i)
begin
clk_phi1 <=
~phi0_del0 &
~phi0_del2;
clk_phi2 <=
phi0_del1;
endThe clock "clk_phi2" is basically the external clock shifted by ~20ns.
Now I tried to constrain these signals:
# Constrain clock port clk_100MHz_i
create_clock -name {clk_100MHz_i} -period 10.000 [get_ports {clk_100MHz_i}]
# Define external base clock
create_clock -name clk_phi0 -period 1013 [get_ports {clk_phi0_i}]
create_clock -name clk_phi0_virt -period 1013
# Constrain derived non-overlapping clocks
create_generated_clock -name clk_phi1 -source clk_100MHz_i -edges {103 199 303} [get_pins {clock_gen|clk_phi1|q}]
create_generated_clock -name clk_phi2 -source clk_100MHz_i -edges {1 101 201} [get_pins {clock_gen|clk_phi2|q}]
# Make clk_phi0/1/2 asynchronous to 100Mhz base clock
set_clock_groups -asynchronous -group [get_clocks {clk_phi0 clk_phi0_virt clk_phi1 clk_phi2}] -group [get_clocks {clk_100MHz_i}]
# Define delays for slow input clock and generated output clocks
set_input_delay -clock clk_phi0_virt -min 0.0 [get_ports {clk_phi0_i}]
set_input_delay -clock clk_phi0_virt -max 3.0 [get_ports {clk_phi0_i}]
set_output_delay -clock clk_100MHz_i -min -1.0 [get_ports {clk_phi1_o}]
set_output_delay -clock clk_100MHz_i -max 3.0 [get_ports {clk_phi1_o}]
set_output_delay -clock clk_100MHz_i -min -1.0 [get_ports {clk_phi2_o}]
set_output_delay -clock clk_100MHz_i -max 3.0 [get_ports {clk_phi2_o}]
#################################################
set_input_delay -clock clk_phi0_virt -min 0.0 [get_ports {tst_signal}]
set_input_delay -clock clk_phi0_virt -max 3.0 [get_ports {tst_signal}]Now the problem where I'm stuck: I get a setup/hold violation for tst_signal.
tst_signal is launched with "clk_phi0" and should be latched with the
falling edge of "clk_phi2":
always @(negedge clk_phi2)
begin
tst <= tst_signal;
endCan someone point me to the mistake?
Is my usage of virtual clock clk_phi0 correct?
Thanks,
Frank
PS: The question is somewhat related to an earlier question I asked but.....