Constraint clocks of SPI interfa - Constraint clocks of SPI interfa
Hi all, I have a design where I generate an SPI clock and send some data over the slave. The slave is an ADC with its own setup/hold time constraints. In these constraints, the slave data input SDI has constraints with respect to the SCLK, but I'm not sure how to properly constraint that. What I did so far is that I constrainted the SCLK on its own as if it's a data output of the FPGA and then constraint the MOSI with referencing the SCLK. The syntax I used in the sdc file is added below. # main clock of the FPGA create_clock -name {clk} -period 100MHz [get_ports {clk}] # Specify generated clock from PLL (PLL output is 100MHz) # set_instance_assignment -name corepll_inst|altpll_component|auto_generated|pll1 -to pll_inst # create_generated_clock -name {pll_clk} -source [get_pins pll_inst|clk[0]] -divide_by 1 # constraints for SCLK and MOSI set_output_delay -clock {corepll_inst|altpll_component|auto_generated|pll1|clk[0]} -max 3 [get_ports {SCLK1}] set_output_delay -clock {corepll_inst|altpll_component|auto_generated|pll1|clk[0]} -min -2 [get_ports {SCLK1}] set_output_delay -clock {corepll_inst|altpll_component|auto_generated|pll1|clk[0]} -reference_pin SCLK1 -max 5 [get_ports {MOSI1}] set_output_delay -clock {corepll_inst|altpll_component|auto_generated|pll1|clk[0]} -reference_pin SCLK1 -min -5 [get_ports {MOSI1}] What I observe in the Timing Analyzer is that the setup and hold times are not the only things when checking the timing analyzer. For the example that you can see on the snippet attached, I would expect that the data required for the setup time of SCLK1 would be only 3 ns far from the latch clock's posedge, where the cursor is. I'm almost sure that what I want to achieve does not match with the constraints I used, therefore I'd like to ask what I'm doing wrong or missing. Any help is much appreciated, Cheers
Replies:
Re: Constraint clocks of SPI interfa
I’m glad that your question has been addressed, I now transition this thread to community support. If you have a new question, Please login to ‘ https://supporttickets.intel.com ’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions. -
Replies:
Re: Constraint clocks of SPI interfa
Adding the pins of the Quad SPI IP did not work, but generating another clock like this and constraining the other QSPI ports wrt. this clock seems to work somehow create_generated_clock -name {qclk_vclk} -source [get_pins {corepll_inst|altpll_component|auto_generated|pll1|clk[0]}] [get_ports {QSPI_CLK}]
Replies:
Re: Constraint clocks of SPI interfa
You can try the following setting:
Replies:
Re: Constraint clocks of SPI interfa
You can try 'get_pins'.
Replies:
Re: Constraint clocks of SPI interfa
Should I use `get_nets` then to use that wire ?
Replies:
Re: Constraint clocks of SPI interfa
Currently, you output/input delay constraints are invalid due to the previous problem we discussed which caused these paths unconstraint, and the software won't analyze these paths. You need to first fix the issue of ignored constraints. Please apply 'set_instance_assignment -name corepll_inst|altpll_component|auto_generated|pll1 -to pll_inst' to the qsf file instead of sdc file. Or you can directly use 'corepll_inst|altpll_component|auto_generated|pll1' instead of pll_inst. And don't use get_fanin to get the source clock, please try to use wire_pll1_clk[0]~clkctrl as the source clock of qclk. I can't apply changes to your sdc file, so please try the modification from your side. Hope this can help.
Replies:
Re: Constraint clocks of SPI interfa
What I meant by that is this: I want the SCLK1 clock output to be used for checking the setup/hold time violations of MOSI1 and MISO1 ports for example. The setup/hold time requirements are given by the manufacturer of the external chip. But at the same time, I want to check SCLK1, MISO1 and MOSI1 with respect to the pll clock to verify that the timing is right for the FPGA itself as well as the external device.
Replies:
Re: Constraint clocks of SPI interfa
I'm not really quiet understand what you mean by ' use the sclk1 outputs to check the timing of some certain ports '. Based on the current SDC file the main problem is the clocks you created are ignored. If you want to create a virtual clock you can use the 'create_clock' constraint.
Replies:
Re: Constraint clocks of SPI interfa
Hi @TingJiangT_Intel , I don't get how I can do what I've described in this entry with virtual clocks then. Because I wanted to use the sclk1 outputs to check the timing of some certain ports. What would be the right approach here ?
Replies:
Re: Constraint clocks of SPI interfa
I upload the user guide here
Replies:
Re: Constraint clocks of SPI interfa
This is not how a virtual clock created. Please follow the UG 2.6.5.2:
Replies:
Re: Constraint clocks of SPI interfa
Hi, Thanks for the response. What do you suggest instead of `get_fanins` ? I wanted to create a virtual clock here from the generated QSPI output clock so that I can use it in my constraints.
Replies:
Re: Constraint clocks of SPI interfa
Hi there, I see. In your SDC file: create_generated_clock \ -name {qclk} [get_ports {QSPI_CLK}]\ -source [get_fanins {QSPI_CLK}] \ -divide_by 1 \ 'get fanins' can't be applied here as it will return a collection with more than one objects which can't be the source. BTW, set_instance_assignment also can't be used in SDC file which will be ignored, you may apply it in your QSF and try again or directly use the original name instead of 'pll_inst'.
Replies:
Re: Constraint clocks of SPI interfa
Hi, If you shared any media/link after eah line of yours, they're not visible. I opened this thread in 3 different web browsers to see what you've shared in this response, but I couldn't see anything. The `pll_inst` in the .sdc file is just a name that I made up, just to make easy to use the PLL's clock output in the whole .sdc file (you can also see that in this line below in the .sdc). set_instance_assignment - name corepll_inst | altpll_component | auto_generated | pll1 - to pll_inst You said that the `pll_inst` does not exist, but I can clearly see the corepll component (with the name `corepll_inst`) in the project. The component itself used in the project can be found under "IP Catalog -> Library -> Basic Functions -> Clocks; PLL and Resets -> PLL -> ALTPLL " and it's also instantiated in my top level .vhd file. So there must be another reason why the `pll_inst` doesn't seem to exist..
Replies:
Re: Constraint clocks of SPI interfa
Hi there, the generated clock constraints are ignored which causes your out/input delay constraint are invalid: Seems that the pll_inst doesn't exist, so there is no source clock for the create generated clock constraint which causes the issue:
Replies:
Re: Constraint clocks of SPI interfa
No, there are no updates since my email on 8th of May. Please go ahead!
Replies:
Re: Constraint clocks of SPI interfa
I see, I have got the email from Richard. If there is no more changes on the project in the email, I'll use this one for investigation.
Replies:
Re: Constraint clocks of SPI interfa
Could you send me an email (and the link for uploading the .qar file again if you cannot access the files that I uploaded for Richard) ? I can just forward the emails to you.
Replies:
Re: Constraint clocks of SPI interfa
May I know what's your main concern now. I may help the following supports.
Replies:
Re: Constraint clocks of SPI interfa
Hi, not yet. Waiting for @RichardTanSY_Altera 's response after a few emails between us.
Replies:
Re: Constraint clocks of SPI interfa
Hi there, is there any progress on that?
Replies:
Re: Constraint clocks of SPI interfa
Sent the files via email.
Replies:
Re: Constraint clocks of SPI interfa
Hi @anonimcs I have send you an email. Please check. Regards, Richard Tan
Replies:
Re: Constraint clocks of SPI interfa
Hi Richard, If you can give me your email address, I can generate and send you my .qar file.
Replies:
Re: Constraint clocks of SPI interfa
Hi @anonimcs I attempted to remove my original post content as I mistakenly posted my response in the wrong forum case. However, it seems you can still see it. Please kindly ignore my previous post. Regarding your issue, if you're okay with sharing your RTL, could you archive the .qar project (Project > Archive Project) so that I can investigate it further? The project_files.zip file doesn't seem to be compilable. Additionally, could you provide the block diagram of your design? This will help me understand the overall picture and which path you're trying to constrain. Regards, Richard Tan
Replies:
Re: Constraint clocks of SPI interfa
Hi @RichardTanSY_Altera , The design is already pipelined. But what I wanted to achieve mainly is to learn how to properly set constraints for a design like mine, not making the design more "timing-friendly". So it would be great if you can help me with that, so that I can see whether my design is good or I need adjustments on the RTL.
Replies:
Re: Constraint clocks of SPI interfa
[content removed]
Replies:
Re: Constraint clocks of SPI interfa
There you go! Please let me know if you need anything else. In short, I added virtual clocks for the QSPI and SCLK1-6 outputs and added them in the same clock group with the pll clock in addition to what I've discussed with the user sstrell above
Replies:
Re: Constraint clocks of SPI interfa
Hi there could you provide all the files of the project, and you can exclude you RTL(.v file) for confidentiality.
Replies:
Re: Constraint clocks of SPI interfa
Hi @sstrell , This way I do not get any setup/hold time violations but I am still not fully convinced if this is the way to go. When I report clocks / clock tree, I do not see the virtual clocks "pll_clk" (yes, I uncommented those lines) and "sclk1_clk" in any of those reports. In addition, I do see that the 'create_generated_clock' commands for these two virtual clocks are also reported to be ignored constraints in the Timing Analyzer. Same goes for the miso1/mosi1 constraints, I can see them under Ignored Constraints as well. So what I did in my .sdc file is as follows: #************************************************************** # Time Information #************************************************************** set_time_format -unit ns -decimal_places 3 #************************************************************** # Create Clock #************************************************************** create_clock -name {clk} -period 100MHz [get_ports {clk}] create_clock -name altera_reserved_tck -period 24.000MHz [get_ports altera_reserved_tck] #************************************************************** # Generated clocks #************************************************************** derive_pll_clocks derive_clock_uncertainty # Specify generated clock from PLL (PLL output is 100MHz) set_instance_assignment -name corepll_inst|altpll_component|auto_generated|pll1 -to pll_inst create_generated_clock -name {pll_clk} -source [get_pins pll_inst|inclk0] [get_pins pll_inst|clk0] -divide_by 1 # create SPI clocks of 50MHz create_generated_clock -name {sclk1_clk} -source [get_pins pll_inst|clk[0]] [get_ports {SCLK1}] -divide_by 2 set_false_path -from * -to [get_ports {SCLK1}] set_input_delay -clock {sclk1_clk} -max 4 [get_ports {MISO1}] set_input_delay -clock {sclk1_clk} -min 2 [get_ports {MISO1}] set_output_delay -clock {sclk1_clk} -max 5 [get_ports {MOSI1}] set_output_delay -clock {sclk1_clk} -min -5 [get_ports {MOSI1}] I don't know if that makes any difference here but I'm using Quartus Standard Version 21.1. Not sure what I'm missing here in the sdc...
Replies:
Re: Constraint clocks of SPI interfa
So you are clocking the external device with an output clock, basically source synchronous. You need a generated clock constraint targeted to the output and the output port for that clock should have a false path constraint so it is not being analyzed as a data output. You should not perform a data analysis on a clock output. So for example: #not sure why this was commented out and incomplete unless you were trying to create a virtual clock and is it SCLK1 or SCLK2 out? create_generated_clock -name {sclk1_clk} -source [get_pins pll_inst|clk[0]] [get_ports {SCLK1}] -divide_by 1 set_false_path -to [get_ports {SCLK1}] #-reference_pin was incorrect here; delay values could simply be Tsu for max and -Th for min if clock and data traces on board are matched delay set_output_delay -clock sclk1_clk -max 5 [get_ports {MOSI1}] set_output_delay -clock sclk1_clk -min -5 [get_ports {MOSI1}]
Replies:
Re: Constraint clocks of SPI interfa
The PLL clock is used for the whole design, the design has only one clock domain.
Replies:
Re: Constraint clocks of SPI interfa
What are the latch and launch clk, are they the same clk?
Replies:
Re: Constraint clocks of SPI interfa
Hi, I cannot show more of my timing constraints because there is simply nothing else... But please see the pictures attached for the detailed paths and the corresponding waveform
Replies:
Re: Constraint clocks of SPI interfa
Can you show the detailed path breakdown and more of your timing constraints? It's not clear why data is being launched on a falling clock edge in this analysis. - 2024-04-17
external_document