USE OF PERL IN DESIGN FLOW AUTOMATION AND TESTING IN VLSI PDF

Title USE OF PERL IN DESIGN FLOW AUTOMATION AND TESTING IN VLSI
Pages 37
File Size 325 KB
File Type PDF
Total Downloads 104
Total Views 768

Summary

P a g e |0 USE OF PERL IN DESIGN FLOW AUTOMATION AND TESTING IN VLSI By, Vicky Dhudashia (SJSU ID: 009428705) Under the Guidance of Date Signature Dr. Morris Jones 10 Dec 2014 Page | 0 Objective The purpose of this paper is to explain how one can write a PERL program to automate compilation, simulat...


Description

P a g e |0

USE OF PERL IN DESIGN FLOW AUTOMATION AND TESTING IN VLSI

By,

Vicky Dhudashia (SJSU ID: 009428705)

Under the Guidance of

Date

Dr. Morris Jones

10 Dec 2014

Signature

Page | 0

Objective The purpose of this paper is to explain how one can write a PERL program to automate compilation, simulation and synthesis and report generation with pointing out errors and important details as per user demand. This paper is a head start for those students, who want to learn PERL to automate tasks in HDL design compilation to synthesis. For the last comprehensive example, it is assumed that the user is familiar with UNIX operating system and already have VCS, DC Shell, and GTKWave in the computer system. In VLSI, (Very Large Scale Integration) design while doing a compilation, simulation and synthesis, after passing every stage, the user has to give commands with Verilog files and test bench containing the dump file declaration. After that, every time, the user has to wait for passing this stage or expecting error in execution. If the design passes one stage than another command for the next stage is given. After synthesis, netlist file as a result contains cells listed from the library file specified in synthesis script. This synthesis is done using NCVerilog of cadence. Then the user has to extract manually all the reports to search for desired value. If this process is being done in development and testing, then it becomes very hectic for user to enter the same command every time because, this may have to be followed until successful passing of design. So instead of doing these operations manually, PERL script is being written and it takes care of all things from error detection in report to data extraction. By, the end of this paper one complete example will be shown that will operate on Verilog code, and will do all the operations, according to specifications. In this paper, every type of special word is indicated with a different color so, the reader can easily identify and differentiate between variable, array, hashes, comment, and subroutine.

Page | 1

Table of Contents

Objective ........................................................................................................................................................................1 Introduction: ..................................................................................................................................................................5 PERL and its application .............................................................................................................................................5 Why PERL over other scripting languages? ...............................................................................................................5 Installation of PERL in Linux ...........................................................................................................................................6 Installation of PERL Modules .........................................................................................................................................6 Execution of PERL ..........................................................................................................................................................7 Useful syntax structure in PERL .....................................................................................................................................7 Comments..................................................................................................................................................................7 Switches .....................................................................................................................................................................8 -e ............................................................................................................................................................................8 -n ............................................................................................................................................................................8 -c ............................................................................................................................................................................8 Reading from a Pipe...................................................................................................................................................8 Difference between single quote ’ and double quote ” ................................................................................................9 Variables in PERL ...........................................................................................................................................................9 Scalars: .......................................................................................................................................................................9 Declaration of scalars ..........................................................................................................................................10 Expression with Scalars........................................................................................................................................10 Use of auto increment .....................................................................................................................................10 Use of auto decrement ....................................................................................................................................10 String Concatenation ...........................................................................................................................................10 Arrays .......................................................................................................................................................................11 Declaration of an Array ....................................................................................................................................11 Element declaration in an Array ......................................................................................................................11 shift ..................................................................................................................................................................12 unshift ..............................................................................................................................................................12 use of single and double quotes variation in print statement.........................................................................12 pop ...................................................................................................................................................................13 Push .................................................................................................................................................................13 Alphabetic sort.................................................................................................................................................13 Numerical sort .................................................................................................................................................13 Result: ..............................................................................................................................................................13 Hashes .....................................................................................................................................................................14 Page | 2

Declaration of hashes ..........................................................................................................................................14 Conversion from normal array to hash array and from hash array to normal array ...........................................15 Accessing value ................................................................................................................................................15 Subroutine ...............................................................................................................................................................16 Call by reference ..................................................................................................................................................16 Call by value .........................................................................................................................................................17 File Handling ................................................................................................................................................................17 STDIN --- Standard Input ..........................................................................................................................................17 Without using chomp ......................................................................................................................................17 using chomp.....................................................................................................................................................18 File Operation in PERL .................................................................................................................................................18 Default variables in PERL .........................................................................................................................................18 Open ........................................................................................................................................................................19 close .........................................................................................................................................................................19 Write ........................................................................................................................................................................19 Append ....................................................................................................................................................................19 Command line arguments ...........................................................................................................................................20 ARGV, and ....................................................................................................................................20 Control Structures in PERL ...........................................................................................................................................21 If... else ....................................................................................................................................................................21 While........................................................................................................................................................................22 For ............................................................................................................................................................................23 Foreach ....................................................................................................................................................................23 Breaking out of loop ................................................................................................................................................23 Skipping to end of loop ............................................................................................................................................24 Split function............................................................................................................................................................24 Regular Expression ......................................................................................................................................................24 Without RegEx: ........................................................................................................................................................24 Split function........................................................................................................................................................25 Using RegEx .............................................................................................................................................................25 Matching ..................................................................................................................................................................25 Substitution .............................................................................................................................................................25 Character Class ........................................................................................................................................................26 Substitution .................................................................................................................................................................27 Memory in PERL.......................................................................................................................................................27 Page | 3

Useful functions for User interaction ..........................................................................................................................28 Read .........................................................................................................................................................................28 die ............................................................................................................................................................................29 do .............................................................................................................................................................................29 exit ...........................................................................................................................................................................29 grep ..........................................................................................................................................................................29 Verilog Design ..............................................................................................................................................................30 Verilog Test Bench .......................................................................................................................................................32 PERL Script ...................................................................................................................................................................34 Conclusion ...................................................................................................................................................................36

Page | 4

Introduction: PERL and its application

Practical Report and Extraction Language (PERL) is one of the most used from available scripting languages because of its simple syntax structure and strong text manipulation with excellent data interface capability. It is widely popular and used for its strong string handling capability. It is an interpreted language. PERL can be optimized for searching any text files, for numeric or alphabetic information, extracting that information from file and generating reports from different format of files. PERL has its inbuilt functions that can be used for string shortening with respect to alphabet as well as numerical order and other functions like reverse, split, grep and many more. It is very useful in web development and also known as a server side programming language because, it does not run directly on the client end, i.e. Web browser, mobile device, etc. Being a server side programming language, it is used to implement the business logic. So upon a request from a client, it performs all the server side computation and also handles all the operation of connecting database and other services and in response provide a result in a form that can be represented at the client end. It is a procedural and high level language. PERL is mainly used in, web development and automating tasks to save human effort and time to do repeated the same function. PERL is interpreted so every time after updating PERL program user does not need to compile programs. This is mainly used in automating tasks in development and testing. Where all commands are written in a single file and then, it is executed. Moreover, PERL’s regular expressions (REGEX) known as REGEX are very helpful in matching and substituting text values in the file. It is used with delimiters to determine which value is to be matched. This is the main advantage in string handling capability.

Why PERL over other scripting languages?

PERL is supported on every platform. It is free so it does not need to purchase. Flexibility is also an important feature. It does not limit on the size of data. Even 60mb of file, entire file containing text can be assigned to a single string variable. After reading these specifications, one question surely comes in mind that, there are many other scripting languages but why PERL over those languages? There is no absolute answer. Every language has its own pros and cones. The reason why PERL is easy to use over Python is, Python is indented language. In Python, indentation matters a lot, so If, the code is not written with correct indentation, then it does not execute as desired. The biggest advantage in PERL is indentation does not matter because of the way syntax is used. PERL is an oldest scripting language been used over many years and it is very easy to use with Linux and UNIX operating systems.

Page | 5

Installation of PERL in Linux 1) Go to https://www.perl.org/get.html, Then Download relevant version according to computer system being used. 2) Run downloaded file. This will extract modules itself and after restart, it will install PERL. 3) Now it is ready to use. Just have to write in console PERL followed by the file to be executed. .pl is the file extension for PERL script file. Always before going into learning a new language, it is better to show how to use it by using a simple print command.

Installation of PERL Modules PERL has built in modules that are very useful in general programming, file handling, error handling, text processing, CGI applications, database interface, networking, and language extension. These are highly optimized algorithms to provide uniqueness and at some point of view security to the database. For downloading, follow the steps explained below: 1) Go to http://www.cpan.org/modules/index.html. Here all modules are listed according to the category. 2) Packages of the module Verilog-Perl is useful is used in this paper. 3) Select modules needed and then go to http://www.cpan.org/modules/INSTALL.html. There is detailed instructions for installing these modules.

Page | 6

Execution of PERL PERL file execution can be done in two ways. Extension of PERL file is .pl 1) Direct execution from command line. perl print "Good Luck\n";

Here perl indicates PERL interpreter being used to execute the file written after or to execute commands written after it. Good Luck 2) If the PERL file is being used for automation then, whole script can be written in the text editor with .pl extension. Now by just mentioning this file name in konsole with PERL command it can be executed. Open a simple text file, Provide PERL executor’s path name...


Similar Free PDFs