Scripting for EDA tools - PowerPoint PPT Presentation

1 / 34
About This Presentation
Title:

Scripting for EDA tools

Description:

Many, many steps (don't forget anything) Need one recipe that everybody can use ... Strong 'cult' following. Learn it from the web. Scripting for EDA tools ... – PowerPoint PPT presentation

Number of Views:696
Avg rating:3.0/5.0
Slides: 35
Provided by: rogert4
Category:
Tags: eda | cult | scripting | tools

less

Transcript and Presenter's Notes

Title: Scripting for EDA tools


1
Scripting for EDA tools
  • Building chips is very expensive
  • Remember, this is about making money
  • Incredible complexity (dont mess up!)
  • Many, many steps (dont forget anything)
  • Need one recipe that everybody can use (many
    cooks)
  • Need to document the process (who did what, how?)
  • Can we do it over.. exactly the same way?
  • Scripting allows us to take care of all these
    issues.
  • Real world ASICs are built this way.

2
Scripting for EDA tools
  • What is a script?
  • A series of statements in a text file that tell
    the computer what to do.
  • The statements are interpreted by a command
    interpreter or shell.
  • Statements can be normal control flow or calls to
    other programs or scripts. (scripts can call
    scripts)
  • They use some language
  • You have used them but may not know it.
    (makefiles)

3
Scripting for EDA tools
  • Scripting environments
  • C shell (csh), TC shell (tcsh), Bourne shell
    (sh), Bash shell (bash), are very general purpose
    shells.
  • PERL, Python, TCL are very general purpose
    scripting languages.
  • TCL drives most CAD tools (Synopsys, MGC)
  • Some tools have proprietary scripting language,
    e.g. Cadence Skill language
  • nix CAD tools usually driven by a command
    interpreter (shell). Hence, dc_shell-xg-t

4
Scripting for EDA tools
  • General purpose scripting language differences
  • TCL
  • Very simple
  • Easy to learn
  • Fairly powerful
  • Usually embedded in CAD tools
  • Often augmented with specialized commands for the
    tool

5
Scripting for EDA tools
  • General purpose scripting language differences
  • PERL (Practical Extraction and Reporting
    Language)
  • Extremely powerful
  • Very popular, flexible
  • Swiss Army Chainsaw of scripting languages
  • Easy manipulation of files, processing textual
    information
  • PERL gives you 5 ways to do anything
  • Can be very cryptic, and hard to learn
  • Strong cult following
  • Learn it from the web

6
Scripting for EDA tools
  • General purpose scripting language differences
  • BASH Shell (Bourne again sh)
  • Linux command interpreter
  • Flexible, powerful
  • Good manipulation of files, controlling programs
  • Not too hard to learn
  • Learn it from the web

7
Scripting for EDA tools
  • What scripting gives us
  • Automated chip build process
  • Repeatability
  • Documentation of the build process
  • No GUIs to learn
  • Fast built times
  • Management of directories and files produced
  • Freedom to go for coffee while build is running
  • One day I realized that sadness is just another
    word for not enough coffee. Wally (Dilbert)

8
Scripting for EDA tools
  • When to use the GUI
  • First time through the tool
  • First try at simulating a module
  • With whatever you do, capture the transcript file
  • The transcript file once renamed and edited is
    the beginning of your tool (TCL) script

9
Writing Bash shell scripts
  • Bash shell scripts are text files
  • Text files most efficiently built with
    programming editors (emacs or vi)
  • File must be executable and in search path
  • chmod 700 my_script
  • PATH environment variable may not include .!
  • An example shell script
  • !/bin/bash
  • My first script
  • echo "Hello World!"

10
Writing Bash shell scripts
  • Compile a VHDL file with vcom (script doit1)
  • !/bin/bash
  • if ! d work then
  • echo work does not exist, making it
  • vlib work
  • fi
  • if ! s averager.vhd then
  • vcom averager.vhd
  • fi
  • work directory must exist before compilation

11
Writing Bash shell scripts
  • File attribute checking
  • !/bin/bash
  • if ! s junk_file then
  • mkdir junk_file
  • Fi
  • Spaces around brackets are needed!
  • File attribute checking
  • -d exists and is a directory
  • -e, a file exists
  • -f exists and is a regular file
  • -s file exists and is not empty

12
Writing Bash shell scripts
  • Compile VHDL then run a simulation..(script
    doit2)
  • !/bin/bash
  • if ! -d "work" then vlib work
  • fi
  • if ! -d "vectors" then mkdir vectors
  • fi
  • if -s "averager.vhd" then
  • vcom averager.vhd
  • vsim averager -do do.do -quiet c
  • else
  • echo vhdl file missing
  • fi

13
Writing Bash shell scripts
  • vsim command and arguments
  • vsim entity_name do dofile.do quiet -c
  • -quiet do not report loading file messages
  • -c console mode (no GUI)
  • try vsim help for command line arguements

14
Putting it all together
  • TCL dofile do,do directs the simulation
  • add list -nodelta
  • configure list -strobestart 99 ns
    -strobeperiod 100 ns
  • configure list -usestrobe 1
  • add list -notrigger -hex -width 8 -label
    data_in data_in
  • add list -notrigger -hex -width 8 -label
    data_out data_out
  • add list -notrigger -hex -width 8 -label
    mux_select mux_select
  • force -freeze clk 1 0, 0 50 ns -r 100
  • force reset_n 0
  • force data_in X"00"
  • force mux_select 1
  • force data_in X"A5"
  • force mux_select 1
  • run 150
  • force reset_n 1
  • run 50
  • force mux_select 0

15
Putting it all together
  • What did the simulation write out?
    (averager.list)
  • ns data_in data_out mux_select
  • 99 A5 00 1
  • 199 A5 00 1
  • 299 A5 29 0
  • 399 A5 52 0
  • 499 A5 7B 0
  • 599 A5 A5 0
  • Could we compare this data against another file?

16
Putting it all together
  • Compare against a golden vector file (script
    doit3)
  • !/bin/bash
  • clean
  • .....as before, but add..
  • if ! s vectors/golden then
  • echo comparison vectors do not exist
  • exit
  • else
  • diff vectors/averager.list golden gt report
  • fi
  • if ! -s "vector_report" then
  • echo " "
  • echo "HOORAY IT WORKS!"
  • echo " "
  • else
  • echo " "
  • echo "BOO HOO HOO, ITS BROKEN!
  • fi

17
Putting it all together
  • File redirection
  • gt write to file, but no clobbering
  • gtgt append output
  • gt clobber (overwrite) the file

18
Putting it all together
  • Shell variables
  • Example OSU_syn_lib nfs/guille/a1/cadlibs/osu
    _lib
  • Usage
  • vlog OSU_syn_lib/lib_ss_1.62.v work work
  • dollar sign dereferences the variable

19
Putting it all together
  • Case conversion
  • Ex cat vectors/averager.list tr a-z A-Z gt
    tempfile
  • mv tempfile vectors/averager.list
  • Split output
  • vcom my_module.vhd work work tee compile_log
  • output goes to screen and to the file

20
Intro to PERL
  • Larry Wall at NASA, late 1980s
  • Needed a tool to make report processing easier
  • PERL and the webs need for text processing made
    PERL really take off
  • PERL is now found on most any computer system
  • Online documentation, tutorials, examples abound
  • Excellent reference OReillys PERL in a
    Nutshell

21
PERL basics
  • Perl statements are separated by semicolons
  • 2 Basic data types numbers and strings
  • number 100000
  • string collection of chars inside or
    quotes.

22
PERL quoting
  • String literals delimited by single or double
    quotes
  • Double quoted string literals are subject to back
    slash and variable interpolation, and single
    quoted strings are not. (except for \ and \\)
  • Single and double quotes can be written as q
    for single quotes and qq for double quotes.
  • The brackets serve as the delimiters.

23
PERL quoting
  • PERL Quoting can be made clear

24
PERL quoting
  • double quote
  • suffixqq.txt
  • command quoting
  • print qxls grep suffix
  • When the script is run, we get
  • leopard traylor ./scr.pl
  • loc.txt
  • tmp1.txt

25
PERL Data Types and Variables
  • Variables three basic types
  • scalars (things), arrays(lists),
    hashes(dictionaries)
  • Scalars are simple variables
  • preceded by a dollar sign ()
  • a scalar is either a number, string or reference
    (think pointer)
  • Do not have to specify if a scalar is a number or
    a string. Perl determines this from its usage.

26
PERL Data Types and Variables
  • Arrays are ordered lists of scalars accessed with
    a numeric subscript. Subscripts start with zero.
  • Arrays are preceded by an at sign (_at_).
  • Hashes are unordered lists of key/value pairs
    accessed by using the keys as subscripts.
  • Hashes are preceded by a percent sign ().

27
PERL Data Types and Variables
  • Variables always begin with the character that
    identifies its type , _at_ or .
  • Upper and lower cases are distinct.
  • Variables are given values with the equals sign
    ().
  • crn57141 assigns the number 57141 to crn
  • _at_date (8, 24,70) assigns list to array date

28
PERL Data Types and Variables
  • Scalar variables always begin with the character
    , even when referring to a scalar value that is
    part of an array. i.e., fruit_at_fruit_array2
  • Every variable type has its own namespace. For
    example junk is distinct from _at_junk which is
    distinct from junk.

29
PERL Data Types and Variables
  • An array is a variable that stores an ordered
    list of scalar values that are numbered starting
    at zero.
  • Negative indexes count backwards from the last
    element in the list. i.e. (-1 refers to the last
    element in the list)
  • Example _at_count(5,8,23)
  • count2 is equal to 23
  • count-1 is equal to 23
  • count-2 is equal to 8

30
PERL basics
  • Math and operations with strings
  • Examples
  • a8 a holds the string 8
  • ba 1 b equals 9, evaluated as numbers
  • ca.1 dot(.) is the string concat operator
  • d5050
  • Perl converts stings to numbers as needed
  • b evaluates to a number because of the
    operator
  • c evaluates to 81 because of the concat
    operator
  • d is equal to 100 even though both 50s are
    stirngs!

31
PERL control flow
  • Loops
  • for(i0 ilt15 i)statement block
  • Conditionals
  • if if(expression)statement block
  • else statement block
  • While Loop
  • while (ltINFILEgt)print ltOUTFILEgt, _\n

32
PERL File I/O
  • A filehandle is the name for an I/O connection
    between Perl and the OS filesystem.
  • Convention is to use uppercase names.
  • All Perl programs automatically open three file
    handles STDIN, STDOUT, and STDERR.
  • By default, print and write functions write to
    STDOUT.
  • Other file handles are created by
  • open filename.txt for reading
  • open(FILEHANDLE,filename.txt)

33
PERL File I/O
  • To open for writing or appending
  • open(OUTFILE,gtfilename.txt)
  • open(OUTFILE,gtgtfilename.txt)
  • Check for successful file opening by
  • open(FILEHNDL,file)die(open failed)
  • or
  • open(FILEHNDL,gtgtfile)warn(oops!)
  • die terminates the program and warn writes a
    message to standard error.

34
PERL File I/O
  • Once the file is opened, you access the data
    using the diamond operator, ltFILEHANDLgt. This is
    the input line operator. It returns a line from
    the filehandle as a string.
  • Each time its called, a new string is fetched and
    is placed in the special variable _.
  • Close files when you done by
  • close FILEHNDL
Write a Comment
User Comments (0)
About PowerShow.com