Translate page

Thursday, November 29, 2018

TCL Practice Task 4 (Scripting Language)

During the automation using TCL, sometime we have to ask inputs from the user even before running the program. One of the option is "Template" and other option is command line input. In the command line input, we uses switches which can help user to give input.
Example -file_name "name_of_file" . Here -flie_name is the switch and "name_of_file" is the input from the user. This type of program is very common in VLSI Industry. Understanding of this is important, if you are doing automation with large number of different inputs but at a time with only few combinations.

This is the forth and last part of this series. If you have missed first, second and third part, please visit it. TCL Practice Task 1, TCL Practice Task 2 and TCL Practice Task 3

To understand this Task, you should have Task 1, 2 and 3 program handy. :)

Task 4:- Command Line Development

Step 1: Create 1 Input file ("file_input1.txt")
Content of "file_input1.txt" is same as in the first 2 Tasks. So, you can copy this file from previous programs. Snapshot of the file is 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

Step 2: Write a TCL program, where you are going to ask different inputs as per below switches from the user.

User Input Switches

-cell_name
–trans
–load
–delay
–total_delay


Note
  • -trans , -load, -delay and -total_delay all are optional but minimum 1 is required.
  • There is no input of switches -trans , -load, -delay and -total_delay.
  • -cell_name is required switch.
  • In -cell_name switch user has to define cell names as per input "file_input1.txt". If Cell names are more then 1 , they should be separated by "," (comma).
  • If -cell_name is not present, user should get an error message with use model of this file and program should exit.

Step 3: As per the user defined name of the cell in "-cell_name" switch, extract respective information (as per switch or switches "-trans", "-load", "-delay" and "-total_delay") from input file ("file_input1.txt") and display it in the below format (This is same output format as per Task 2 or 3 output).

Example 1:- If user Enter Cell name AND1_2X with all properties then display data should be...

user command -cell_name AND1_2X -trans -load -delay -total_delay

    Name        Trans    Load    Delay    Total_Delay
    ----------------------------------------------------------------------------
    AND1_2X      0.1    1.25ff    1.50ns      1.50ns

Example 2:- If user Enter Cell name AND1_2X, AND2_3X, AND2_4X & NAND2_3X with all properties then display data should be...

user command -cell_name AND1_2X,AND2_3X,AND2_4X,NAND2_3X -trans -load -delay -total_delay

    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

Example 3:- If user Enter Cell name AND1_2X, AND2_3X with -trans switch only then display data should be...

user command -cell_name AND1_2X,AND2_3X -trans

    Name        Trans
    ------------------------------------
    AND1_2X      0.1
    AND2_3X      0.3

Step 4: Print the above formated data as per user input in output file "file_output2.txt"

Hint:
  • You have to reuse TCL program of Task 1, 2 and 3.
    • Reading of File "file_input1.txt" should be with the help of previous program only.
    • Get the user input and create a new file (temporary file) as per second input file (file_input2.txt) format of Task 2.
    • Once you create a temp file, you can reuse the program of Task 2 as it is (just by converting that into procedure)

Learning after this Program:
  • How to Open, Close, Read, write different files
  • How to take inputs from the users using command prompt.
  • How to display info, warning and Error messages to user.
  • Looping in a program and resetting a particular variable.
  • Exit option.
  • How to save user inputs in a variable or list of variables, even you don't know the number of inputs.
  • How to save data in List and do different operations 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
    • argv option
    • split, join, shift, incr, expr
    • list, lindex, lappend
    • Foreach loop, While loop, If-else loop
    • gets and puts
  • 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)

I am sure these articles will help you to prepare for TCL scripting. I have few more such programs which I will try to capture later sometime.

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


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

Thursday, November 22, 2018

TCL Practice Task 3 (Scripting Language)

TCL is very important from automation point of view in VLSI Industry but somehow students are not ready to learn this. They think it's a programing (like software programing) and they are in VLSI Industry to do some hardware related job. Reason of this - they don't know the application 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 inside the Industry. As a fresher, it's worth trying these task/programs/exercise, it will boost your confidence.
This is third part. If you have missed first and second part, please visit it. TCL Practice Task 1 and TCL Practice Task 2.

To understand this Task, you should have Task 1 and Task 2 program handy. :)

After the first 2 task, Now it's time to add some features in those programs/tasks. :)

Task 3:- User Input and Runtime decision

Step 1: Create 1 Input file ("file_input1.txt")
Content of "file_input1.txt" is same as in the first 2 Tasks. So, you can copy this file from previous programs. Snapshot of the file is 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

Step 2: Write a TCL program, where you will read input files "file_input1.txt" and then you will display the name of these cells to the user as an info and ask them to choose cell name (or cells name) from the displayed list (which you have provided). According to the user input or inputs, you have to extract below information from input file ("file_input1.txt") and display it in the below format (This is same output format as per Task 2 output).

Example 1:- If user Enter Cell name AND1_2X then display data should be

    Name        Trans    Load    Delay    Total_Delay
    ----------------------------------------------------------------------------
    AND1_2X      0.1    1.25ff    1.50ns      1.50ns

Example 2:- If user Enter Cell name AND1_2X, AND2_3X, AND2_4X & NAND2_3X then display data should be

    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

Note:
  • About Total Delay, We have already discussed in previous task (TCL Practice Task 2)
  • How are you going to ask data from user, you have freedom.
  • User should be able to enter 1 (One) or multiple CELL name.
  • If user enter wrong name, you should be able to provide them proper information / warning (that Cell name is incorrect).
  • In case of wrong input, give user 2 more chances before exiting the program.
  • After every wrong input, provide a option to user to quit (if they want).

Step 3: Print the above formated data as per user input onto the terminal & in output file "file_output2.txt"

Hint:
  • You have to reuse TCL program of Task 1 and Task 2.
    • Reading of File "file_input1.txt" should be with the help of previous program only.
    • Get the user input and create a new file (temporary file) as per second input file (file_input2.txt) format of Task 2.
    • Once you create a temp file, you can reuse the program of Task 2 as it is (just by converting that into procedure)

Learning after this Program:
  • How to Open & Close Input files
  • How to Read or Write from/in a file
  • How to take inputs from the users.
  • How to display info, warning and Error messages to user.
  • Looping in a program and resetting a particular variable.
  • Exit option.
  • How to save user inputs in a variable or list of variables, even you don't know the number of inputs.
  • How to save data in List and do different operations 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:
During the automation of data, many times either we work on input Template file (where user need to provide inputs by filling that) or ask inputs from user directly during runtime. These inputs can be in the form of YES/NO or may be some small inputs like Cell name or Path name.

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 as a command line option (even before running a program and not as Template file).

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


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

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

Note:
  • 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)

Wednesday, November 14, 2018

TCL Practice Task 1 (Scripting Language)

VLSI Industry has requirement of TCL (a scripting language). Lot of Institutes helping students to learn this language. But somehow students don't know much about the use of this in real VLSI World. In this article, I am listing down few of the small projects or say programs or exercise which you should try at least once before entering into the VLSI Industry. If you are able to automate below few task, more then 50% of work (based on TCL) can be done easily.

Task 1:- Input Output File Handling & Rearranging Data

Step 1: Create a file and named it "file_input1.txt" (Content of "file_input1.txt" is given below - Remember, you have create file exactly same as given. All spaces and format should be in same manner)

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

Step 2: Create a TCL based program which will read input file ("file_input1.txt) and rearrange the data as per below format.

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

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

Learning after completion of this task:
  • How to Open and Close file
  • How to Read or Write from/in a file
  • How to save data in List and do different operation on that
  • Different commands usemodel
    • list, lindex, lappend
    • Foreach loop, While loop, If-else loop
    • gets and puts
    • split
  • How to manage single space, multiple space
  • If you are using regular expression - then things will be different but as such this program can be written without any regular expression.
  • If you are new to Linus environment then few more learning after this task
    • How to write a file using any unix editor
    • How to source a file and execute a program
  • If you want to use Procedure (equivalent to functions in C)
    • How to write a Procedure
    • How to pass a value to Procedure
    • How to call a Procedure

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 rearrange that data as per required format or say template (may be because of any other tool requirement or other scripting requirement or creating graphs/charts etc.)

I am sure, it will help you. In the Next article, we will discuss another Task with multiple file handling and data comparing concepts.

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


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

Must Read Article

Related Posts Plugin for WordPress, Blogger...