Intel® Quartus® Prime Pro Edition User Guide: Scripting

ID 683432
Date 12/04/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

4.1.34.9. get_clocks (::quartus::sdc)

The following table displays information for the get_clocks Tcl command:

Tcl Package and Version

Belongs to ::quartus::sdc

Syntax get_clocks [-h | -help] [-long_help] [-include_generated_clocks] [-nocase] [-nowarn] [-of_objects <object_collection> ] [ <filter> ]
Arguments -h | -help Short help
-long_help Long help with examples and possible return values
-include_generated_clocks Includes generated clocks derived from the matched clocks
-nocase Specifies the matching of node names to be case-insensitive
-nowarn Do not issue warning messages when querying for clocks
-of_objects <object_collection> Returns all clocks that target (defined on) or drive (determine data frequency of) the nodes in the collection.
<filter> Valid destinations (string patterns are matched using Tcl string matching)
Description
Returns a collection of previously defined clocks in the design. Use a clock
collection as the -from/to argument of a command (such as set_multicycle_path)
to refer to all nodes driven by the clocks in the collection.

# The following multicycle constraint applies to all paths ending at registers
# driven by clk
set_multicycle_path -to [get_clocks clk] 2

If a filter, which is a Tcl list of wildcards and must follow 
standard Tcl or Timing Analyzer-extension substitution rules, is specified, then 
get_clocks returns all previously defined clocks whose names match the filter.
See the help for use_timing_analyzer_style_escaping for filter rules.

If the -of_objects option is used, then a collection of registers, ports, pins, or cells
must be provided. The get_clocks command then returns a collection of all the previously defined clocks
that target these nodes, or if these nodes are not clock targets, all the previously defined
clocks that drive these nodes. The -of_objects option cannot be used along with the clock name filter.
Refer to the long help for examples of using the -of_objects option.

Tip: the get_clocks command can be used as part of SDC commands, as well as for reporting.
When it is used as part of SDC commands and includes the -include_generated_clocks option,
the Timing Analyzer needs to analyze the design and may issue warnings about missing clocks.
The missing clocks might still be created later on in the SDC file and are not
necessarily indicative of a problem. Use the -nowarn option in this case to suppress
those warnings. When you use the -nowarn option, pass a node collection generated by another get_*
 		collection command as the filter. This way, warnings directly related to the filter resolution are
 		still posted.
Example Usage
# get clocks that begin with 'c' or 'C', and print out their names and periods: 
set clocks [get_clocks c* -nocase]
foreach_in_collection clk $clocks {
    set name [get_clock_info -name $clk]
    set period [get_clock_info -period $clk]
    puts "$name: $period"
}

# getting the clock that targets a port, and its generated clock: 
create_clock -name my_clock -period 10.000 [get_ports CLK_100]
create_generated_clock -name my_gen_clock -divide_by 2 -source [get_ports CLK_100] [get_registers clk_div_reg] 
get_clocks -nowarn -of_objects [get_ports CLK_100] -include_generated_clocks 

# display the name of the clocks that drive registers beginning with 'reg_':
foreach_in_collection clk_id [get_clocks -nowarn -of_objects [get_registers reg_*]] {
    puts [get_clock_info -name $clk_id]
}
Return Value Code Name Code String Return
TCL_OK 0 INFO: Operation successful
TCL_ERROR 1 ERROR: Timing netlist does not exist. Use create_timing_netlist to create a timing netlist.