Translate page

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)

No comments:

Post a Comment

Must Read Article

Related Posts Plugin for WordPress, Blogger...

Follow by Email