Translate page

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)

1 comment:

  1. Please share the TCL program file. I cannot find it on the page


Must Read Article

Related Posts Plugin for WordPress, Blogger...

Follow by Email