Translate page

Thursday, November 15, 2018

TCL Practice Task 2 (Scripting Language)

TCL is very important from automation point of view in VLSI Industry but students are lacking bigtime. Even if they learn, they face problem to understand the uses of TCL in VLSI Industry. In these series of articles, I am listing down few of the small projects or say programs or say exercise which can help anyone to understand the use-model of TCL in Industry. As a fresher, if you try at least once, it will boost your confidence. If you are able to automate below few task, more then 50% of work (based on TCL) can be done easily.
This is second part. If you have missed first part, please visit it (TCL Practice Task 1). Because to understand this Task, you should have Task 1 program handy. :)

If you have completed previous task (task 1), I am sure now you are good in file handling.

Task 2:- Mapping Two Files

Step 1: Create 2 Input files ("file_input1.txt" and "file_input2.txt")
Content of "file_input1.txt" is same as in the previous Task. So, you can copy file from last program. Snapshot of both the files are present below.

Input File: “file_input1.txt”

    Name        Delay    Trans    Load
    AND1_2X      1.50ns    0.1    1.25ff
    AND1_3X      1.75ns    0.2    1.98ff
    AND2_3X      2.37ns    0.3    2.27ff
    AND2_4X      1.82ns    0.5    2.54ff
    NAND1_2X    2.14ns    0.2    1.69ff
    NAND2_3X    2.48ns    0.3    2.11ff

Input File: “file_input2.txt”

    CELL_1:    AND1_2X
    CELL_2:    AND2_3X
    CELL_3:    AND2_4X
    CELL_4:    NAND2_3X

Step 2: Reuse TCL Program of Task 1 and convert into procedure or procedures.

Step 3: Write a TCL program, where you will read both input files "file_input1.txt" & "file_input2.txt" and as per the CELL name present in second file (e.g. AND1_2X ...), you have to extract below data and display it in the below format.

    Name        Trans    Load    Delay    Total_Delay
    AND1_2X      0.1    1.25ff    1.50ns      1.50ns
    AND2_3X      0.3    2.27ff    2.37ns      3.87ns
    AND2_4X      0.5    2.54ff    1.82ns      5.69ns
    NAND2_3X    0.3    2.11ff    2.48ns      8.17ns

Total Delay = Delay of Cell + Delay of Previous stage
So, in our case,
    Delay of AND1_2X = 1.50ns + 0ns = 1.50ns
    Delay of AND2_3X = 2.37ns + 1.50ns = 3.87ns
    Delay of AND2_4X = 1.82ns + 3.87ns = 5.69ns
    Delay of NAND2_3X = 2.48ns + 5.69ns = 8.17ns

  • All the above calculations, you have to do with in TCL Program.
  • You have to reuse TCL program of Task 1.
    • Reading of File "file_input1.txt" should be with the help of previous program only.
    • Rearranging the data should be using previous program.
    • Writing data should be as per previous program.

Step 4: Print the above formated data onto the terminal & in output file "file_output2.txt"

Learning after this Program:
  • How to Open & Close 2 Input files simultaneously
  • How to Read or Write from/in a file
  • How to save data in List and do different operation on that
  • How to do Matching or say comparison of Data
  • How to select only a specific data
  • How to do mathematical calculations
  • Different commands use-model
    • list, lindex, lappend
    • Foreach loop, While loop, If-else loop
    • gets and puts
    • split
    • expr
    • incr
  • How to manage single space, multiple space
  • Regular expression concepts
  • Procedure concepts (proc in tcl)
    • How to write a Procedure
    • How to pass a value to Procedure
    • How to call a Procedure
    • How to get return from a Procedure (return command)

Industrial Use of this Task:
Most of the time, we work on automation of data in Industry.This data present in the form of report file (.rpt file) or output file or may be logfile. After reading data, we have to do a lot of operation (mathematically) and has to represent the data as per our requirement.
For example,
  1. Timing Report have a lot of information about several Timing paths. You may have to create a automation to find out only slack of specific paths mentioned in other file.
  2. SPEF file has C (cap) information of Nets. You want to compare 2 SPEF files of same design generated after making certain changes in design. This type of automation create a final report of Delta Cap for all Nets present in either SPEF file. Analysis of this final report (created after automation) may help you to fix design issues.
There are lot of such examples. I will try to list those sometime later. :)

I am sure this article will help you. In the Next article, we will discuss about a task where you have to take inputs from user in runtime (means during the execution of Program).

-By Rajat Bansal
(Btech-EC:- 2019 Passout)
(ABES Engineering College)

-Supervised By Puneet Mittal
(Founder & Director)
(VLSI Expert Private Limited)

1 comment:

  1. Mail me at for the script. Was not able to post it here!


Must Read Article

Related Posts Plugin for WordPress, Blogger...

Follow by Email