Script To Display and Debug Clock Waveform
Script To Display and Debug Clock Waveform
Explanation of Script
There are tools (such as CCD or CDC) to help you design and verify constraints. But the clock waveform against constraints is not something that will be covered here.
The main issue is that the clock waveform coming from the simulation will not necessarily tell you how to code it correctly in SDC constraints. And even though it has been
presumably coded correctly, the “backend” tools may not interpret it correctly.
Example
Usage of the TCL variable is something quite common in SDC constraints but if you do not pay attention, it could become an issue.
Example 1:
set PERIOD 1
create_clock -name CLK -period $PERIOD -waveform [list 0.0 [expr $PERIOD/2]] [get_ports CLK]
If you think this clock definition is correct, you are wrong. PERIOD is defined as an integer, which means that “expr $PERIOD/2” will give you 0. So, your waveform
definition will be “0 0”. STA tool will not be able to catch this because this is still a valid clock definition. CCD, at least, will give you some warning.
Example 2:
In the following example, CCD will not even give you a warning:
set PERIOD 3
create_clock -name CLK -period $PERIOD -waveform [list 0.0 [expr $PERIOD/2]] [get_ports CLK]
If you were expecting a clock with a 50% duty cycle, you are again wrong because of the integer variable. Your waveform will be “0 1” instead of “0 1.5”.
It is very simple to correct the above two examples (simply replace the integer 2 in the division by a real 2.0). However, you need to first be aware that you did it wrongly.
This script will give you another way of checking your clock definition. It has to be used after loading your design (not in the physical mode only) in the Innovus / Tempus
GUI mode (TK is needed).
Usage
Source the attached script or script mentioned in the Code section and then run the user_clock_waveform command.
In Legacy UI mode:
In Common UI mode:
> source user_clock_waveform.stylus.tcl
> user_clock_waveform
This will create a window with waveforms of all clocks you have defined in your SDC.
Command Syntax:
This utility is not parsing the SDC constraints but is extracting the waveform values out of the database. Hence, it is not another SDC interpreter, but a waveform visualizer
of how the clock definition have been interpreted by the backend tool.
By default, a grid in X with a step of 0.1ns is printed. But this can be modified. Also, you can restrict the plot to only a list of clocks.
Caveats:
This script requires GUI window creation and Tk support. Therefore, you must not use -no_gui or -nowin option at the time of invoking Innovus/Tempus.
Preferably set the same analysis view before running the script for setup and hold so that clock definitions remain unique. If different setup and hold views are
used and the same clock name is likely to appear multiple times and the script will pick the first clock definition from the database irrespective of views and plot its
waveforms.
Example:
> set_analysis_view -setup {view1} -hold {view1}
> set clock_list [list clk1x clk2x]
> user_clock_waveform -clocks $clock_list
The grid is displayed by default with a step of 0.1ns on the plot. If the clock period is very large, it can end up trying to draw a huge number of gray vertical lines
which may take too much time. For clocks with large clock period, pass a large number as the <xgrid-step> argument to limit the number of vertical gray lines
displayed. This step should be a multiple of half of the smallest clock period.
For example, if the smallest clock period is 10ns, the following set of commands will plot all unique clocks with a xgrid-step of 5ns.
> set step 5
> user_clock_waveform -xgrid $step
Code
Refer to the attached Tcl scripts for the code.
Internal Notes
None
Return to the top of the page