Looks like a very popular EDA command, isn’t it? Yes, it is. Well, this command actually is just an interface for users. At the back-end, there is a C++14 code which gets executed and runs multi threading timing analysis. I know this, because I have been actively taking workshops and webinars on timing analysis
I have been criticized of not using Industry Standard Tools in my courses. I agree I do not have the tool. But I can create an interface, which gives a similar “feel and look” of commands used in industry standard EDA tools. And the good news is, you can build this too..
Have a look at below “set_multi_cpu_usage” command script, which pretty much maps to an internal Opentimer command (Opentimer is an open source STA engine)
What you can learn from above is that how various options and switches are included as a part of your command. Now in the above case, let’s say, set_multi_cpu_usage has 2 switches, 1) to provide number of threads 2) a ‘help’ command explaining the usage – These are pretty standard switches you would see in any set_multi_cpu_usage command in a standard EDA tool
We will pass both options to the command proc shown above and see how it gets resolved using tcl interface. When you type the command “set_multi_cpu_usage -localCpu 8 -help”, the expectation is to set local number of threads to 8 and print the usage of the command as well
This is how it works. First set default values for the options:
array set options {-localCpu <num_of_threads> -help “”}
Then enter a loop that processes the arguments, if there are any (left).
while {[llength $args]} {
During each iteration, look at the first element in the argument list:
switch -glob — [lindex $args 0] {
String-match (“glob”) matching is used to make it possible to have abbreviated option names.
If a value option is found, use l assign to copy the value to the corresponding member of the options array and to remove the first two elements in the argument list.
-localCpu {set args [lassign $args – options(-localCpu)]}
The last “puts” command will dump the Opentimer Command “set_num_threads 8”. This will get passed to Opentimer, and Opentimer will take it from here
Follow the same strategy as above, and the next args “-help” will print the usage of “set_multi_cpu_usage” command as shown below. Below image also shows the current status of all variables and flags used in this interface:
Wasn’t that pretty easy – Yes it was. It’s not me who’s saying this, but it’s coming from students who have completed the TCL programming Part 1 and 2 course, which covers commands like read_lib, read_sdc, read_verilog
Coming back to the criticism – I do not use Industry Standard Tools in my course – I would say, it’s just a mind-set, as you now know how the commands are built and what to do once you get hold of the tool. This is what I call “Freedom”. Freedom to use your own tools, freedom to create your own commands, infact build better ones.
“The only way to deal with an unfree world is to become so absolutely free that your very existence is an act of rebellion” – Albert Camus
Thank you and happy learning..