Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

Multiply-by-2 clock

Hello,

My design needs 2 clocks. One is the external clock and the other is the internal clock. The internal clock frequency = 2 x external clock frequency.

The port names in my module are base_clock and clock respectively. This is how my .sdc file looks like

create_clock -name "base_clock" -period 8.0ns [get_ports {base_clock}]

create_generated_clock -name "clock" -source [get_ports base_clock] -multiply_by 2 [get_ports {clock}]

But I am getting a warning saying: Warning (332088): No paths exist between clock target "clock" of clock "clock" and its clock source. Assuming zero source clock latency.

I know that something is wrong in the text in red. Could anybody please guide me as to how it should be written. I looked up the Altera's document on The Quartus II TimeQuest Timing Analyzer and found the below example.

create_clock -period 10 -waveform{05} [get_ports clk]

# Creates a multiply-by-two clock

create_generated_clock -source [get_ports clk] -multiply_by 2 [get_registers \ clkmult|clkreg]

I am new to this. Any help is appreciated.

Thank you.

6 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    How is the internal clock frequency generated?

    Do you have an external circuit that generates both the 125 MH base_clock and the 250 MHz clock?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    So you have two physical ports on your design, one called base_clock and the other called clock? How does the first input connect up to the second one? I'm guessing they don't, and the warning is correct. Please describe what you have physically and maybe we can help. (As rbugalho asks, how does the base_clock generate the clock?)

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello rbugalho and Rysc,

    Yes as you said, I have two physical ports to the module: base_clock and clock. I have attached the verilog modules in this post. PMP_2w4r is the main module. It instantiates a bank of block RAMs, a multipumping controller, some delays and muxes, and makes it all appear as a single memory with 2 write ports and 4 read ports that externally operates on the system clock, but internally operates at double that clock speed.

    As the altera documentation says, the base clocks are generated externally and multiplied clocks are generated by on chip PLL s. That is why I gave such a clock constraint in the .sdc file.

    @Rysc - The answer to your question "So you have two physical ports on your design, one called base_clock and the other called clock? How does the first input connect up to the second one?" . Hmmm, the clock = 2 * base_clock. There is no other connection between them. The verilog module "multipumping controller" generates phase signals alongside the multiplied clock to force the internal operations of the memory controlled by the multiplied clock to occur with a certain phase relationship relative to the external operations controlled by the system clock.

    Hope this helps.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    That really doesn't answer the question.

    Anyway, the issue is the following:

    "create_clock" is used to describe base clocks which are provided as FPGA input signals. It is also used to describe virtual clocks, which are not used in the FPGA.

    "create_generated_clocks" is used to describe clocks which are generated inside the FPGA from other clocks, either via a FPGA PLL or via a clock dividing logic.

    If PMP_2w4r is the main module, then you are providing both clock and base_clock to the FPGA as base_clocks from the external FPGA. You need to constrain them both using create_clock.

    It still begs the question of how they are generated.

    If they are externally derived from the same reference, then you can leave them as related clocks and let the tool analyse the timings. You should add some clock uncertainty/latency though, to account for external skews between them.

    If they are not externally derived from the same reference, then you must treat them as unrelated clocks, use asynchronous clock domain crossing techniques in your design and also cut the timing analysis between those two clocks, using set_clock_groups or set_false_path.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for the help rbugalho. I used create_clock constraint to generate both the clocks.

    However, one strange thing that I noticed is that the tool is reporting the Fmax of the external clock as approximately twice that of internal clock! It should have been the other way round.

    In the .sdc file my base_clock = 8ns => 125 MHz, internal_clock = 4ns => 250 MHz. But the Fmax for the base_clock = 625 MHz and Fmax for internal_clock = 303 MHz. Even though the multiplied by 2 factor is still maintained between the 2 clocks, I am not able to understand why the relationship is flipped!

    Is it because of the fact that since the internal_clock is not generated by the base_clock and since they are independent of each other Quartus calculates the Fmax for each clock separately?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Fmax is not a requirement, just an analysis of the clock domain by itself(not cross domain paths are analyzed) and just an analysis of how fast they can run, which is dependent on the design and not the timign constraints. I would recommend Report Setup Summary, as that really analyzes each path against your requirements, and analyzes cross domain transfers, as well as how Quartus really looks at your design. (After the summary, just right-click on any domain and do Report Timing to get more path specific details)