Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17048 Discussions

How to make timing constraint in this case??

Altera_Forum
Honored Contributor II
1,395 Views

Hi all, 

 

I've used a counter to make a clock enable such that I could get a new clock with divided frequency. The waveform is shown as below. Because there must be some clock skews for the counter's clock, it is possible that the second rising edge of the counter's clock arrives late and is not enabled. 

 

I've figured out two ways of constraining. The first is use set_clock_uncertainty from {counter's clock} -to {counter's clock} -setup XXX  

The second way is make the clock enable signal a generated clock and make sure they have no setup violations. 

 

Which one is the better way do you think? 

 

____-----_____-----_____-----_____-----_____-----___counter's clock 

____-----------____________________________--------clock's enable
0 Kudos
9 Replies
Altera_Forum
Honored Contributor II
615 Views

Could anyone tell me how to put the offset in this case for new clock(when I am trying to constrain the genenerated clock)? 

The duty cycle should be 33.33, and offset and phase are all 0, right?
0 Kudos
Altera_Forum
Honored Contributor II
615 Views

I am afraid you are on the wrong path. you don't generate a clock like that. Normally you avoid generating clock from logic gating as you get all sorts of problems. 

 

You are supposed to use the enable as enable not as clock. i.e. don't connect it to clock port of registers. Then you don't need to worry about timing as it will be synchronised with clk that generates it from the counter.
0 Kudos
Altera_Forum
Honored Contributor II
615 Views

Yes, I am using it as an enable; 

I write the verilog code like this: 

 

always@(posedge oclk or negedge rst) 

begin 

if(~rst_n) 

begin 

... 

end 

else if(oclk_enable) 

begin 

... 

... 

end 

else 

begin 

... 

end 

 

end 

 

Is it the right way? But I think because the oclk has some sort of skew(even if it's generated out of a pll), it is still possible that some branchs of oclk rising edge arrive late and miss the enable.
0 Kudos
Altera_Forum
Honored Contributor II
615 Views

That looks right to me. 

You don't have to worry about the clock edge issues and skew. Because clock generates enable (e.g '1' for one period ,will be read as '1' on next clock edge and so on).
0 Kudos
Altera_Forum
Honored Contributor II
615 Views

yes, but I still think it is possible that clock arrived very late for some particular registers but the enable's falling edge arrived early than that.  

So the clock rising edge that was supposed to be enabled failed being enabled.
0 Kudos
Altera_Forum
Honored Contributor II
615 Views

The enable signal is still a register right, it is possible that the enable is driven to low by a early clock rising edge. And enable signal then is propagated to another register and that register received a late clock rising edge. That caused the late clock rising edge failed to be enabled at that register

0 Kudos
Altera_Forum
Honored Contributor II
615 Views

if a clock edge happened to be late then enable generated will be late. because enable is generated locally on register (of counter). So why worry, both would be late and next clock edge will be late and will read the late enable correctly. It is safe and proven for decades.

0 Kudos
Altera_Forum
Honored Contributor II
615 Views

Yes, I know what you mean kaz. 

But it sounds to me like you are saying the clock edge are always arriving different registers at the same time. 

 

I am thinking of the case for the path to the counter register, we get an early clock. But for the path to another register which will need to be clock-enalbed, it gets a late clock edge.
0 Kudos
Altera_Forum
Honored Contributor II
615 Views

the tool (TimeQuest) will report on any violations. Normally inside fpga clock is taken care of by global lines so don't worry if tool passes timing.

0 Kudos
Reply