Forum Discussion
Query clock frequency in Platform Designer component
- 2 years ago
It turns out that a "package require -exact qsys 16.1" statement breaks the "clockRate" property of the clock interface. Probably a bug.
Fortunately, I found a simple workaround. One can use the CLOCK_RATE SYSTEM_INFO function for a parameter:
add_parameter CLOCK_FREQ INTEGER set_parameter_property CLOCK_FREQ DISPLAY_NAME "CLOCK_FREQ" set_parameter_property CLOCK_FREQ TYPE INTEGER set_parameter_property CLOCK_FREQ UNITS Hertz set_parameter_property CLOCK_FREQ DESCRIPTION "Frequency of the clock connected to the component in Hz." set_parameter_property CLOCK_FREQ SYSTEM_INFO CLOCK_RATE set_parameter_property CLOCK_FREQ SYSTEM_INFO_ARG clkNote that "clk" is the name of the clock interface of the component.
The parameter can then be read by "get_parameter_value CLOCK_FREQ" and will contain the actual frequency of the connected clock in Hz.
It turns out that a "package require -exact qsys 16.1" statement breaks the "clockRate" property of the clock interface. Probably a bug.
Fortunately, I found a simple workaround. One can use the CLOCK_RATE SYSTEM_INFO function for a parameter:
add_parameter CLOCK_FREQ INTEGER set_parameter_property CLOCK_FREQ DISPLAY_NAME "CLOCK_FREQ" set_parameter_property CLOCK_FREQ TYPE INTEGER set_parameter_property CLOCK_FREQ UNITS Hertz set_parameter_property CLOCK_FREQ DESCRIPTION "Frequency of the clock connected to the component in Hz." set_parameter_property CLOCK_FREQ SYSTEM_INFO CLOCK_RATE set_parameter_property CLOCK_FREQ SYSTEM_INFO_ARG clk
Note that "clk" is the name of the clock interface of the component.
The parameter can then be read by "get_parameter_value CLOCK_FREQ" and will contain the actual frequency of the connected clock in Hz.