krieg
New Contributor
6 years agoIs there an SDC/TCL command for returning the clock associated with a logic cell?
In Vivado, I can do this with
set myreg [get_cells -hierarchihcal myregister]
set myreg_clk [get_clocks -of_objects $myreg]The Quartus version of get_clocks does not seem to have the -of_objects argument. Has anyone figured out a way to get the clock associated with a logic cell?
A little background: I have a design that uses multiple clock domains and I want to be able to add constraints based on the clock periods. In Vivado, I wrote a constraints file that does this for all instances of my design within the top-level design. I am trying to do the same in Quartus.
I am using Quartus Prime Pro 18.0.
Taking inspiration from sstrell's answer, I was able to solve this.
The code below is an excerpt from my initial success. It has not yet been tested with multiple designs.
# get all clocks set clks [all_clocks] # get the register that I want to constrain set my_reg [get_cells -hierarchical *myregistername] # get all fanins to my register (use -stop_at_clock so it doesn't go all the way back to the master clock) set fanins [get_fanins -clock -stop_at_clocks [get_object_info -name $my_reg]] # find which fanin is a clock pin foreach_in_collection fanin $fanins { if {[get_object_info -type $fanin] == "pin"} { if {[get_pin_info -is_clock_pin $fanin]} { set clkpin $fanin } } } # get the clock pin net ID set clknet [get_pin_info -net $clkpin] # compare the clock pin net ID to each clock in the design; get the period of the clock that matches foreach_in_collection clk $clks { if {[get_object_info -name [get_clock_info -targets $clk]] == [get_object_info -name $clknet]} { set clkperiod [get_clock_info -period $clk] } }