Oct 30, 2021

What is TCL in VLSI ? How APIs Work in VLSI Tools ?

TCL or Tool Command Language is one of the most important and popular scripting language in EDA/VLSI.In this article we will discuss about TCL., its significance in VLSI. 


What is TCL in VLSI :


TCL or tool command language is an open source multi purpose interpreted powerful dynamic scripting language. This is interpreted language and here we write a script and directly execute it. There is no need of compilation like the C-Language. TCL is is a dynamic language because you can change the code on-the-go. Then again copy the code in the TCLSH-Shell or Your VLSI-EDA-Tool Shell. TCL is very powerful language because of its multiple data structures with high data-mining capability . Another aspect of its power is that it can directly talk to you design under consideration. Let us consider the scenario that you have done a design through your VLSI software and when it becomes large you can inspect it with your design tool's TCL shell. 

TCL can be fit for both small and large programming test. This means that you can write a four line code and source it in your tool's shell. OR you may write a huge line of codes and make it talk it to the tool. Hence TCL is widely used in various domains in VLSI design and verification process. To be mode specific design means when you are designing a chip , you can use the TCL-Code to your respective tool through its interface for the designing purpose, verification  or quick-check. A a verification engineer, you will find that you can use the tools in built-in shell to query your verification queries. The kind of verification subjects to the particular tool's shell and the corresponding available APIs.  API is are called application programming interfaces which we will cover later in this article.


Domains of VLSI to use TCL Scripting :


Let's know what are the domain where TCL scripting is used.

1. Front-End Synthesis Tool : 

I consider that you are a beginner a person who knows nothing about where all the TCL is used in the VLSI Design . In this section you are about to know in which particular fields that TCL is used. And most importantly why you should learn tickle at all ! The first section where the TCL is used is the front-end synthesis tool in the ASIC-design. This stage comes immediately after we are doing the RTL coding & simulation using a HDL simulator. Multiple tools from multiple vendors there the TCL shell is available inside it. There you can apply your TCL scripting skill just to  to contribute in the designing process automation.

2. PnR & STA Tool: 

In the back-end placement and route EDA tool to do the Place and Route (PNR) Automation various vendor will provide you a TCL shell as a integrated part of the PNR tool. Their you can do some TCL scripting to automate your PNR process. Also sometime you can do query on some part of your design under construction. Automation rather is a generic terminology that can be applicable to the both PNR & Static Timing Analysis.  STA tool is used in both the front end part as well as the back and part of the ASIC design. In both cases you can utilize its powerful TCL shell to attain your goal. 

3. Reliability Analysis Tool : 

Many vendors to provide a interface where you can do the TCL scripting to do the reliability analysis & its control over various bench-marking parameters. For some vendors to code the EM-IR rules you may need TCL. 

4. Scripted Waveform Verification in Analog-Design: 

Scripted waveform verification in Analog-design is a bit different from the digital-verification. In Analog Verification, there will be predefined TCL commands that will help to to achieve your goal. In case you need to verify something of your own, generally the EDA Tool Vendors will provide the TCL interface APIs to write your own tickle code, to query necessary data that you are looking for.

5. Design For Testability Tool (DFT) : 

Design for testability Tool(DFT) is done for almost each and every design. So design for testability is very widely used in all the parts of VLSI. Here you will also have TCL shell inside the tool where you can source your TCL code.

 

Importance of TCL:


The obvious question is "there are several scripting languages and why talking about TCL here? what is its importance? " Well , TCL script can integrate with major EDA tools with interactive shell. 

Another beauty of TCL is that it supports cross platform scripting. Suppose some EDA Tool may be independent of the OS and in that case your TCL scripting could be done in in one  operating system (OS) and you can reuse the same TCL Code in another OS. 

TCL provides built in data structures such as list/arrays and dictionaries. Don't worry in this Series of TCL Articles, we will be covering all of these Data Structures. Data structure are very strong point of a scripting language because when we are doing a design or verifying a design with a TCL script, you will get a a huge amount of data. To handle such mammoth amount of data , you have to do the data-mining. In TCL you can do this easily with the help of the inbuilt data structures that are already available in TCL. Thus to deal with the all the data that is coming to you as as a response to your query , you can store it in TCL data-structures. Later you can manipulate the data at your own end or write in to a file in disk in csv or xml format. 

Control structures such as if/while/foreach/for/switch gives a programmer a very much flexibility to do the coding for various situations. Generally we learn C as a first programming language, you might have came accoross the control structures at that time. Similarly all of this control structures & few more additional ones are there available in TCL . 

Regular expression engine in TCL is as robust as for Pearl or Python. TCL has inbuilt regular expression engine. Practically this is needed when you are processing a huge number of nets in ASIC-Design. You are filtering a particular type of nomenclature of nets among all the nets in teh whole design, you can apply regular expression there. Thus you may sort only those particular type of nets with specific kind of nomenclature. However the use of regex is not limited to this spcific kind, you are free to use regex of any kind of application that  you want to do. 

TCL being open source means that you can download the source code without charge, inspect the source code, and if needed you can make your custom changes. 


TCL Script & DUT :


Now let us discuss about how the design & TCL Script are placed around each other. From the info-graphics you can understand that the tool will read all of the input files from the design under test (DUT). Cumulatively it could be GBs of data containing inside these input files. Thus , so much data are fed into the EDA Tools and it read them to become ready for you. Now the all data is alive and it combines the design that is under test as well as many more associated data. 

Thus the design is now LIVE & available to you at the EDA tool TCL shell. Live means the right away you make the query then and there right away you get a response from the tool's shell for any smallest part of your design. This is why the tool's TCL shell is a very powerful engine for a VLSI designer. Now the tool's APIs are live & ready to be used.




Each EDA Vendor will provide you a manual where the description of the input and output of the APIs will be mentioned. Combining basic TCL Code and APIs you can write your TCL code either for design purpose or for verification purpose. Or you may be doing something else what you do your tool allows you to do through the TCL Shell. You simply source your TCL script in the tool's shell & you are done. The tool absorbs the TCL code and run it through all the loaded design data.

If you have written TCL procedures, its now the time to call the call those procedures one by one to get your job done. Procedure are the like C functions, write once and use many times. 


TCL Code & Data Query:


I have just mentioned about that how in VLSI design will become live in the TCL shell. Now in this section , I will provide another  info-graphics to make you understand how your query goes up to the design and result comes back to you. By looking into the info-graphics , the first outermost shell is your checking code using API. Here you have to give the TCL code with basic Syntax combined definitely with the tools very own APIs as well. The next layer is is this is your code is interpreted by EDA Toll's TCL shell. Then it passes through the VLSI tools API interface-layer. Now this is a completely software concept. For now just understand that this much is is sufficient for you as a VLSI engineer. Then the command passes through all the layer upto the live design with all the data loaded into the data structures.




When you make a query, it crosses all this layer and go up to the live design and from the live design the query pick sup the required data and get back to your TCL shell . This data output would be your design related stuff for verification related query. For anything else that will be according to what is defined in the tool's API Manual.  This manual will be separately provided by each vendor for each of the individual tool. So no vendor have generic  API Manual. Rather it is specific to the particular tool and the particular vendor.


TCL  API :


So long we are talking about API API API ! So what is API ? It is an application programming interface , abbreviated as API,  that helps interactions between the tool and the human user through the written TCL code. Now , interface means that there is a software layer which allows you to communicate between the two different parties. Here the two different parties, one is you and another is the design. The communication happens through your TCL code and the API-Layer. Each tool vendor will have their manual for their respective APIs for each of their different tools. There is nothing call generic API there. APIs are very specific. If you have you have a tool for the front end that has a shell, so its API will be specific to that particular tool. For backend they will have specifically different API manual. Again API manual will vary from one tool vendor to vendor to another . For the same to vendor it will vary from one tool to another tool because these are TCL-Procedures that is written by the software company for specific target purpose. The APIs also provides extended functionality in the various tools. 
Apart from the inbuilt software functionality, additional usability can be added by the APIs. APIs also provides ways to tweak any existing software command.  With TCL APIs live access to the pre-loaded design Under test will be there with all associated data annotated. 
With information hiding, API enable modular programming. This is a beauty as a software point of view that when tool has API ,  you cannot see the software code although you are talking live to the design. you Cannot see all the basic design a data as well as the all additional data without doing a query through the API layer. Thus API is a software concept.Through the API layer will not help you not to see the software code obviously as this is a proprietary EDA software. 

How to use API : Data Dumping

So in this particular section will be discussing about how to use API data dumping. Your first your input query is entered through the the API function. API function here will carry out your instructions. As a result it will this will generate a data list or array or any custom data-structure exclusively owned by the EDA tool. All lookup table are interconnected data that are interconnected in one to one mapping. Generally these look up table data are termed as hash tables and are called dictionaries specific to TCL .Once you get the data then you can use the particular Data Structure to capture all these data and store them in the typical Data Structure inside your own TCL Code as needed. Then finally for your verification purpose or designing purpose you can dump them in text or csv file as you like. I am emphasizing again that each tool will have its own API manual and you have to consult it every-time use a new API. 



So we can subdivide the entire this flow in a three-part section. First part comes the query that you are doing.  Second part coming as the capture of the data. Third part comes as the dumping of the data in a hard-code manner. For first part you will use TCL APIs heavily.  For the second and the third part you will use generic TCL syntax (i.e TCLSH syntax) heavily. 


For video lecture on this article please watch the below video :