3

I have a sequential Verilog code whereby at each increment of i, a different thing must happen.

For some of the i, there are no timing errors. However, for different values of i, I am getting timing errors (if omit these certain processes, then I get no timing errors).

I am wondering if there is a way in Verilog to allow combinational logic to take two clock cycles instead of one. Two clock cycles should be enough time to complete the processes, although I don't think I have seen anything like this before.

Thank you!

Lerbi
  • 225
  • 3
  • 11

1 Answers1

3

What you are looking for is called a 'multi cycle path'. A logic path (cone) that needs more then one clock cycle to complete.

You can define such a path using timing constraints but!!!
There are many pitfalls with using multi cycle paths. I can't tell them all as that takes too long, but in your case there is an extra danger as you seem to be using the same path sometimes as single cycle, sometimes as multi-cycle.

If you define a path as multi-cycle the synthesis tool will optimise your logic to fit that multi-cycle path and then stop the optimisation. It is well possible that the timing no longer is optimised enough to complete in a 'single cycle'.

For example:your clock is 100MHz and you do not use multi-cycle path constraints. The synthesis tool will try to get the best timing and achieves 12ns delay. Your timing will fail.

Now you use multi-cycle path constraints specifying 2 cycles. The synthesis tool will try to get the best timing and at some point achieves 19ns delay. That is enough so it stops. But now it is well possible that the timing no longer is optimised enough to complete in the 10ns for the cases where you have a 'single cycle'.

Oldfart
  • 6,104
  • 2
  • 13
  • 15
  • Thank you, this is an insightful answer, from knowledge that I imagine is gained through much experience. I am wondering if there are any books that you would recommend to me, a Verilog novice. I believe I know the basics, but things like what you mentioned are definitely news to me. Thanks! – Lerbi Jul 30 '19 at 05:24
  • @Oldfart, in multi cycle path also, we ll be having multiple flops with appropriate combinational logic in between and the cycle will also be with higher frequency. Whats the advantage of letting tool divide the logic, instead of us??? And in that case wont you have flops in between??? ...... Because tools I guess anyway does retiming so. – Karan Shah Aug 01 '19 at 03:05
  • *"Whats the advantage of letting tool divide the logic, instead of us?"* The tool does NOT do that. *You* decide what goes between registers and the tool does not touch that. The nearest is the 'balance registers' option you find in the Synopsys synthesis tool and that only works if you place multiple registers after the logic, which the Synopsys tool then tries to push inside. – Oldfart Aug 01 '19 at 06:31