Verdi TCL Training

Share Embed Donate


Short Description

tcl application...

Description

Verdi3 TCL Training Based on Verdi3 2013.01

© Synopsys 2012

1

Glossary • • • • •

VIA = Verdi Interoperability Applications NPI = Novas Programming Interface Novas KDB = Novas Knowledge Database FSDB = Fast Signal Database VPI = Verilog Procedural Interface

© Synopsys 2012

2

Overview • Verdi Tcl Introduction – Use Tcl in Verdi – Case Study

• Debug Tcl Scripts • Labs

© Synopsys 2012

3

Overview • Verdi Tcl Introduction – Use Tcl in Verdi – Case Study

• Debug Tcl Scripts • Labs

© Synopsys 2012

4

Tcl Introduction Verdi Technology Background •



Automated cause & effect tracing –

Save significant engineering time



Easy visualization of behavior with time and structure

Complete, easy to use environment –

Design knowledge activated viewers –



Advanced debugger –



Waveform, source code, schema, TFV

State, testbench, assertions, transactions



Power-aware



Clock analysis



Post-layout ECO

Single portal for multiple languages, tools and methodologies –

Verilog, VHDL, System Verilog



Open interface for verification tools

© Synopsys 2012

5

Verification Tools

Designs

Open API

Compiler

FSDB

KDB

Tcl Introduction Tcl Basic

• What is Tcl? – Tcl stands for Tool Command Language – A “String” basis scripting language – Use source your_script.tcl to execute your Tcl script under tclsh

• What is Tk? – Tk is an associated toolkit to create window-based interactive applications using Tcl

© Synopsys 2012

6

Tcl Introduction What Can You Do in Verdi with Tcl? •

Use Tcl to combine Verdi commands to make your own feature to improve efficiency



Add your new feature, which was created by Tcl scripts, to the Verdi menu command or bind-key



Use NPI (Novas Programming Interface) to traverse the design without Verdi GUI

© Synopsys 2012

7

Tcl Introduction Possible Applications in Verdi with Tcl

• Application of FSDB – Calculate FSDB results. For example, duty cycles – Search and sort FSDB results. For example, search for small pulses

• Interoperability with 3rd party tools – Read 3rd party tool reports and translate into Verdi’s format

• Application of KDB – Access to Verdi database to do calculations and queries. For example, extract snake path from the design

© Synopsys 2012

8

Tcl Introduction Tcl Command Sets in Verdi •

Verdi provides Tcl commands for each action in the GUI



All Tcl commands are categorized by module and have a set prefix

© Synopsys 2012

9

Prefix sys deb src wv sch tfg nMem fsm reg eco ta sid lx

Module System Debussy (Verdi) nTrace nWave nSchema Temporal Flow View Memory/MDA nState nRegister nECO Transaction Siloti ListX

Overview • Verdi Tcl Introduction – Use Tcl in Verdi – Case Study

• Debug Tcl Scripts • Labs

© Synopsys 2012

10

Use Tcl in Verdi Execute Tcl in GUI •

In the Command Entry form: – –



When you execute any GUI command, the associated Tcl command will be logged in the Command Entry form Directly typing the Tcl command in the Command Entry form will execute the Tcl command Type source your_script.tcl in the Command Entry form to execute the Tcl script

© Synopsys 2012

11

Use Tcl in Verdi Execute Tcl in GUI

• Open the Command Entry form: – Invoke the Preferences form from Tools  Preferences – –

© Synopsys 2012

Go to General folder, enable the Enable TCL Command Entry Form option, the Command Entry form will be opened. The setting will be saved into novas.rc, and the Command Entry form will be opened automatically next time you invoke Verdi

12

Use Tcl in Verdi Execute Tcl in Command Line

• Execute the Tcl script in Verdi command line: – % Verdi –play your_script.tcl & – All associated Tcl commands will be saved in ./VerdiLog/Verdi.cmd –

Use –play to execute the Verdi.cmd file can reproduce previous steps

• Automatically source the Tcl script – By setting NOVAS_AUTO_SOURCE environment variable: –

% setenv NOVAS_AUTO_SOURCE your_script.tcl



% verdi &

– By modifying the novas.rc resource file: –

Search for TclAutoSource tag in [General] section in the novas.rc file



Specify your Tcl script for the TclAutoSource tag, for example: [General] TclAutoSource = MyTclScript.tcl

© Synopsys 2012

13

Use Tcl in Verdi Register Event Callbacks

• Register a Tk name for Verdi with –tkname – % Verdi -tkName

• Add an event callback with triggered reason – Syntax: AddEventCallback TkAppName CallbackFun Reason async –

Check all available Reason in Introduction  Tk Command Client  Adding Event Callbacks to Your Tk Application section of the Novas Command Language document (tcl.pdf in /doc directory)

• NOTE: you can also register a callback with a triggered reason after invoking Verdi, for example: – AddEventCallback [tk appname] AutoLoadSignal wvCreateWindow 1 – To execute the Tcl procedure AutoLoadSignal when a nWave window is created – tk appname: returns the name of the application, the application name will be “Verdi” if you source the Tcl script after invoking Verdi © Synopsys 2012

14

Overview • Verdi Tcl Introduction – Use Tcl in Verdi – Case Study

• VIA Introduction • Debug Tcl Scripts • Labs

© Synopsys 2012

15

Case Study – Verdi Tcl Script Overview

• Script purpose: – This script generates an nWave session file before exiting and loads last session when nWave is invoked. – When select Save and Close Win under File menu on nWave , it generates nWave session file named ".rc" and "AutoSaveSignal.rc" automatically. – If there is a file named "AutoSaveSignal.rc" when invoking nWave, it is loaded automatically.

• Usage: % setenv NOVAS_AUTO_SOURCE AutoSave.tcl % verdi ...

• Output file: .rc AutoSaveSignal.rc © Synopsys 2012

16

Case Study – Verdi Tcl The Script proc AutoSaveSignal {} { global ary

Inherit $ary from GetFileName procedure

if { [file exists "AutoSaveSignal.rc"] } { file rename -force AutoSaveSignal.rc AutoSaveSignal.rc.bak } Check whether the save file already exists, rename if it exists

set wid [wvGetCurrentWindow] set fname $ary($wid)

$fname: get the FSDB name from GetFileName procedure. Note it uses $ary($wid) to get the FSDB name in GetFileName procedure when there are multiple FSDB files

if { $fname != "" } { wvSaveSignal -win $wid "$fname.rc" Save signals to FSDB_name.rc file } Save signals to wvSaveSignal -win $wid "AutoSaveSignal.rc“ AutoSaveSignal.rc file }

wvCloseWindow -win $wid Close current nWave window

© Synopsys 2012

17

Case Study – Verdi Tcl The Script

proc AutoLoadSignal {p1 p2} {

Note: here the p1 and p2 argument will be: $P1: wvCreateWindow $P2: 2a97b46aa8 (the window ID)

if { [file exists "AutoSaveSignal.rc"] } { wvRestoreSignal -win $p2 "AutoSaveSignal.rc" } Restore the AutoSaveSignal.rc file into nWave if the file already exists

qwConfig -type nWave -cmds [list\ {qwAction -name "Save" -text "Save and Close Win“ -tcl {AutoSaveSignal}}\ {qwAddMenuAction -action "Save" -group "File" -before "Reload"} ] } © Synopsys 2012

Create a “Save and Close Win” command under File menu, invoking the command will execute the AutoSaveSignal procedure.

18

Case Study – Verdi Tcl The Script Note: here the p1 and p2 argument will be: P1: wvOpenFSDBFile P2: /verdi/home/allen_shieh/demo/rtl.fsdb

proc GetFileName {p1 p2} { global ary set lname "" set wid [wvGetCurrentWindow] set sid [string last / $p2] set lid [string last . $p2]

Get the window ID for current nWave window $sid: get the index for last “/” in $p2 $lid: get the index for last “.” in $p2

set lname [string range $p2 [incr sid] [incr lid -1]] # puts "$p1 $p2 $lname" set ary($wid) $lname }

To store the fsdb name in $ary array with $wid index

$lname: get the string for fsdb name without “.fsdb”

AddEventCallback [tk appname] AutoLoadSignal wvCreateWindow 1 AddEventCallback [tk appname] GetFileName wvOpenFSDBFile 1 Register callbacks to: 1. Execute procedure AutoLoadSignal when opening nWave window 2. Execute procedure GetFileName when loading FSDB © Synopsys 2012

19

Overview • Verdi Tcl Introduction – Use Tcl in Verdi – Case Study

• Debug Tcl Scripts • Labs

© Synopsys 2012

20

Debug Tcl Scripts The CMD_TRACE Environment Variable

• Set the environment variable CMD_TRACE to 1 for viewing received commands % setenv CMD_TRACE 1 % verdi -play demo_traverse.tcl > tcl_log &

% vi tcl_log

© Synopsys 2012

21

Debug Tcl Scripts Using TclPro Debugger (1/2)

• The TclPro Debugger is not included in Novas package, download the software and get the instruction from: http://www.tcl.tk/software/tclpro/

• Set the path for TclPro Debugger, for example: % set path= ( /tools/TCL/TclPro1.5/linux-ix86/bin $path )

• Invoke Verdi with –prodebug option and load the Tcl script with – play option: % verdi -prodebug -play demo_traverse.tcl

© Synopsys 2012

22

Debug Tcl Scripts Using TclPro Debugger (2/2)

Run until break or EOF Variable values

Click to set break point

Run stops

© Synopsys 2012

Run stops on this line

23

Reference Get Help from Resources •

Novas Command Language:

– /doc/tcl.pdf •

NPI Models:

– /doc/VIA_NPI.pdf •

Useful web sites:

– – – –

Tcl Developer Site: http://www.tcl.tk/ Tcl Tutorials: http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html Tcl Commands: http://www.tcl.tk/man/tcl8.5/TclCmd/contents.htm Tk Commands: http://www.tcl.tk/man/tcl8.5/TkCmd/contents.htm

© Synopsys 2012

24

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF