Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
15339 Discussions

[SDC] Input/Output delay for All ports -> script writing

Altera_Forum
Honored Contributor II
2,995 Views

Hi All, 

 

How can I create the timing constraints (set_input/output_delay) for all ports (excepting clocks and reset ports)?  

 

Let's say the design has the following clocks: clk0, clk1, clk2 and following resets: rstn0, rstn1, rstn2 and hundreds of other ports. 

 

How can I write a script, which set input delays of 0ns for all input ports (excepting clk0, clk1, clk2, rstn0, rstn1, rstn2) and output delays of 0ns for all output ports?  

 

Thank you!
0 Kudos
25 Replies
Altera_Forum
Honored Contributor II
462 Views

I don't quite understand what you want to accomplish here. Your input and output delays could be 0 for a *minimum* delay, but you also need a matching *maximum* delay. The range of delay is required to give the Fitter an idea of what it has to work with as to the placement of the input or output register. 

 

set_input_delay -clock <virtual clock that drives upstream device> -max [get_ports in*] <max external delay based on tco of upstream device and board delays> 

set_input_delay -clock <virtual clock that drives upstream device> -min [get_ports in*] 0 

 

set_output_delay -clock <virtual clock that drives downstream device> -max [get_ports out*] <max external delay based on tsu of downstream device and board delays> 

set_output_delay -clock <virtual clock that drives downstream device> -min [get_ports out*] 0
Altera_Forum
Honored Contributor II
462 Views

Does the [get_ports out*] list all the output ports and [get_ports in*] list all the input ports? 

How can I exclude certain ports from these listings? 

Is it possible to work with collections here? 

How to remove the input/output delay constraints from the certain ports? 

Thank you!
Altera_Forum
Honored Contributor II
462 Views

When I run the get_ports out* command from Quartus console, I'm receiving the following errors?  

 

Error:ERROR: Quartus Prime Tcl command "get_ports" is only available for use in the following executables: Error: quartus_fit Error: quartus_sta Error: while executing Error: get_ports out*  

 

Why? How to fix?
Altera_Forum
Honored Contributor II
462 Views

I used in* and out* as examples. You have to put in your own port names.

Altera_Forum
Honored Contributor II
462 Views

this is exactly what I asked for :-) how to list ALL input ports without listing each port separately!  

How can I make a collection (list) of ALL the input ports (something like 'create_collection all_inputs')?
Altera_Forum
Honored Contributor II
463 Views

Just use all_inputs or all_outputs as your collection.

Altera_Forum
Honored Contributor II
463 Views

running the all_inputs command gives the same result: 

Error:ERROR: Quartus Prime Tcl command "all_inputs" is only available for use in the following executables: Error: quartus_fit Error: quartus_sta Error: while executing Error:"all_inputs" 

So, what's the solution?
Altera_Forum
Honored Contributor II
463 Views

Can you show your sdc file?

Altera_Forum
Honored Contributor II
463 Views

It's very simple - just several lines...  

 

set_time_format -unit ns -decimal_places 3 create_clock -name {clk} -period 10.000 -waveform { 0.000 5.000 } create_clock -name {fifo_rclk} -period 10.000 -waveform { 0.000 5.000 } set_input_delay -clock { clk } 5 set_output_delay -clock { clk } 5
Altera_Forum
Honored Contributor II
463 Views

Use something like: 

set data_inputs [all_inputs] 

set data_inputs [remove_from_collection [all_inputs] clk] 

That will create a list without clock. If you want to remove something else, do another line: 

set data_inputs [remove_from_collection $data_inputs reset] 

Repeat as necessary. If you want to visually see what's in it, then do: 

query_collection -all -report $data_inputs 

Once correct, use in constraint: 

set_input_delay -clock clk -max 0.0 $data_inputs 

Then repeat for outputs
Altera_Forum
Honored Contributor II
463 Views

set_input_delay [get_ports * ] ... =====>the * wildcard covers all the input ports 

remove_input_delay [get_ports clk] ===> will remove the input delay on the specified port 

 

Same thing for output delay. 

http://quartushelp.altera.com/15.0/mergedprojects/tafs/tafs/tcl_pkg_sdc_ver_1.5_cmd_remove_input_del...
Altera_Forum
Honored Contributor II
463 Views

 

--- Quote Start ---  

Just use all_inputs or all_outputs as your collection. 

--- Quote End ---  

 

 

OK, how could I list all the elements in these collections? What are the generated collections names?
Altera_Forum
Honored Contributor II
463 Views

 

--- Quote Start ---  

OK, how could I list all the elements in these collections? What are the generated collections names? 

--- Quote End ---  

 

 

I have a TCL script that has these lines in it to create files with the various 'collections' contents listed: 

 

set chan foreach_in_collection element { puts $chan ] } close $chan set chan foreach_in_collection element { puts $chan ] } close $chan set chan foreach_in_collection element { puts $chan ] } close $chan set chan foreach_in_collection element { puts $chan ] } close $chan set chan foreach_in_collection element { puts $chan ] } close $chan set chan foreach_in_collection element { puts $chan ] } close $chan set chan foreach_in_collection element { puts $chan ] } close $chan set chan foreach_in_collection element { puts $chan ] } close $chan set chan foreach_in_collection element { puts $chan ] } close $chan set chan foreach_in_collection element { puts $chan ] } close $chan
Altera_Forum
Honored Contributor II
462 Views

I tried to run the ferst example: 

---------------------------------------------------------------------- 

set chan [open "TQ_all_clocks.rpt" "w"] 

foreach_in_collection element [all_clocks] { 

puts $chan [concat $element : [get_object_info -name $element]] 

close $chan 

---------------------------------------------------------------------- 

 

The 'all_clocks' command is not recognized (ran from the Tcl Console). I've got the following: 

---------------------------------------------------------------------- 

Error:ERROR: Quartus Prime Tcl command "all_clocks" is only available for use in the following executables: 

Error: quartus_fit 

Error: quartus_sta 

Error: while executing 

Error:"all_clocks" 

Error: invoked from within 

Error:"foreach_in_collection element [all_clocks] { puts $chan [concat $element : [get_object_info -name $element]]}" 

---------------------------------------------------------------------- 

 

So, what's the problem? How could be fixed? 

 

Thank you!
Altera_Forum
Honored Contributor II
463 Views

 

--- Quote Start ---  

I tried to run the ferst example: 

---------------------------------------------------------------------- 

set chan [open "TQ_all_clocks.rpt" "w"] 

foreach_in_collection element [all_clocks] { 

puts $chan [concat $element : [get_object_info -name $element]] 

close $chan 

---------------------------------------------------------------------- 

 

The 'all_clocks' command is not recognized (ran from the Tcl Console). I've got the following: 

---------------------------------------------------------------------- 

Error:ERROR: Quartus Prime Tcl command "all_clocks" is only available for use in the following executables: 

Error: quartus_fit 

Error: quartus_sta 

Error: while executing 

Error:"all_clocks" 

Error: invoked from within 

Error:"foreach_in_collection element [all_clocks] { puts $chan [concat $element : [get_object_info -name $element]]}" 

---------------------------------------------------------------------- 

 

So, what's the problem? How could be fixed? 

 

Thank you! 

--- Quote End ---  

 

 

Ok, so here is my complete example. Previously I just posted snippets but they need to be run in the correct context. 

 

I run this on the command line: 

$(QUARTUS_BIN)/quartus_sta -t generate_timing.tcl $(DESIGN) 10 

 

Where the contents of the file generate_timing.tcl is as follows: 

 

set projname set numpaths project_open $projname create_timing_netlist read_sdc set_operating_conditions -model slow -grade c update_timing_netlist report_timing -setup -npaths $numpaths -detail path_only -file "TQ_setup_slow.rpt" set_operating_conditions -model fast -grade c update_timing_netlist report_timing -hold -npaths $numpaths -detail path_only -file "TQ_hold_fast.rpt" report_exceptions -file "TQ_exceptions.rpt" set chan foreach_in_collection reg { puts $chan ] } close $chan set chan foreach_in_collection reg { puts $chan ] } close $chan set chan foreach_in_collection reg { puts $chan ] } close $chan set chan foreach_in_collection reg { puts $chan ] } close $chan set chan foreach_in_collection cell { puts $chan ] } close $chan set chan foreach_in_collection pin { puts $chan ] } close $chan set chan foreach_in_collection net { puts $chan ] } close $chan set chan foreach_in_collection port { puts $chan ] } close $chan set chan foreach_in_collection clk { puts $chan ] } close $chan set chan foreach_in_collection keeper { puts $chan ] } close $chan exit
Altera_Forum
Honored Contributor II
462 Views

where do you run the script? from outside of the Quartus? But ow can I run the same commands from the TCL Console (from inside of Quartus)?

Altera_Forum
Honored Contributor II
461 Views

 

--- Quote Start ---  

where do you run the script? from outside of the Quartus? But ow can I run the same commands from the TCL Console (from inside of Quartus)? 

--- Quote End ---  

 

 

As I indicated I run the commands from the command line using this command: 

 

quartus_sta -t generate_timing.tcl MY_DESIGN 10 

 

so the tcl script is fed to the Quartus Static Timing Analyzer (quartus_sta) application. 

 

So basically the tcl command script in the file is run on the TCL console within the quartus_sta application.
Altera_Forum
Honored Contributor II
461 Views

If run from a script, then the following are necessary: 

set projname [lindex $quartus(args) 0] 

set numpaths [lindex $quartus(args) 1] 

project_open $projname 

 

Most scripts I run I launch TimeQuest on the project and double-click on Update Timing Netlist, which does the following: 

create_timing_netlist 

read_sdc 

set_operating_conditions -model slow -grade c 

update_timing_netlist 

 

At that point I run a timing analysis script or whatever I need to do.
Altera_Forum
Honored Contributor II
462 Views

 

--- Quote Start ---  

If run from a script, then the following are necessary: 

create_timing_netlist 

read_sdc 

update_timing_netlist 

 

--- Quote End ---  

 

 

Why this order? Intuitively I'd do it in this order: 

read_sdc 

create_timing_netlist 

 

Why this order will not work?
Altera_Forum
Honored Contributor II
275 Views

 

--- Quote Start ---  

Why this order? Intuitively I'd do it in this order: 

read_sdc 

create_timing_netlist 

 

Why this order will not work? 

--- Quote End ---  

 

 

You have to create the timing netlist before you can apply the sdc commands to it ... doesn't work the other way around.
Reply