0% found this document useful (0 votes)
1K views160 pages

SpyGlass TCL Shell Interface

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views160 pages

SpyGlass TCL Shell Interface

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 160

SpyGlass® Tcl Shell

Interface

Version 4.4.1

October 2010

Atrenta, Inc.
2077 Gateway Place, Suite 300
San Jose, California 95110
1-866-ATRENTA (1-866-287-3682)
http://www.atrenta.com

©Copyright 2006-2010 Atrenta, Inc. All rights reserved.


Copyright Information

This document is protected by copyright and distributed under licenses


restricting its use, copying, and distribution. No part of this document
may be reproduced in any form by any means without prior written
authorization of Atrenta and its licensors, if any.

DOCUMENTATION IS PROVIDED “AS IS” AND ALL EXPRESS OR


IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
INCLUDING ANY IMPLIED WARRANTY OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE
EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY
INVALID.

Atrenta, SpyGlass, and Predictive Analysis are registered trademarks of


Atrenta Inc. All other trademarks are the property of their respective
owners.

Printed in the United States of America.


SpyGlass® Tcl Shell Interface
Table of Contents

Preface............................................................................................................................. 7
About This Book .................................................................................................................................7
Contents of This Book ........................................................................................................................7
Typographical Conventions ................................................................................................................8
Syntax Conventions ...........................................................................................................................8

Using the Tcl Shell Interface.........................................................................................11


Overview.................................................................................................................................................11
Project File .............................................................................................................................................12
Invoking the Tcl Shell Interface............................................................................................................13
Specifying Inputs to the sg_shell ........................................................................................................16
Using sg_shell Commands...................................................................................................................17
Using Named and Positional Arguments..........................................................................................17
Properties of Tcl Command Arguments............................................................................................18
Errors and Messages Flagged in sg_shell .......................................................................................21
Startup Files in sg_shell ...................................................................................................................22
Features of sg_shell..............................................................................................................................27
Using the Help Feature ....................................................................................................................28
Using the Tab Completion Feature...................................................................................................28
Capturing stdout and stderr..............................................................................................................29
History Support in sg_shell...............................................................................................................31
Command Logging in sg_shell .........................................................................................................32
Signal Handling in sg_shell ..............................................................................................................32
Using Key Combinations for Performing Actions .............................................................................33
Advanced Editing Features in sg_shell Prompt................................................................................36

SpyGlass Tcl Commands............................................................................................. 45


Overview.................................................................................................................................................45
Session Commands ............................................................................................................................. 46
new_project : Creates a new project ...........................................................................................47
open_project : Opens an existing project ....................................................................................49

Version 4.4.1 October 2010 iii


SpyGlass® Tcl Shell Interface

Table of Contents

save_project : Saves the specified project...................................................................................52


close_project : Closes the currently active project ......................................................................54
current_project : Displays data of the currently loaded project ...................................................56
exit : Quits sg_shell and returns to the Unix shell prompt.............................................................57
set_pref : Sets the specified preference variable to its specified value........................................59
get_pref : Displays the value of the specified preference variable (s) ..........................................61
Design Setup Commands .................................................................................................................... 63
read_file : Reads in the specified file for analysis.........................................................................64
get_file : Displays the names of various types of files added .......................................................67
remove_file : Remove files of the specified type..........................................................................69
set_option : Sets the specified option to the specified value .......................................................72
get_option : Displays value(s) set in the project for the specified option .....................................82
remove_option : Removes or unsets the specified option in the project scope...........................84
link_design : Reads the design to check design read errors .......................................................85
compile_design : Synthesizes the design to check synthesis errors...........................................88
Goal Setup/Run Commands ................................................................................................................ 91
current_methodology :
Selects a methodology................................................................................................92
current_goal : Selects a goal .......................................................................................................94
set_goal_option :
Sets the specified goal option to the specified value ..................................................98
get_goal_option :
Get value(s) in the goal scope for the specified option .............................................104
remove_goal_option :
Removes or unsets the specified option in the goal scope.......................................106
get_run_option :
Gets values for the current run .................................................................................107
set_parameter : Sets the value of the specified parameter........................................................109
get_parameter : Gets the value of the specified parameter set in the current goal ...................113
run_goal : Runs the selected goal..............................................................................................116
Reporting Commands ........................................................................................................................ 117
define_filter : Defines a criteria to filter a set of messages from the set of all generated non-waived
messages..................................................................................................................118

iv October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Table of Contents

define_view : Defines how the selected output should be displayed .........................................123


define_report : Defines a new report of the specified name ......................................................128
write_report : Generates the specified report ............................................................................130
write_aggregate_report :
Used to generate the specified aggregate report .....................................................132
Debug Commands.............................................................................................................................. 134
gui_start : Invokes Atrenta Console...........................................................................................135
help : Displays help for a particular command/item ....................................................................136
Miscellaneous Commands ................................................................................................................ 139
capture : Captures output (stdout/stderr) of script to a file .........................................................140
show_error : Displays the last error that occurred during a particular command invocation along
with its trace..............................................................................................................142
alias : Creates an alias for a group of word(s) ............................................................................143
unalias : Removes an alias set for a group of word(s) ...............................................................145
benchmark : Monitors run-time and memory usage between two designated check points in
sg_shell.....................................................................................................................146

Known Problems and Solutions in Tcl Shell............................................................ 149


Known Problems and Solutions ........................................................................................................149

Appendix ..................................................................................................................... 155


Deprecated Command Names and Their Corresponding New Commands...................................155
Preference Variables Supported by the set_pref Command ...........................................................157
sh_command_log_file : Specifies the path name for sg_shell's command log file...................158

Version 4.4.1 October 2010 v


SpyGlass® Tcl Shell Interface

Table of Contents

vi October 2010 Version 4.4.1


Preface

About This Book


The Atrenta® SpyGlass Tcl Commands Reference describes the details
of the Tcl Shell Interface and various Tcl commands.

Contents of This Book


The SpyGlass Tcl Commands Reference has the following chapters:

Chapter Describes...
Using the Tcl Shell Interface Information on the usage of Tcl shell
interface
SpyGlass Tcl Commands Details of variousTcl commands
Known Problems and Solutions in Tcl The known problems and solutions in the
Shell Tcl Shell

SpyGlass® Tcl Shell Interface 7


SpyGlass® Tcl Shell Interface

Typographical Conventions
This document uses the following typographical conventions:

To indicate Convention Used


Program code OUT = IN;
Signal names OUT
Important Information NOTE: This rule...

Syntax Conventions
This document uses the following syntax conventions for Tcl
commands:

To indicate Convention Used


Command-line argument -arg
Example:
-name <dsgn-name>
Variables that the user Angle brackets, as shown below:
must supply. <var-name>
Example, <design-name> indicates that the user
needs to specify a design name.

8 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Preface

To indicate Convention Used


Optional clauses from Square brackets enclosing the options, as shown
which you can choose below:
one or none. [ <opt-name> ]
Example:
[ -vendor <vendor-name> ]
A choice of two or more Options separated by a vertical bar or pipe, as shown
options when it is below:
required to choose any opt1 | opt2
one option from the given Example:
list.
-input <inPinName> | -output
<outPinName>

Version 4.4.1 October 2010 9


SpyGlass® Tcl Shell Interface

10 October 2010 Version 4.4.1


Using the Tcl Shell
Interface

Overview
The Tool Control Language (Tcl) interface of SpyGlass enables you to interactively
control flow of various stages during a design analysis session. It can be used to
perform a variety of operations such as compiling a design, applying constraints,
configuring tool settings, controlling flow, and/or customizing the reports. The Tcl
interface provides the ability to create scripts for your CAD environment, perform
"what-if" analysis, perform interactive debugging, and facilitate the organization of
complex flow into smaller and logical steps for easy execution.
A typical design analysis session can be divided into the following stages:
1. Design Setup stage
During this stage, you set up the design by adding the design files, precompiled
files, and technology files. In addition, you also specify various design read options
that are used during the SpyGlass run. You can read the design at this stage, fix any
issues reported during design read, and identify and fix blackboxes. This ensures
that the basic design read is clean before proceeding ahead with the detailed
analysis.

SpyGlass® Tcl Shell Interface 11


SpyGlass® Tcl Shell Interface
Project File

2. Goal Setup stage


During this stage, you select various goals. Next, you configure their parameter
values, specify constraints, and ensure that the goal setup is complete. You can then
run the selected goals, and move to the subsequent stage of detailed design debug
based on the information generated at this stage.
3. Analyze Results stage
During this stage, you can perform various operations such as debug violations,
view results in schematic, and cross-probe issues to HDL.
The Tcl interface of SpyGlass (or sg_shell) provides an interactive shell environment
in which you can control various steps of each of the above stages by using various Tcl
commands. This interface enables you to perform easy design read, goal setup, goal
execution, and customized reporting to focus on intended violations.
NOTE: Tcl interface of SpyGlass (or sg_shell) supports Tcl 8.5. Therefore, all the commands
which are part of the Tcl 8.5 can be involked from sg_shell also. To view the help of Tcl 8.5
commands, use the man <tcl-command-name> command.
For example, man llength.

Project File
As part of various stages during a design debug session within SpyGlass Tcl Shell
Interface (or sg_shell), user works on a project. sg_shell requires that you define a
project which captures all of design and goal setup information. As you update the
design data or goal setup information such as constraints and parameters, the project
holds the latest setup information. For example, if you start a project with two design
files (say top.v and mid.v), and then add another design file (say lower.v), but later
remove mid.v, the project would finally store top.v and lower.v.
Project is a store house of the final setup details and allows you to quickly start your
next sg_shell session from the point where you left it in the earlier debug session. The
project file is a Tcl file with appropriate Tcl commands capturing information about
design setup and goal setup till the point last saved by you.
There is already a notion of project in Console, and user is expected to debug session
within an active project, and the same applies to sg_shell also. However, there are

12 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

quite a few changes done in various Tcl commands between earlier project files, and
the ones saved with SpyGlass 4.3.0. sg_shell is fully backward compatible to any
project file created with Console 4.2.0 or 4.2.1. Since there are many commands
changed from earlier releases, you are recommended to open the existing project file
in sg_shell, and immediately save it to get the updated project file with new command
names. Refer to the Deprecated Command Names and Their Corresponding New
Commands to see the old versus new command mapping.
If there are any errors in your project file having old command names, sg_shell reports
the new command names in the error messages instead of old command names as in
the project file.
It is recommended that you open a project in sg_shell, and then update the setup
information, instead of directly updating it in the project file. This would help you to
catch any errors in the setup in an interactive manner.
Some other general information about the project file is listed below:
 It is always better to have project file with .prj extension if manually created so as to
easily identify it. If the project is created inside sg_shell, it is automatically
assigned this extension.
 There is some basic information in the project file, such as projectcwd etc, which is
used internally by the software. Please ensure that you do not tweak this data while
manually editing this file.
 There are Tcl commands to start a new project, open an existing project, save/close
project or query the current project.
 If there are any environment variables used while manually editing a project file,
those environment variables are lost when the project is next saved. Please note
that project file stores the final setup information, and any Tcl specific substitution
or constructs are interpreted and lost while loading the project itself. Therefore,
these are not preserved while saving the project.

Invoking the Tcl Shell Interface


You can invoke the interactive Tcl shell interface by specifying the following
command at the command-line:

Version 4.4.1 October 2010 13


SpyGlass® Tcl Shell Interface
Invoking the Tcl Shell Interface

% sg_shell
NOTE: sg_shell is picked from the same location as spyglass - $SPYGLASS_HOME/bin.
When you specify the above command, SpyGlass displays the sg_shell shell prompt,
as shown below:
+---------------------------------------------------------------------+
| |
| SpyGlass(R) Predictive Analyzer - Version 4.3.0 |
| Last compiled on Sep 14 2009 |
| |
| All Rights Reserved. Use, disclosure or duplication |
| without prior written permission of Atrenta Inc.is prohibited. |
| Technical support:[email protected] or dial 1-866 ATRENTA. |
+---------------------------------------------------------------------+

sg_shell>

Once the above shell prompt appears, you can start the required operations by using
various Tcl commands. As you start typing the Tcl commands, sg_shell records those
commands in a separate Tcl file (sg_shell_command.log) in the current working
directory, which you can use later for regression purpose. If the Tcl file of the same
name (sg_shell_command.log) already exists, sg_shell overwrites it.

Specifying a Tcl File While Invoking Tcl Shell Interface


You can specify a Tcl file (.tcl) while invoking the Tcl Shell interface in the following
manner:
sg_shell < my.tcl
This Tcl file may contain the Tcl commands that are prerecorded in a previous
sg_shell run or are written manually. When you specify a Tcl file, SpyGlass runs
all the Tcl commands specified in the file, and then returns to the unix prompt. The Tcl
file can have any name or extension, but the commands inside it should be Tcl
compatible and supported inside sg_shell.
The output of the invocation mentioned above is the same as when you type each of
the commands mentioned in my.tcl directly on the sg_shell prompt. If there is an
error in any of the commands then that command is ignored, and the execution

14 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

continues with subsequent commands.


This mode is best suited for regression purposes, where you have manually verified
results with a given sequence of Tcl commands, and can then capture these commands
in a playback file for regression purposes.

Specifying a Project File While Invoking Tcl Shell Interface


You can specify a project file (.prj) while invoking the Tcl shell interface in the
following manner:
sg_shell -project myProject.prj
The above command reads the specified project file and loads all the settings specified
in this file before returning to the sg_shell prompt.

Specifying Run Mode While Invoking the Tcl Shell Interface


You can invoke the Tcl Shell interface in 32-bit or 64-bit mode by specifying -32bit
or -64bit options, respectively during the sg_shell invocation. The following
command would start Tcl Shell in 64-bit mode, and then load the specified project.
sg_shell -project myProject.prj -64bit
The default mode for sg_shell is 32-bit mode for 32-bit m/c and 64-bit mode for
64-bit m/c, unless it has been configured differently using the
DEFAULT_EXE_TYPE_ON_64BIT key in the .spyglass.setup file.

Specifying the Tcl Startup file While Invoking the Tcl Shell Interface
You can specify a Tcl startup file while invoking the Tcl Shell interface in the
following manner:
sg_shell -tcl mystartup.tcl
When you specify the above command, sg_shell evaluates the contents of the
mystartup.tcl file as a Tcl script, and then the sg_shell prompt appears. This startup file
can have some alias definitions, procedures, and predefined variables that you want to
use in a given sg_shell session.
If there is any error in this startup file, no further commands from the point of error are
evaluated. However, sg_shell returns to the sg_shell prompt so that you can query
detailed error information. In such situations, apart from querying the error

Version 4.4.1 October 2010 15


SpyGlass® Tcl Shell Interface
Specifying Inputs to the sg_shell

information, the shell is rendered useless (unless you do not worry about the contents
of your startup files).

Specifying Customized Paths While Invoking the Tcl Shell Interface


You can configure the path for picking policy Perl files and Spyso while invoking
sg_shell by using the -I option. For example, the following command picks the policy
data from the <local_path> path, if present; else, it picks it from the installation
path:
sg_shell -project myProject.prj -64bit -I <local_path>
This option is primarily useful if you want to run sg_shell with a policy patch having
some fixes.

Specifying Inputs to the sg_shell


You can specify inputs to the sg_shell in any of the following ways:

By using the echo Command


You can specify a set of commands by using the echo command to the sg_shell in the
following manner:
echo <some-commands> | sg_shell

By using the cat Command


You can specify a set of commands by using the cat command to the sg_shell in the
following manner:
cat <some-commands> | sg_shell

By specifying a Tcl File


You can specify a Tcl file containing a set of input commands to sg_shell in the
following manner:
sg_shell < <file-name>.tcl

16 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

Using sg_shell Commands


sg_shell provides a set of Tcl commands using which you can perform various
operations. While specifying a Tcl command, ensure that you have specified all the
mandatory arguments. If you do not specify the mandatory argument(s), sg_shell flags
an error message. For example, if you do not specify the project name with the
new_project command, sg_shell flags the following error message:
new_project: invalid usage (mandatory options missing, or wrong
combination of options)
Try `new_project -help' for more details.

Similarly, if you specify the name of a Tcl command that does not exist, sg_shell flags
the following message:
invalid command name "<command-name>"
NOTE: You can specify unambiguous abbreviations for the sg_shell commands to be
used on the sg_shell prompt. Therefore, if you type "new", then it'll be unambiguously
expanded to the new_project command.

Using Named and Positional Arguments


A named argument is one which is specified in the <argument> <value> format,
whereas a positional argument is one which is specified only in the <value> format,
that is, it is not bound with any predefined argument name.
Consider the following read_file command:
read_file -type hdl input.v
In the above command, -type is a named argument. Here, the value, hdl, is bound
to the -type argument. However, input.v is a positional argument as it is specified
independent of any predefined argument name.
Therefore, any of the following specifications are equivalent:
read_file -type hdl input.v
read_file input.v -type hdl

Version 4.4.1 October 2010 17


SpyGlass® Tcl Shell Interface
Using sg_shell Commands

Properties of Tcl Command Arguments


Following are the properties of the Tcl command arguments:

Property 1
An argument can accept zero, one, or more values.
Consider the following example:
define_filter -regexp
In the above example, the -regexp argument does not accept any value. Such
arguments can also be considered as boolean switches that are usually used to turn on/
off specific setting(s).
The following example displays different ways of specification in the define_filter
command:
define_filter -name f1 -file f4.v
define_filter -name f1 -file {f1.v f2.v f3.v}
define_filter -name f1 -file "f5.v f6.v f7.v"
define_filter -name f1 -file [list f8.v f9.v]

In the above command, the -file argument can accept only one value. This value
can either be a file name or can be a list.
If it is a list, it should be specified in a particular format (as shown in the above
examples). To reiterate, the format is as follows:
 Enclose multiple values, which are space separated inside curly braces
 Enclose multiple space separated values inside double quotes
 Use Tcl list command with individual values as argument to it. Since we want to
execute this Tcl command, and assign its output to -file argument, it should be
put in square bracket [] as [list <v1> <v2> … <vN>].
If a list value is not specified in the above format, sg_shell considers each element of
the list as a separate value, and thus flags an error. For example, consider the following
command:
define_filter -file f4.v f5.v

18 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

For the above command, sg_shell flags an error as the file names are not specified in a
list format (by using " ", {}, or [list ]). In addition, it takes f4.v as argument to
-file and f5.v becomes a positional argument, and is not considered as part of the
-file argument.
Now consider another example, as shown below:
define_filter -file_line f1.v 25
In the above example, the -file_line argument accepts two values, file name and
line number. However, if you specify the value of this argument as a list containing the
file name and line number, sg_shell flags an error as this argument should be provided
with two separate values. Therefore, sg_shell flags an error in the following case:
define_filter -file {f1.v 25}

Consider another example, as shown below:


define_filter -file_lineblock f2.v 25 99
In the above example, the -file_lineblock argument requires three values, that
is, file name, start line number, and end line number. However, if you specify these
three values as a list, sg_shell would flag an error since a list is considered as one
value. Therefore, sg_shell would flag an error in the following case:
define_filter -file_lineblock "f2.v 25 99"
You can get idea about the number of arguments accepted by each argument of a given
Tcl command by entering:
<tcl-command-name> -help
The above command would display a brief description for each argument with details
of possible values.
Ensure that an argument taking list value versus an argument taking multiple values
are appropriately specified by enclosing list values in "" {} or [list …], while multiple
values are not enclosed in any of these specifiers, but rather kept space separated.

Property 2
Multiple specifications of an argument are either OVERWRITTEN or APPENDED
depending on the type of argument.

Version 4.4.1 October 2010 19


SpyGlass® Tcl Shell Interface
Using sg_shell Commands

If an argument takes single value (scalar type), and you specify multiple specifications
of that argument, sg_shell retains only the last specification. For example, consider the
following command in which the -name argument takes only a single value:
define_filter -name "n1" -file {f1.v f2.v} -name "n2"
In the above command, multiple -name specifications have been specified. In this
case, sg_shell considers only the last -name specification, that is, -name n2.
If an argument takes multiple values (list type) and you have specified multiple
specifications of that argument, sg_shell considers all the values of each argument. For
example, consider the following command in which the -file argument takes
multiple values:
define_filter -file {f1.v f2.v} -name n1 -file [list f3.v f4.v] -
name n2 -file f5.v
In the above command, there are multiple specifications of the -file argument. In
this case, sg_shell would consolidate all the values of the -file argument in a list
and finally consider the list, {f1.v f2.v f3.v f4.v f5.v}, as the value of the
-file argument.

Property 3
Both Property 1 and Property 2 together make it possible to have arguments, which
can accept a list of tuples.
For example, consider the -file_lineblock argument of the define_filter
command for which the first and second property is as follows:
-file_lineblock (Property 1 : Accepts three values)
-file_lineblock (Property 2: Tagged as list type)
Now, consider the following command:
define_filter -file_lineblock f1.v 24 30 -name n1 -file_lineblock
f2.v 9 20
In the above case, the -file_lineblock argument will have the following final
value:
{ {f1.v 24 30} {f2.v 9 20} }
NOTE: In the above example, if the -file_lineblock argument was tagged as scalar

20 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

type, the final value of this argument would have been {f2.v 9 20}.

Property 4
Argument values can have string property.
An argument value can have the string property which means that it should be given a
string value. Further, a string argument can be of scalar or list type accepting single
string value or multiple string values respectively.
You should enclose the string value of an argument in braces ({}). This is done to
prevent the string value from Tcl's built-in backslash/command/variable substitution.
For example, if the value of an argument is a bit vector, U0.data[3], you should
specify this value as {U0.data[3]}. If you do not specify this value in braces, Tcl
would attempt a command substitution and would start looking for a command named
"3".
Consider the -msg argument of the define_filter command:
define_filter -msg {Net 'U0.data[3]}' is not driven}
In the above case, the -msg argument value is of string type, so it should be specified
in the curly braces. Further, if -msg is specified multiple times, then the last value
would be used since it is a scalar type of argument.

Errors and Messages Flagged in sg_shell


sg_shell flags errors in the following cases:
 If you specify the name of a Tcl command that does not exist, sg_shell flags the
following message:
invalid command name "<command-name>"
 If mandatory argument(s) or mandatory combination is missing, an error is flagged,
as shown in the following example:
sg_shell> define_filter
define_filter: invalid usage (mandatory options missing,
or wrong combination of options)|
Try `define_filter -help' for more details.

Version 4.4.1 October 2010 21


SpyGlass® Tcl Shell Interface
Using sg_shell Commands

 If the required number of values are not provided to an argument, an error is


flagged as shown in the following example:
sg_shell> define_filter -file_lineblock f1.v 25 -name n1
define_filter: option '-file_lineblock' requires 3 argument
define_filter: -file_lineblock <file> <start_line> <end_line>
Try `define_filter -help' for more details.
As a corollary, you can use the following to see all the supported options for a
particular command:
sg_shell> define_filter -
define_filter: ambiguous option '-', matches '-name' '-filter'
'-goal' '-du' '-ip' '-file' '-file_line' '-file_lineblock'
'-severity' '-rules' '-msg' '-except' '-weight' '-weight_range'
'-regexp' '-invert'
 If the option is incorrect, an error is flagged, as shown in the following example:
sg_shell> new_project -dir ./output
new_project: unknown option '-dir'
Try `new_project -help' for more details.
 Any extra positional argument is ignored with a message, as shown in the
following example:
sg_shell> current_methodology . p
current_methodology: extra positional argument 'p' - ignored
Info: Current methodology: .
 Few options accept only a pre-defined set of values:
sg_shell> read_file -type hdle f1.v f2.v f3.v
read_file: invalid value 'hdle' for option '-type'
read_file: allowed values are 'verilog vhdl hdl gateslib sglib
lef plib def sgdc waiver sourcelist'

Startup Files in sg_shell


sg_shell provides a sample .sg_shell.startup file with sg_shell installation. This file is
present at the location, $SPYGLASS_HOME/.sg_shell.startup. This file usually contains
some alias definitions, some helpful procedures, etc. Apart from this, you can keep

22 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

your startup files to store your collection of procedures, aliases, or some predefined
variables. Following are some more locations where the startup file can be present:
 $HOME/.sg_shell.startup
 $CWD/.sg_shell.startup
sg_shell searches and evaluates the startup files in the following order:
1. $SPYGLASS_HOME/.sg_shell.startup
2. $HOME/.sg_shell.startup
3. $CWD/.sg_shell.startup
Since CWD file is evaluated in the end, so any definition in this file overrides any
previous definition for the same variable, alias or procedure. These .sg_shell.startup
files should be Tcl files, and are evaluated as any other Tcl script. Therefore, if there is
an exit command in any of these startup files and if the control reaches to that exit
command, sg_shell exits.
You can also implicitly specify a startup file by using the -tcl command-line option
of sg_shell. Therefore, when you specify sg_shell -tcl mystartup.tcl,
sg_shell evaluates the contents of mystartup.tcl as a Tcl script, and then the sg_shell
prompt appears. If there is any error in the startup file, no further commands from that
file are evaluated. In addition, no other startup files are considered (including -tcl
<startupfile> specification). However, sg_shell returns to the sg_shell prompt so that
you can query for detailed error information. In such situations, apart from querying
the error information, the shell is rendered useless (unless you don't worry about the
contents of your startup files).

Error Scenarios and Messages


Whenever there is any error in the startup file, sg_shell tries to publish the error
trace. The trace is usually complete if there is any Tcl specific errors (related to Tcl
built-in commands, etc.). However, if an error is returned from sg_shell specific
commands (such as new_project), the trace is usually an empty string. This is because
the error messages coming from sg_shell commands are not bound to the
interpreter result, and so are not available in the trace. You should not have
sg_shell commands in startup files. Startup files are generally used to store your

Version 4.4.1 October 2010 23


SpyGlass® Tcl Shell Interface
Using sg_shell Commands

custom procedures to achieve some level of automation with your way of using
sg_shell commands.
Following is an example of an error scenario:
[sam@chakra framework_regr]$ sg_shell -32bit
+---------------------------------------------------------------------+
| |
| SpyGlass(R) Predictive Analyzer - Version 4.3.0 |
| Last compiled on Sep 14 2009 |
| |
| All Rights Reserved. Use, disclosure or duplication |
| without prior written permission of Atrenta Inc.is prohibited. |
| Technical support:[email protected] or dial 1-866 ATRENTA. |
+---------------------------------------------------------------------+
|FATAL: errors found in startup file `/u/sam/.sg_shell.startup'
(missing close-brace)
(Use `show_error' for more details)

sg_shell> show_error
Detailed Error Trace
--------------------
missing close-brace
while executing
"proc minus {a} {
return [expr {$a - 5}]
proc verbose {} {
if {$::verbose} { set ::verbose 0 } else { set
::verbose 1 }..."
(file "/u/sam/.sg_shell.startup" line 1)

Specifying a Tcl File as the Startup File


You can specify a Tcl file as the startup file in the following manner:
sg_shell -tcl startup.tcl
The Tcl file can contain procedures, sg_shell commands, etc. The sg_shell commands
enables you to reach to certain level/stage of design analysis, running goal etc., and
then brings you to the sg_shell prompt where you can proceed from where you left in

24 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

this startup file. Therefore, you can have your commands till "run_goal" etc. in this
startup file, and when you use this file with the -tcl option, then the whole file is
evaluated, and the sg_shell prompt appears. On the prompt, once the execution of the
"run_goal" command is complete, you can start browsing the message data base and
create your custom reports, etc.

Error Scenarios and Messages


If there is any error in the startup file, the execution is stopped at that point in the file,
and the sg_shell prompt appears with error trace. Error trace may be empty if error has
occurred in sg_shell command (such as new_project, current_project, etc.). This is
because, as of now, the error messages coming from sg_shell commands are not
bound to interpreter result. A sample error message flagged by sg_shell is shown
below:
+---------------------------------------------------------------------+
| |
| SpyGlass(R) Predictive Analyzer - Version 4.3.0 |
| Last compiled on Sep 14 2009 |
| |
| All Rights Reserved. Use, disclosure or duplication |
| without prior written permission of Atrenta Inc.is prohibited. |
| Technical support:[email protected] or dial 1-866 ATRENTA. |
+---------------------------------------------------------------------+
INFO: executing tcl startup file 'test2.tcl' ...
FATAL: errors found in tcl startup file `test2.tcl'
(invalid command name "detect_filter")
(Use `show_error' for more details)
sg_shell> show_error
Detailed Error Trace
--------------------
invalid command name "detect_filter"
while executing
"detect_filter -goal [list g1 g2 g3] -goal "g4 g5" -goal {g6
g7 g8} -regexp -file pqr.v -file test.v"
(file "test2.tcl" line 1)
sg_shell>

Version 4.4.1 October 2010 25


SpyGlass® Tcl Shell Interface
Using sg_shell Commands

Specifying a Project File as the Startup File


You can specify a project file as the startup file in the following manner:
sg_shell -project ram.prj -projectwdir /u/prj/sam
Specifying a combination of -project and -projectwdir on the command-line
of sg_shell is same as if you are on the sg_shell prompt and you have specified the
open_project -project ram.prj -projectwdir /u/prj/sam
command.
The error trace is shown if there is any error during open_project. The error trace
might be empty if there is an error in the sg_shell commands.

Error Scenario and Error Message


 If project file does not exist, sg_shell displays an error, as shown in the following
example:
+--------------------------------------------------------------------+
| |
| SpyGlass(R) Predictive Analyzer - Version 4.3.0 |
| Last compiled on Sep 14 2009 |
| |
| All Rights Reserved. Use, disclosure or duplication |
| without prior written permission of Atrenta Inc.is prohibited. |
| Technical support:[email protected] or dial 1-866 ATRENTA. |
+--------------------------------------------------------------------+
INFO: reading project file 'something' ...
Error: project file 'something.prj' does not exist
FATAL: errors found in project file `something'
(oops, _empty_error_string_!)
(Use `show_error' for more details)
sg_shell> show_error
Detailed Error Trace
--------------------
while executing
"open_project something -projectwdir ."
sg_shell>
 If there is some error in the project file, sg_shell displays an error, as shown in the
following example:

26 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

+--------------------------------------------------------------------+
| |
| SpyGlass(R) Predictive Analyzer - Version 4.3.0 |
| Last compiled on Sep 14 2009 |
| |
| All Rights Reserved. Use, disclosure or duplication |
| without prior written permission of Atrenta Inc.is prohibited. |
| Technical support:[email protected] or dial 1-866 ATRENTA. |
+--------------------------------------------------------------------+
INFO: reading project file 'something' ...
open_project: error: found errors in project file
'something.prj'
FATAL: errors found in project file `something'
(oops, _empty_error_string_!)
(Use `show_error' for more details)
sg_shell> show_error
Detailed Error Trace
--------------------
while executing
"open_project something"
sg_shell>

Features of sg_shell
This section contains the following topics:
 Using the Help Feature
 Using the Tab Completion Feature
 Capturing stdout and stderr
 History Support in sg_shell
 Command Logging in sg_shell
 Signal Handling in sg_shell
 Using Key Combinations for Performing Actions
 Advanced Editing Features in sg_shell Prompt

Version 4.4.1 October 2010 27


SpyGlass® Tcl Shell Interface
Features of sg_shell

Using the Help Feature


The sg_shell utility provides the help feature in which you can view the help of any
Tcl command and its options. You can use the help feature by specifying the -help
command-line option. For example, if you want to know the details of all the start-up
options of sg_shell, specify the following command:
sg_shell -help
The above command lists all the start-up options (such as -project, -tcl,
-64bit, -32bit, etc.) available with sg_shell and their respective help
description.
Similarly, if you want to view the short help and syntax of a particular Tcl command,
enter the following command on the sg_shell prompt:
<Tcl-command-name> -help
This command also displays the short help of all the arguments of that Tcl command.
In addition, there is a help command in sg_shell, which provides support information
for the following:
 Tcl commands
 Options
 Methodology
 Goals
 Rules
 SGDC commands
 Parameters
 Reports
The details of help command is provided as part of the SpyGlass Tcl Commands
section.

Using the Tab Completion Feature


Currently, Tcl shell interface of SpyGlass supports the following two types of tab

28 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

completions:
 If the first word is being completed, sg_shell first searches for the available
commands (both built-in and sg_shell commands). If matches are available, they
are listed. Otherwise, sg_shell displays the matching file/directory names of the
CWD.
 If second or later word is being completed, file/directory names completion comes
into effect.
NOTE: The tab completion feature does not work if you give spaces and then type something,
and try to do tab completion. Remove any leading spaces, and then tab completion will work as
expected.
sg_shell uses the ? character whenever you specify an incomplete command as per the
Tcl syntax. For example, in the following case, after sg_shell has encountered the
closing brace, the command is considered as complete and that command is executed:
sg_shell> set files { f1.v
? f2.v f3.v
? f4.v
? }
In addition, sg_shell supports tab completion when you have ?. For example, if you
want to see all the files and folders starting with the character f, you can specify the
following:
? f<TAB>
f1.v f2.v f3.v f4.v files_all/

Capturing stdout and stderr


There are the following two ways to capture stdout and stderr:
 By using the redirection operator, >, present in UNIX shells.
The redirection operator is used to redirect messages in the specified file. for
example, if you specify the command, run_goal > output.log, sg_shell
redirects both stdout and stderr messages in the output.log file. Consider another
example, as shown below:

Version 4.4.1 October 2010 29


SpyGlass® Tcl Shell Interface
Features of sg_shell

new_project prj1 -projectwdir ./ > outputfile


The command is actually new_project prj1 -prjoectwdir ./. However,
the output of this command is captured in the file, outputfile.
Consider another command, as shown below:
new_project > prj1
In the above case, the actual command is new_project, and its output is captured in
the file, prj1. The output in this case is an error message related to the invalid
usage of the new_project command.
If the specified output file already exists, sg_shell truncates the existing file without
any warning/info message. However, if the specified file does not exist, sg_shell
creates that file.
sg_shell supports the > operator only for published sg_shell commands such as
new_project, define_project, etc. It does not support this operator for Tcl's
built-in commands (such as list, puts, etc.). Therefore, you cannot specify the
command, puts "help" > outputfile.
In addition, the > command is not supported for user-defined procedures.
Therefore, if you define a procedure, proc hello {} {puts "Hello
there"}, you cannot specify sg_shell> hello > outputfile as this
will not work and would give you a wrong args error.
Following are some error scenarios related to the > command:
 If output file name is missing, an error is flagged, as shown in the following
example:
sg_shell> new_project prj1 -projectwdir ./ >
new_project: error: missing redirect name
 If the > operator is specified multiple times, the first one will be considered, and
the rest occurrences of the > operator will be treated as arguments to the sg_shell
command. However, no error message comes for this type of specification.
 Refer to the the capture command for details on an alternative method to capture
stdout and stderr.

30 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

History Support in sg_shell


You can use the history command on sg_shell, and it will give you a list of
commands that you have already used. This command is applicable only for the
interactive mode. If you write ten commands in a src.tcl file followed by history
command in the src.tcl file, and then specified the command, sg_shell <
src.tcl, the output from history is going to be empty.
The history command is supported by the Tcl installation package itself. Other
features which are usually available on the "tcsh" shell are also available in this history
package. Therefore, you can have the following history substitutions also working in
sg_shell:
 Use "!n", to execute "n th" command from history listing.
 Use "!!", to execute just the previous command.
 You can use modifiers ^oldddd^newwww^ to replace "oldddd" with "newwww"
A sample error message is shown below:
sg_shell> open_project urprj
Error: project file 'urprj.prj' does not exist
sg_shell> ^ur^my^
open_project myprj
Info: Current methodology:
/u/release/spyglass/SPYGLASS_HOME/GuideWare/New_RTL
Info: Starting to load goal
'initial_rtl/lint/connectivity'
Info: Finished loading goal
'initial_rtl/lint/connectivity'
sg_shell>

If you specify the history command, the string literal, such as "!n", will be found, as
against finding the actually substituted command.
If there are any leading or trailing white spaces in any command on the sg_shell
prompt, they will be retained when you use the history command to list them.
NOTE: The leading and trailing white spaces are removed only for up-history/down-history
using arrow keys or other bind keys, so that when you do up-arrow/down-arrow then you get a

Version 4.4.1 October 2010 31


SpyGlass® Tcl Shell Interface
Features of sg_shell

command-line which is free of leading or trailing white spaces.

Command Logging in sg_shell


If there is write permission in the current working directory, a file called
sg_shell_command.log is created and it contains the commands typed by you on the
sg_shell.
If the sg_shell_command.log file already exists, its contents are truncated. However, if it
does not exist, sg_shell creates it if the CWD has write permission. Otherwise,
sg_shell silently skips creation of this file.
Only the commands used in the interactive mode are logged, and commands are
logged irrespective of whether they return error or not.
A sample log file generated is given below:
[sam@chakra framework_regr]$ cat sg_shell_command.log
## This log has been generated by sg_shell:
## On: Fri Jul 10 14:39:20 2009
## By: sam
## Using: Version 4.x.y (Jul 10 2009)
##-------------------------------------------------------

open_project urprj
^ur^my^
quit

Signal Handling in sg_shell


The following points illustrate signal handling in sg_shell:
 CTRL + C signal (SIGINT) is dealt differently in sg_shell. If you are using
sg_shell interactively, that is, working on the sg_shell prompt, CTRL + C signal is
ignored, and nothing will happen.
However, if the sg_shell is running in a non-interactive mode (say through the
command, sg_shell < my_commands.tcl), then using CTRL + C will abort the run.
The generated output/data from sg_shell may be incomplete in such cases, and

32 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

give unpredictable results if later tried to be reused in Console or in later sessions of


sg_shell itself.
 Other signals have been left untouched and they will work as they are today in the
normal SpyGlass flow.
CTRL + Z, however, needs a special mention. If you are on sg_shell prompt,
and you open a file using vim as shown below:
sg_shell> vim output.log
In the above case, you are working in vim and if you press CTRL + Z, this will
suspend the vim session as well as the sg_shell session, and you will return to your
native shell (tcsh etc.).
However, when you do an "fg" or "%" to resume the suspended job, then it should
take you to the vim session (or at least to the sg_shell session). In this case, there is
some known issue and it does not allow you to type anything on the shell, or if you
are able to type in something then that command will not be honoured.
When you are on sg_shell prompt and you press CTRL + Z, then also the sg_shell
session is suspended and you return to your native shell (tcsh etc.). However, on
doing "fg", it should resume your sg_shell session. The sg_shell prompt may
not appear until you type-in some command after doing "fg".

Using Key Combinations for Performing Actions


You can use specific key combinations to perform different actions. Each key
combination issues a specific command, which falls under one of the following
categories:
 Commands for Moving to Specific Locations
 Commands for Manipulating the History
 Commands for Changing Text
 Commands for Killing and Yanking

Version 4.4.1 October 2010 33


SpyGlass® Tcl Shell Interface
Features of sg_shell

Commands for Moving to Specific Locations


Following table lists various commands for moving to specific locations:

Command Purpose
CTRL + a To move to the start of the current line
CTRL + e To move to the end of the line
CTRL + f To move forward a character
CTRL + b To move back a character
CTRL + l To clear the screen leaving the current line at the top of the screen.
ESC + f To move forward to the end of the next word
ESC + b To move back to the start or the previous word.

Commands for Manipulating the History


Following table lists various commands for manipulating history:

Command Purpose
CTRL + p To fetch the previous command from the history list, or moving back in the list
CTRL + n To fetch the next command from the history list or moving forward in the list
CTRL + r To search backward starting at the current line and moving up through the history as
required.
This is an incremental search.

34 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

Commands for Changing Text


Following table lists various commands for changing text:

Command Purpose
CTRL + d To delete the character under the cursor.
If the cursor is at the beginning of the line, or there are no characters in the line, or
the last character typed was not bound to C-d, this command returns EOF.
Rubout To delete the character behind the cursor.
When given a numeric argument, save the deleted text on the kill-ring.
ESC + m To change the current (or the following) to uppercase. With a negative argument, this
command considers the previous word, but does not move the point.
ESC + l To change the current (or the following) to lowercase. With a negative argument, this
command considers the previous word, but does not move the point.

Commands for Killing and Yanking


Following table lists various commands for killing and yanking:

Command Purpose
CTRL + k To kill the text from the current cursor position to the end of the line
CTRL + x To kill backward to the beginning of the line
Rubout
CTRL + u To kill backward from point to the beginning of the line
CTRL + w To kill the word behind the cursor by using white space as a word boundary.
The word boundaries are different from backward-kill-word.
CTRL + y To yank the top of the kill ring into the buffer at the cursor.
ESC + d To kill from the cursor to the end of the current word, or if you are present between
the words then to kill from the cursor to the end of the next word. Word boundaries
are the same as those used by forward-word.
ESC + To kill the word behind the cursor. Word boundaries are the same as those used by
Rubout backward-word.

Version 4.4.1 October 2010 35


SpyGlass® Tcl Shell Interface
Features of sg_shell

Advanced Editing Features in sg_shell Prompt


Editing commands on the sg_shell prompt has been powered by GNU readline
utility. Therefore, all the key bindings and the features, which GNU readline provide,
are also mostly present in sg_shell.
GNU readline provides a startup file, .inputrc, if this file is present in the $HOME
directory. In sg_shell, the contents and customization of .inputrc has been
specifically given the name sg_shell(application name for $if construct of .inputrc).
Therefore, sg_shell has been programmed to read the contents of $HOME/.inputrc,
if present, and pass on this file for initialization by GNU readline.
Consider that some user is already using .inputrc for it other applications, and that user
wishes to have a separate set of settings for sg_shell so that they do not interfere
with other applications using readline. For such purpose, sg_shell provides a
keyword, sg_shell, which can used in .inputrc.
A sample usage is given below:
[sam@chakra framework_regr]$ cat ~/.inputrc
#set completion-query-items 100
#set editing-mode emacs
#set show-all-if-ambiguous on
#set mark-directories on
#set history-preserve-point off

$if sg_shell
# settings specific to sg_shell

# use vi mode in sg_shell


set editing-mode vi

# Completed names which are symbolic links to


# directories have a slash appended.
set mark-symlinked-directories on

# if there are more than 10 possible completions for


# a word, ask the user if he wants to see all of them
set completion-query-items 10

36 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

$endif
For more information, visit "man readline" or "info readline".
Following is a quick key bindings listing:

Key Combination Purpose


Emacs Standard bindings
CTRL + A beginning-of-line
CTRL + B backward-char
CTRL + D delete-char
CTRL + E end-of-line
CTRL + F forward-char
CTRL + G abort
CTRL + H backward-delete-char
CTRL + I complete
CTRL + J accept-line
CTRL + K kill-line
CTRL + L clear-screen
CTRL + M accept-line
CTRL + N next-history
CTRL + P previous-history
CTRL + Q quoted-insert
CTRL + R reverse-search-history
CTRL + S forward-search-history
CTRL + T transpose-chars
CTRL + U unix-line-discard
CTRL + V quoted-insert
CTRL + W unix-word-rubout
CTRL + y yank
CTRL + _ undo

Version 4.4.1 October 2010 37


SpyGlass® Tcl Shell Interface
Features of sg_shell

Key Combination Purpose


" " to "/" self-insert
"0" to "9" self-insert
":" to "~" self-insert
CTRL + ? backward-delete-char
Emacs Meta bindings
ESC + CTRL+ H backward-kill-word
ESC + CTRL+ I tab-insert
ESC + CTRL+ J vi-editing-mode
ESC + CTRL+ M vi-editing-mode
ESC + CTRL+ R revert-line
ESC + CTRL+ Y yank-nth-arg
ESC + CTRL+ [ complete
ESC + & tilde-expand
ESC + -- digit-argument
ESC + 0 digit-argument
ESC + 1 digit-argument
ESC + 2 digit-argument
ESC + 3 digit-argument
ESC + 4 digit-argument
ESC + 5 digit-argument
ESC + 6 digit-argument
ESC + 7 digit-argument
ESC + 8 digit-argument
ESC + 9 digit-argument
ESC + < beginning-of-history
ESC + > end-of-history
ESC + ? possible-completions

38 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

Key Combination Purpose


ESC + B backward-word
ESC + C capitalize-word
ESC + D kill-word
ESC + F forward-word
ESC + L downcase-word
ESC + N non-incremental-forward-search-history
ESC + O arrow-key-prefix
ESC + P non-incremental-reverse-search-history
ESC + R revert-line
ESC + T transpose-words
ESC + U upcase-word
ESC + Y yank-pop
ESC + CTRL + Y yank-nth-arg
ESC + CTRL + ? backward-delete-word
Emacs Control-X bindings
CTRL+X CTRL + G abort
CTRL + X CTRL+ R re-read-init-file
CTRL + X CTRL + U undo
CTRL + X ( start-kbd-macro
CTRL + X ) end-kbd-macro
CTRL + X e call-last-kbd-macro
CTRL + X + ? backward-kill-line
VI Insert Mode functions
CTRL + D vi-eof-maybe
CTRL + H backward-delete-char
CTRL + I complete
CTRL + J accept-line

Version 4.4.1 October 2010 39


SpyGlass® Tcl Shell Interface
Features of sg_shell

Key Combination Purpose


CTRL + K kill-line
CTRL + L clear-screen
CTRL + M accept-line
CTRL + N next-history
CTRL + P previous-history
CTRL + Q quoted-insert
CTRL + R reverse-search-history
CTRL + S forward-search-history
CTRL + T transpose-chars
CTRL + U unix-line-discard
CTRL + V quoted-insert
CTRL + W unix-word-rubout
CTRL + Y yank
CTRL + [ vi-movement-mode
CTRL + self-insert
" " to "~"
CTRL + ? backward-delete-char
VI Command Mode Functions
CTRL + D vi-eof-maybe
CTRL + E emacs-editing-mode
CTRL + G abort
CTRL + H backward-char
CTRL + J accept-line
CTRL + K kill-line
CTRL + L clear-screen
CTRL + M accept-line
CTRL + N next-history

40 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

Key Combination Purpose


CTRL + P previous-history
CTRL + Q quoted-insert
CTRL + R reverse-search-history
CTRL + S forward-search-history
CTRL + T transpose-chars
CTRL + U unix-line-discard
CTRL + V quoted-insert
CTRL + W unix-word-rubout
CTRL + Y yank
CTRL + [ abort
"" forward-char
"#" vi-comment
"$" end-of-line
"%" vi-match
"&" vi-tilde-expand
"*" vi-complete
"+" down-history
"," vi-char-search
"-" previous-history
"." vi-redo
"/" vi-search
"0" beginning-of-line
"1" to "9" vi-arg-digit
";" vi-char-search
"=" vi-complete
"?" vi-search
"@" is undefined

Version 4.4.1 October 2010 41


SpyGlass® Tcl Shell Interface
Features of sg_shell

Key Combination Purpose


"A" vi-append-eol
"B" vi-prev-word
"C" vi-change-to
"D" vi-delete-to
"E" vi-end-word
"F" vi-char-search
"I" vi-insert-beg
"N" vi-search-again
"P" vi-put
"R" vi-replace
"S" vi-subst
"T" vi-char-search
"U" revert-line
"W" vi-next-word
"X" backward-delete-char
"Y" vi-yank-to
"\" vi-complete
"^" vi-first-print
"_" vi-yank-arg
"a" vi-append-mode
"b" vi-prev-word
"c" vi-change-to
"d" vi-delete-to
"e" vi-end-word
"f" vi-char-search
"h" backward-char
"i" vi-insertion-mode

42 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Using the Tcl Shell Interface

Key Combination Purpose


"j" next-history
"k" prev-history
"l" forward-char
"n" vi-search-again
"r" vi-change-char
"s" vi-subst
"t" vi-char-search
"u" undo
"w" vi-next-word
"x" vi-delete
"y" vi-yank-to
"|" vi-column
"~" vi-change-case

Version 4.4.1 October 2010 43


SpyGlass® Tcl Shell Interface
Features of sg_shell

44 October 2010 Version 4.4.1


SpyGlass Tcl Commands

Overview
This chapter describes the Tcl commands currently available in SpyGlass
Tcl Shell Interface (or sg_shell).These commands can be categorized based
on their nature in following groups:
 Session Commands
 Design Setup Commands
 Goal Setup/Run Commands
 Reporting Commands
 Debug Commands
 Miscellaneous Commands

SpyGlass® Tcl Shell Interface 45


SpyGlass® Tcl Shell Interface
Overview

Session Commands
Commands of this group are useful for session management and allow to
encapsulate design/goal setup information inside a user-defined project.
Following are the session commands:

Command Description
new_project Creates a new project
open_project Opens an existing project
save_project Saves the specified project
close_project Closes the currently active project
current_project Displays data of the currently loaded project
exit Quits sg_shell and returns to the unix shell prompt
set_pref Sets the specified preference variable to its specified value
get_pref Displays the value of the specified preference variable (s)

46 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands new_project

new_project Creates a new project


Syntax new_project <project-name>
[ -projectwdir <project-path> ]
[ -force ]

Scope None

Return Value None

Description The new_project command creates a new project with the specified
name.
For design analysis, your first step inside sg_shell should be to create a
project. The project stores design setup information and the goal setup
information, which is defined during an interactive sg_shell session. After
the project is saved, it can be loaded in subsequent sg_shell sessions to start
from where it was left in the earlier session.
As you run various goals inside the given project, sg_shell saves the output
on the disk inside the project working directory. By default, the project
working directory is the same area from where the project file is picked.
However, you can specify a different working directory by using the
-projectwdir argument of this command. Inside the project working
directory, sg_shell creates a directory by the name of the project to store the
output of various runs.
The new_project command fails to execute if some other project is
already open. You should close any existing project by using the
close_project command before executing the new_project command.

Arguments This command has the following arguments:

<project-name>
Specifies the name of the project to be created

Version 4.4.1 October 2010 47


SpyGlass® Tcl Shell Interface
Overview new_project

-projectwdir <project-path>
Specifies the name of the project working directory where the project
output would be created. The same project work directory can be used
for multiple projects. sg_shell creates all its output directories inside
the project directory.
All intermediate directories specified by using the -projectwdir
argument should be already present, else the new_project command
would fail. Also, the output area specified with -projectwdir should
have write permission.

-force
Removes an already existing project (both the project file and the project
directory) and starts a new project with the same name.
NOTE: Be careful while using the -force argument as you may loose any
previous run data.

Example sg_shell> new_project new -projectwdir new_dir


# will create a project file new.prj in cwd
# project output is stored inside new_dir/new

sg_shell> new_project new


new_project: error: please save and close the current
project before opening any new project

sg_shell> new_project new -projectwdir new_dir -force

See Also current_project, open_project, save_project, and close_project

48 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands open_project

open_project Opens an existing project


Syntax open_project <project-name>
[ -projectwdir <project-path>]

Scope None

Return Value None

Description The open_project command opens an existing project. You can use this
command to open any Tcl compliant project file which is saved in an earlier
sg_shell or Console session.
NOTE: Project file created prior to SpyGlass-4.2.0 release is not supported in
sg_shell as it is not Tcl compliant. To make this file Tcl compliant, open that project
file in Console UI 4.2.0 or 4.2.1 and save it.
When you open an existing project in sg_shell, it brings you back to the
same stage in which you last saved it. For example, in your last session, if
you left at the initial_rtl/lint/simulation goal inside the
GuideWare/New_RTL methodology, the open_project command
would restore the same stage and any data relevant for this goal would be
loaded.
In case you have specified link_design as the last command before saving
the project, sg_shell loads the Design_Read goal on opening that project
because Design_Read is the goal associated with the link_design
command.
You can configure the top setting at the time of using the open_project
command by setting an appropriate top using the set_option top
<top-name> command inside the project file. By default, this command
has the last active top at the time of saving the project. You can work on a
different top by changing this command as required.
It is recommended to open the project from the same directory where it was
last saved. This is required to take care of relative path references because
these would become invalid if the project is opened from a different path. If

Version 4.4.1 October 2010 49


SpyGlass® Tcl Shell Interface
Overview open_project

there are relative paths in your project and a message is flagged about
directory mismatch while opening it, you should
1. close the project,
2. change your working directory as suggested in the message, and
3. open it again inside the sg_shell
At the time of opening a project, there could be some messages flagged for
dirty goals (goals having run data which is not consistent with the setup
information). This would happen if you have not saved the project in the
last session after changes being made to the goal setup. It is recommended
to re-run dirty goals as their message database is otherwise out-of-sync with
the saved setup information.
If there are any errors in the project file, the open_project command
fails to execute. Note that some command names in project files have
changed in SpyGlass 4.3.0. Project files generated from SpyGlass 4.2.0 or
4.2.1 are still supported, but if there is any error in these older project files,
the error messages would show the name of the new command name only.
Refer to the Deprecated Command Names and Their Corresponding New
Commands section for details of these command name changes. If you have
an old project file, it is recommended to open it in sg_shell and
immediately save it to get the updated project file with new command
names.

Arguments This command has the following arguments:

<project-name>
Specifies the name of the project file (.prj).

-projectwdir <project-path>
Specifies the project work directory where project run data would be
created. If you do not specify this argument, sg_shell considers the
project work directory as specified in the project file. If no project work
directory is found in the project file, sg_shell considers that
directory where the project file is present.

50 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands open_project

All intermediate directories in the -projectwdir specification should


be already present, otherwise the open_project command would
fail. Also, the output area specified by using the -projectwdir
argument should have write permission.

Example sg_shell> open_project myProject


# opens existing project file - myProject.prj
sg_shell> open_project myProject -projectwdir new_dir
# output is stored inside new_dir/myProject directory

See Also new_project, current_project, save_project, and close_project

Version 4.4.1 October 2010 51


SpyGlass® Tcl Shell Interface
Overview save_project

save_project Saves the specified project


Syntax save_project [ <destination-project-file-name> ]

Scope Project

Return Value None

Description The save_project command saves the active project file. If the active
project file does not have Write permissions, the save_project
command fails to execute. You can specify a destination project file name to
save the current project, else the current project is saved with the same
name as the current project name. The save_project command does not
execute when the leaf level directory of the destination project file provided
does not exist or does not have write permission.
In case a project is saved to a different project file, the current project is
considered as saved only when the project file with which project was
opened does not have Write permissions. Else, the project is considered as
unsaved. When you attempt to close the project or exit the shell without
saving the project, sg_shell prompts you to save the project.

Arguments This command has the following arguments:

<destination-project-file-name>
Specifies the project file name to be saved

Example sg_shell> new_project new


sg_shell> current_methodology $::env(SPYGLASS_HOME)/
GuideWare/New_RTL
sg_shell> read_file test.v
sg_shell> current_goal initial_rtl/lint/structure -top
test
sg_shell> run_goal
sg_shell> close_project
close_project: warning: project still unsaved
Following goals were run but have not been

52 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands save_project

saved
- initial_rtl/lint/structure (Top:
test, Methodology: .)
Run results and settings for these goals
might not match on opening the project
next time
if you still want to close project, specify
close_project -force, or save the project
first
sg_shell> save_project project_copy
# save this project with the name as project_copy.prj
sg_shell> close_project
close_project: warning: project still unsaved
Following goals were run but have not been
saved
- initial_rtl/lint/structure (Top:
test, Methodology: .)
Run results and settings for these goals
might not match on opening the project
next time
if you still want to close project, specify
close_project -force, or save the project
first
sg_shell> save_project
sg_shell> close_project

See Also open_project, current_project, new_project, and close_project

Version 4.4.1 October 2010 53


SpyGlass® Tcl Shell Interface
Overview close_project

close_project Closes the currently active project


Syntax close_project
[ -force ]

Scope Project

Return Value None

Description The close_project command closes the currently active project. If


there are any unsaved changes in the currently active project, this command
prompts you to save those changes before closing the project. In addition, if
there are any goals which were run but not saved, sg_shell informs the same
at the time of closing the project.
You can either save the project by using the save_project command or you
can forcefully close the project without saving the changes by using the
-force argument of this command.

Arguments This command has the following arguments:

-force
(Optional) Closes the project forcefully even if it is not saved. If a project
is closed forcefully, any settings done after the last save are lost. If some
goals have been run but not saved, run results and settings for such goals
might not match on opening the project next time.

Example sg_shell> new_project new


sg_shell> current_methodology $::env(SPYGLASS_HOME)/
GuideWare/New_RTL
sg_shell> read_file test.v
sg_shell> current_goal initial_rtl/lint/connectivity -top
test
sg_shell> run_goal
sg_shell> close_project
close_project: warning: project still unsaved
Following goals were run but have not been saved

54 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands close_project

- initial_rtl/lint/connectivity (Top: test,


Methodology:.)
Run results and settings for
these goals might not match on opening the
project next time
if you still want to close project,
specify close_project -force, or save the
project first
sg_shell> close_project -force

See Also new_project, open_project, save_project, and current_project

Version 4.4.1 October 2010 55


SpyGlass® Tcl Shell Interface
Overview current_project

current_project Displays data of the currently loaded project


Syntax current_project

Scope Project

Return Value Returns <project name> and <project directory> strings in an


array

Description The current_project command displays the name of the currently


loaded project and working directory of that project.

Example sg_shell> open_project myProject.prj -projectwdir new_dir


sg_shell> set prj [ current_project ]
myProject.prj new_dir
sg_shell> set prj_name [ lindex $prj 0 ]
myProject.prj
sg_shell> set prj_dir [ lindex $prj 1 ]
new_dir
sg_shell> puts “Project Name: $prj_name\nProject Directory
: $prj_dir
Currently selected project's info
---------------------------------
Project Name : myProject.prj
Project Directory : new_dir

See Also new_project, open_project, save_project, and close_project

56 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands exit

exit Quits sg_shell and returns to the Unix shell prompt


Syntax exit
[ -save ]
[ -force ]

Scope Any

Return Value None

Description The exit command quits the sg_shell session and returns to the Unix shell
prompt.
If there are any unsaved changes in the currently active project, sg_shell
prompts you to save those changes before closing the session. Further, if
there are any goals which were run but not saved, sg_shell informs the
same at this point. You can either save the project by using the save_project
command or forcefully close the session without saving the changes by
using the -force argument of this command. Optionally, you can specify
the -save argument to save the project while exiting. You will be
prompted if the project could not be saved. At this point, you cannot exit
unless you have specified the -force argument.

Arguments This command has the following arguments:

-save
Saves the current project if it is not saved

-force
Exits sg_shell even if the current project is not saved.

Example
sg_shell> new_project new
sg_shell> current_methodology $::env(SPYGLASS_HOME)/
GuideWare/IP_netlist
sg_shell> set_parameter abc 1

Version 4.4.1 October 2010 57


SpyGlass® Tcl Shell Interface
Overview exit

sg_shell> exit
exit: warning: project `new.prj' is not saved
(Use `save_project' to save it), or
(Use `close_project -force' to close it
forcibly), or (Use `exit -force' to exit
anyway, that is, without saving the project)
sg_shell> exit -save
% ls

sg_shell> new_project new1


sg_shell> current_methodology $::env(SPYGLASS_HOME)/
GuideWare/IP_netlist
sg_shell> set_parameter abc 1
sg_shell> exit
exit: warning: project `new1.prj' is not saved
(Use `save_project' to save it), or
(Use `close_project -force' to close it
forcibly), or (Use `exit -force' to exit
anyway, that is, without saving the project)
sg_shell> exit -force

Seel Also save_project, and close_project

58 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands set_pref

set_pref Sets the specified preference variable to its specified value


Syntax set_pref <variable-name> <value>

Scope Any

Return Value None

Description The set_pref command is used to set the specified preference variable to
the specified value. The effect of the setting done is usually visible
immediately after setting the variable. Though this command can be
specified anywhere, the usual location is in sg_shell's startup file (i.e.,
$HOME/.sg_shell.startup or $CWD/.sg_shell.startup). Usually, the settings done
through set_pref commands are expected to remain for the entire
session of sg_shell, and that's why they make more sense in the startup files.
Currently, sg_shell has only one recognized preference variable, and that is
sh_command_log_file. More preference variables are planned to be added
in the future to provide a greater level of customization. The list of
recognized preference variables can be viewed by using the help -
preferences command. In addition, help for any particular preference
variable can be seen by using help -preferences
<variable_name>. Alternatively, you can enter man
<variable_name> to see the details of a particular preference variable.

Arguments This command has the following arguments:

<variable-name>
Specifies the name of the variable

<variable-value>
Specifies the value of the variable
NOTE: Both, variable-name and variable-value are mandatory.

Example The following example shows how to set the command log file name to a
unique file name.

Version 4.4.1 October 2010 59


SpyGlass® Tcl Shell Interface
Overview set_pref

sg_shell> set_pref sh_command_log_file


"sg_shell_command_[clock seconds].log"
set_pref: info: command log file is now at
'sg_shell_command_1255369133.log'
(Previously, it was at './sg_shell_command.log')
NOTE: The above informational message is going to be specific to each preference
variable.

See Also get_pref, help, and sh_command_log_file

60 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands get_pref

get_pref Displays the value of the specified preference variable (s)


Syntax get_pref <variable-name>

Scope Any

Return Value Returns a list of variable/value pairs

Description The get_pref command is used to display the variable/value pairs for
known preference variables. If the variable_name is not specified, then
variable/value pairs for all those preference variables which have been set
either through the startup file, the sg_shell prompt, or any Tcl source file is
returned in a list. Otherwise, if the variable_name is specified, the
variable/value pair for the specified preference variable is returned in a list.
If a preference variable has not been set by the user, then its default value
(as in the software) is returned as variable/value pair in a list. Currently, the
use of wildcards is not supported in variable_name.

Arguments This command has the following argument:

<variable-name>
Specifies the name of the variable

Example The following example shows how to display the variable/value pairs.
sg_shell> get_pref
sh_command_log_file ./sg_shell_command.log
sg_shell> get_pref sh_command_log_file
sh_command_log_file ./sg_shell_command.log
sg_shell> set_pref sh_command_log_file ./new_file.log
set_pref: info: command log file is now at `./
new_file.log'
(Previously, it was at `./sg_shell_command.log')
sg_shell> set_pref sh_command_log_file ./new_file.log
sg_shell> get_pref
sh_command_log_file ./new_file.log
sg_shell> get_pref sh*

Version 4.4.1 October 2010 61


SpyGlass® Tcl Shell Interface
Overview get_pref

get_pref: warning: 'sh*' is not a recognized preference


variable
sg_shell>

See Also set_pref, help, and sh_command_log_file

62 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands get_pref

Design Setup Commands


Commands under this group allow you to set up the design by providing
design files, libraries, and design options. You can clean-up basic design
read errors by updating the design data using these commands.
Following are the design setup commands:

Command Description
read_file Reads in the specified file for analysis
get_file Displays the names of various type of files added
remove_file Remove files of the specified type
set_option Sets the specified option to the specified value
get_option Displays value(s) set in the project for the specified option
remove_option Removes or unsets the specified option in the project scope
link_design Reads the design to check for design read errors
compile_design Synthesizes the design to check synthesis errors

Version 4.4.1 October 2010 63


SpyGlass® Tcl Shell Interface
Overview read_file

read_file Reads in the specified file for analysis


Syntax read_file
[ -type <file-type> ]
<file-list>

Scope Project, Goal

Return Value None

Description The read_file command reads in the specified file for analysis.
Currently, all files (except the sourcelist type of files) are not read
immediately but rather stored in some object model. These files are read
when you run some goal. Files of the type sourcelist are read at the
time of command execution itself.
All files, except for sgdc files, are applicable to the currently selected
methodology and goal as well as to any methodology or goal that is selected
in future. However, for sgdc files, if you have specified the read_file
command after the current_goal command, sg_shell adds the specified sgdc
file to the currently selected goal only, and not to the other goals. If you
specify the read_file -type sgdc command outside the
current_goal command, sg_shell adds sgdc files to the complete project and
these sgdc files would be applicable to any goal in the current project.

Arguments This command has the following arguments:

-type
Specifies the type of file to be read. This argument accepts any of the
following values:

Type Description
verilog Specifies verilog files
vhdl Specifies vhdl files
def Specifies a def files

64 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands read_file

Type Description
hdl Specifies hdl files (verilog/vhdl/def)
gateslib Specifies gateslib files
sglib Specifies sglib files
lef Specifies lef files
plib Specifies plib files
sgdc Specifies sgdc files
waiver Specifies waiver files
sourcelist Specifies command files.
Only option allowed in the set_option command and file types
allowed in the read_file command are read from the files passed. In
case there is any syntax error in some file (due to error in command
file or some undefined variable in the file), contents of this file are
dropped, and no further files passed in the command are read.

<file-list>
Specifies a space-separated list of file names.
The file paths specified in this argument can be relative or absolute. In
case these are relative, the current sg_shell working directory should
match with the project current working directory at the time of opening
the project. The idea is that all relative paths should be relative to a
single base working directory which is the project's current working
directory.
The following sanity checks are performed on files that are specified in
the read_file command:
1. File should exist
2. File path should not be a directory
3. File should have read permissions for the current user
If any of the sanity checks fail, an error is flagged and the current read_file
command is ignored. Any file that has been already added (or any

Version 4.4.1 October 2010 65


SpyGlass® Tcl Shell Interface
Overview read_file

duplicate entries in current read_file command) will be ignored and a


message will be displayed.

Examples sg_shell> read_file test.v mid.v bot.v


sg_shell> read_file test.vhd
sg_shell> get_file -type hdl
test.v mid.v bot.v test.vhd

sg_shell> read_file -type gateslib cells.lib


sg_shell> get_file -type gateslib
cells.lib

sg_shell> read_file -type sgdc global.sgdc


sg_shell> get_file -type sgdc
global.sgdc
sg_shell> current_goal initial_rtl/lint/structure
sg_shell> read_file -type sgdc local.sgdc
sg_shell> get_file -type sgdc
global.sgdc local.sgdc
sge_shell> current_goal none
sg_shell> get_file -type sgdc
global.sgdc

See Also remove_file and get_file

66 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands get_file

get_file Displays the names of various types of files added


Syntax get_file
-type <type>

Scope Project, Goal

Return Value An array of strings specifying list of files of the specified type

Description The get_file command displays the names of various types of files
added by using the read_file command.
For any file other than the sgdc type of file, the get_file command
displays the names all the files of given type as present in the project, and is
not context sensitive.
After selecting a goal, if you specify the value of the -type argument as
sgdc, sg_shell displays the names of sgdc files that are valid for the
selected goal only. However, when specified outside a goal, sg_shell
displays the names of all the global sgdc files present in the project.

Arguments This command has the following arguments:

-type <type>
Specifies the type of the files to be displayed. You can specify any of the
following values to this argument:
Type Description
hdl Displays all the hdl files (verilog/vhdl/def)
gateslib Displays gateslib files
sglib Displays sglib files
lef Displays lef files
plib Displays plib files
sgdc Displays sgdc files in given scope (project or goal)
waiver Displays waiver files

Version 4.4.1 October 2010 67


SpyGlass® Tcl Shell Interface
Overview get_file

Example
sg_shell> read_file test.v
sg_shell> read_file test1.v
sg_shell> set x [get_file -type hdl]
test.v test1.v
sg_shell> puts $x
test.v test1.v
sg_shell> set y [lindex $x 0]
test.v
sg_shell> puts $y
test.v

sg_shell> read_file -type sgdc g1.sgdc


# global sgdc file
sg_shell> read_file -type sgdc g2.sgdc
# global sgdc file

sg_shell> current_goal initial_rtl/lint/simulation


sg_shell> read_file -type sgdc a.sgdc
# local sgdc file
sg_shell> read_file -type sgdc b.sgdc
# local sgdc file
sg_shell> get_file -type sgdc
g1.sgdc g2.sgdc a.sgdc b.sgdc

sg_shell> remove_file -type sgdc g1.sgdc b.sgdc


# remove global and local sgdc files
sg_shell> get_file -type sgdc
g2.sgdc a.sgdc

See Also read_file and remove_file

68 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands remove_file

remove_file Remove files of the specified type


Syntax remove_file
-type <file-type>
[ <file-list> ]

Scope Project, Goal

Return Value None

Description The remove_file command removes files that have been added earlier
by using the read_file command.
Except for the sgdc type of file, the remove_file command removes all
the files of given type from the project and is not context sensitive.
In case of sgdc type of files, you can optionally provide a list of files
(<file-list>) to be specifically removed and it is context sensitive. If
this command is specified after selecting a goal, sg_shell removes all or
given sgdc files from the selected goal only. However, if this command is
specified outside a goal, sg_shell removes all or the specified sgdc files
from the project and all its goals (sgdc files locally added to specific goals
are not removed).

Arguments This command has the following arguments:

-type <type>
Specifies the type of files to be removed.
Following is the list of file types that can be specified to the -type

Version 4.4.1 October 2010 69


SpyGlass® Tcl Shell Interface
Overview remove_file

argument:

Type Description
hdl Removes all hdl files (Verilog/vhdl/def).
NOTE: You cannot remove individual hdl file types, such as verilog
or vhdl files. The complete HDL file set is removed.
gateslib Removes gateslib files
sglib Removes sglib files
lef Removes lef files
plib Removes plib files
sgdc Removes all or given sgdc files
waiver Removes waiver files

-<file-list>
Specifies list of sgdc files to be removed. List of files is not allowed with
any other file type other than sgdc. You will be informed in case any of
the file specified as part of file-list has not been already added by a
corresponding read_file command.

Example sg_shell> read_file test.v


sg_shell> read_file test.vhd
sg_shell> remove_file -type hdl
sg_shell> read_file test.v
sg_shell> get_file -type hdl
test.v

sg_shell> read_file -type sgdc global1.sgdc


# global sgdc file
sg_shell> read_file -type sgdc global2.sgdc
# global sgdc file
sg_shell> get_file -type sgdc
global1.sgdc global2.sgdc

70 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands remove_file

sg_shell> current_goal initial_rtl/lint/structure


sg_shell> read_file -type sgdc local1.sgdc
# local sgdc file
sg_shell> read_file -type sgdc local2.sgdc
# local sgdc file
sg_shell> get_file -type sgdc
global1.sgdc global2.sgdc local1.sgdc local2.sgdc
# both global and local sgdc files
sg_shell> remove_file -type sgdc global2.sgdc local2.sgdc
# global2.sgdc removed from current goal
sg_shell> get_file -type sgdc
global1.sgdc local1.sgdc

sg_shell> current_goal none


sg_shell> get_file -type sgdc
global1.sgdc global2.sgdc
sg_shell> remove_file -type sgdc
# removes global sgdc files
sg_shell> read_file -type sgdc global3.sgdc
sg_shell> get_file -type sgdc
global3.sgdc

sg_shell> current_goal initial_rtl/lint/structure


sg_shell> get_file -type sgdc
global3.sgdc local1.sgdc

Seel Also read_file and get_file

Version 4.4.1 October 2010 71


SpyGlass® Tcl Shell Interface
Overview set_option

set_option Sets the specified option to the specified value


Syntax set_option <option-name> <value>

Scope Project

Return Value None

Description The set_option command sets the specified option to the specified
value.
The settings specified by this command are applicable for all goals. To set
an option for a particular goal scope, use the set_goal_option command.
The option value can be of the following types:

Type Description
Boolean If the option is of type boolean, the values for that option can be
<true|on|yes|1> which will get evaluated to 'true'. Similarly, the value
<false|off|no|0> will get evaluated to false.
If more than one value is specified for the boolean option, the last
alue would be considered as the final value. You will get a warning
about the multiple values specified in the boolean option.
List If the option is of type list, the values will be appended in the form of
a string list. The option value should be specified in curly braces { }.
String If the option is of type, string, and you specify more than one value
for the given string option, then the last value will be considered as
the final value. You will get a warning about the multiple values
specified in the scalar option.
If the option specified by using the set_option command is already set and
the option is of list type, sg_shell appends the value specified in the
option's value-list. Otherwise, it overwrites the existing option value.
Following sanity checks are performed on value (s) passed before an option
is set:
 Invalid value specified in a boolean option

72 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands set_option

 More than one value specified in a boolean/scalar option


 Invalid enum value specified in an enum type of option
 String type of value specified for integer/float type of option
 Out of range value specified for options that accept a range of values
 More than two values specified for options that accept a pair of values,
such as lib and define_incr_dirmap.
Following File/Directory checks are performed for File/Directory type of
options:
 File/Directory does not exist
 Read/Write permission are not there on the file directory
 File given for Directory or vice-versa
 Directory specified for directory type of option is empty
 File/Directory that has been already added or duplicate entries in value
list are ignored for list type of options
Above checks can be either be of Error or Warning severity. If check is
flagged with Error severity, the current set_goal_option is ignored. Else, the
option will be set as per the values passed in the command.
The remaining sanity checks as done by SpyGlass are performed at the time
of the run_goal command.
You can get the list of options which can be set by using this command by
specifying help -option command. This command provides a list of
options which can be set by using set_option and set_goal_option
commands, respectively. To get man pages for each option in sg_shell,
specify man <option-name> command.
NOTE: An alias name, if available for a particular option, is not displayed in the
corresponding man page or in the list of options displayed by using the help
-option command.

Version 4.4.1 October 2010 73


SpyGlass® Tcl Shell Interface
Overview set_option

The following table lists various options that you can set by using this Tcl
command. The alias name, if available for a particular option, is written in
parentheses.

Option Description
87 Checks the design for IEEE standard 1076-1987
compliance
DEBUG Decompiles debug information about various
stages during a SpyGlass run
I Specifies the directories search path
LICENSEDEBUG Prints license debug information on the screen
addrules Selectively adds a rule in current goal
(addrule)
allow_celldefine_as_top Specifies to perform rule checking on 'celldefine
module top's hierarchy
allow_module_override Allows duplicate module/UDP definitions
cachedir Specifies the directory where library compilation
will be performed
cell_library Skip rule checking on design units loaded from
(cell_libraries) precompiled libraries
check_celldefine Turns on the rule checking on all the 'celldefine
modules
checkdu Specifies the design hierarchy (level) for rule
checking
checkip Specifies the design units for rule checking
define Adds the specified macro definitions
define_incr_dirmap Provides mapping for different locations of RTL
files
designread_synthesis_mode Specifies mode in which synthesis should be
performed
disable_encrypted_hdl_checks Disables RTL rule checking on the encrypted
design units

74 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands set_option

Option Description
disable_hdllibdu_lexical_checks Disallows lexical rule checking on precompiled
libraries
disallow_view_delete Disables the Large Design Processing Mode
dump_all_modes Enable both 32-bit and 64-bit pre-compiled HDL
(dump_all_mode) sources creation
dump_precompile_builtin Saves design parsing builtin messages in
precompile dump
elab_precompile Enables elaboration in single step
precompilation
enableSV Enables parsing of SystemVerilog constructs
enable_const_prop_thru_seq Allows constant propagation beyond sequential
elements during logic simulation
enable_gateslib_autocompile Enables automatic compilation of Synopsys
Liberty™ files (.lib files) to a SpyGlass-
compatible library file form (.sglib files)
enable_hdl_encryption Enables encryption of VHDL/Verilog libraries
during compilation
enable_inactive_rtl_checks Enables semantic checking capability in
(enable_inactive_rtl_check) SpyGlass
enable_pass_exit_codes Causes SpyGlass to print more detailed exit
status codes and messages
enable_pgnetlist Enables power and ground pin information to be
taken into consideration from specified physical
libraries
enable_precompile_vlog Enables the Precompiled Verilog library feature
enable_save_restore Enables the Design Save/Restore feature
enable_save_restore_builtin Restores design parsing, elaboration, and
synthesis messages in restore run
enable_sglib_debug Provides SpyGlass Library Compiler debug
Information

Version 4.4.1 October 2010 75


SpyGlass® Tcl Shell Interface
Overview set_option

Option Description
extractDomainInfo Enables/disables extraction of domain info from
the sdc file during sdc to sgdc translation
force_compile Forces compilation of libhdlfiles
force_gateslib_autocompile Forces autocompilation of Synopsys Synopsys
Liberty™ files (.lib files) to a SpyGlass-
compatible library file form (.sglib files)
handlememory Specified to process memories in an optimized
manner
hdlin_synthesis_off_skip_text Interpret VHDL design code between Synopsys
synthesis_off/synthesis_on pragma pairsas
comments
hdlin_translate_off_skip_text Interpret VHDL design code between Synopsys
translate_off/translate_on pragma pair as
comments
hdllibdu Enables RTL and lexical rule checking on pre-
compiled Verilog/VHDL design units
higher_capacity Disables rules designed for SpyGlass version
3.2.0
ignorelibs Skips the rule checking for modules in the library
(ignorelib) files specified through v/y option
ignorerules Specifies the rule names or rule group names to
(ignorerule) be ignored in rule checking
ignore_undefined_rules Continue after issuing a warning message if an
(ignore_undefined_rule) undefined rule is specified
ignorewaivers Causes SpyGlass to ignore waivers supplied as
(ignorewaiver) embedded SpyGlass Waiver pragmas
incdir Searches the specified path for include files
inferblackbox Infer blackbox module interface based on the
blackbox instances in the synthesized netlist

76 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands set_option

Option Description
inferblackbox_rtl Infers blackbox module interface based on the
blackbox instances in the RTL description in
addition to the synthesized netlist
lang Specify the display language for messages and
waivers
language_mode Specifies language specification to use
lib Defines the logical to physical mapping for
referenced libraries
libext Specifies library file extensions
libhdlf Specifies mapping between specified logical
library and source-files for precompiled library
use
libhdlfiles Specify mapping between specified logical
(libhdlfile) library and HDL files for precompiled library use
libmap Defines the logical to intermediate library
mapping for referenced libraries
lvpr Specifies the maximum number of messages to
report
macro_synthesis_off Turns off the macro SYNTHESIS during design
read. By default, the macro is set on.
mthresh Specifies the bit-count threshold for the
compilation of net/ variables in a design unit
net_osc_count_limit Overrides the oscillation limits for nets. By
default, the oscillation count is set to 100.
nobb Forces SpyGlass to exit without processing if
any blackbox is found in the design
nodefparam Ignores explicit parameter re-definition given by
defparam Verilog construct
noelab Exit after design analysis and without
elaborating the design

Version 4.4.1 October 2010 77


SpyGlass® Tcl Shell Interface
Overview set_option

Option Description
noispy Suppresses the generation of module schematic
data
nopreserve Forces SpyGlass to remove hanging/
unconnected instances and nets
noreport Suppresses report generation
norules Suppresses rule checking
(norule)
nosavepolicy Specifies the policy/policies that should not be
(nosavepolicies) saved during design save
nosch Suppresses the generation of schematic data by
rules
operating_mode Enables setting value of special variable
SG_OPERATING_MODE for SGDC conditional
compilation
overloadrules Overloads the severity or weight of a rule
(overloadrule)
param Sets the new user-specified values of the VHDL
generics and Verilog parameters
perflog Specifies to generate the SpyGlass
performance log
pragma Specifies a prefix-string for synthesis directives
preserve_mux Enables SpyGlass to pick mux cells from the
technology library
print Prints the list of sorted VHDL files
relax_hdl_parsing Performs relaxed VHDL semantic checking
remove_work Deletes the contents of the WORK directory
report Specifies the report format type to be generated
report_incr_messages Enables reporting of incremental messages
report_max_size Specifies the maximum number of messages for
sorted reports

78 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands set_option

Option Description
report_style Enables customization of report format
resetall Resets the Verilog compiler directive
default_nettype to language default which is
wire
rules Specifies the list of rules or rule group names for
(rule) which rule checking should be done
savepolicy Specifies the policy/policies that run during
(savepolicies) design restore
sdc2sgdc Enables the SDC-to-SGDC feature
sdc2sgdc_mode Specifies the mode of the SDC file to be
translated to SGDC
sdc2sgdcfile Specifies the file to save the output of SDC-to-
SGDC translation
sfcu Enables each file to be compiled as a separate
compilation unit
sgsyn_clock_gating Causes SpyGlass to create a simple clock
gating logic instead of creating a MUX-based
enable logic
sgsyn_clock_gating_threshold Specifies threshhold number (default 16) of flip-
flops beyond which SpyGlass creates a simple
clock gating logic
sgsyn_loop_limit Specifies the loop rolling limit during design
synthesis
show_lib Enables generation of messages for each library
module
skip_rules_for_fast_restore Enables skip of design's re-parsing and/or
resynthesis during design restore
sort Sorts & prints the design files before analyzing
sortrule Specifies the sort order for messages in
(sortrules) SpyGlass reports

Version 4.4.1 October 2010 79


SpyGlass® Tcl Shell Interface
Overview set_option

Option Description
stop Skips rule checking on the specified VHDL
design unit or Verilog Module
stopdir Skips rule checking on all design units located in
a specified directory
stopfile Skips rule checking on all design units described
in a specified file
support_sdc_style_escaped_name Enable Synopsys-style escaped names in
SpyGlass Design Constraints files
target Specifies libraries to be used for technology
mapping out of the specified SGLIB libraries
top Specifies top of the design for sg_shell
translateIODelay Enables/disables translation of
set_input_delay/
set_output_delay in the sdc file to the
sgdc file during the sdc to sgdc translation
use_goal_rule_sort Sorts violation messages in SpyGlass reports
based on the order of rules specified in a goal
file
use_scan_flops Enables SpyGlass to pick scan flops from the
(use_scan_flop) technology library
v Specifies the library file used in the source
design
w Turns on generation of warnings for PERL-level
compilation
work Specifies the logical library directory for
compilation of Verilog/VHDL libraries
y Specifies the library directory containing libraries

Arguments This command has the following arguments:

<option-name>
Specifies the name of the option to be set

80 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands set_option

<value>
Specifies the value of the option being set

Example To generate the summary and inline reports, the report option can be set
by using the following command:
sg_shell> set_option report { "summary" "inline" }
To enable System Verilog constructs in verilog files, use the following
command:
sg_shell> set_option enableSV 1

See Also set_goal_option, get_option, get_goal_option, get_run_option,


remove_option, remove_goal_option

Version 4.4.1 October 2010 81


SpyGlass® Tcl Shell Interface
Overview get_option

get_option Displays value(s) set in the project for the specified option
Syntax Usage 1
get_option

Usage 2
get_option <option-name>

Scope Project

Return Value  Usage 1: Returns nothing


 Usage 2: Returns the value set for the specified option, <option-
name>

Description The get_option command displays the value(s) set for the specified
option. In case the option name is not given, sg_shell displays all the
options set in the project scope, otherwise it returns the option value of the
specified option.
If the option value is not set by using the set_option command, sg_shell
displays the default value, if present, for the specified option. If there is no
default value for that option, sg_shell displays an information message on
the screen informing you that the option has not been set. The control is
then returned to the sg_shell prompt. If you specify the wrong option
name, sg_shell displays an error message.

Arguments This command has the following arguments:

<option-name>
Specifies the name of the option whose value needs to be retrieved

Example sg_shell> set_option report { "simple" "drag" }


sg_shell> puts [ get_option report ]
simple drag
sg_shell> set_option report { inline }

82 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands get_option

sg_shell> puts [ get_option report ]


simple drag inline

See Also set_option, set_goal_option, get_goal_option, get_run_option,


remove_option, and remove_goal_option

Version 4.4.1 October 2010 83


SpyGlass® Tcl Shell Interface
Overview remove_option

remove_option Removes or unsets the specified option in the project scope


Syntax remove_option <option-name>

Scope Project

Return Value None

Description The remove_option command removes or unsets the specified option


from project scope. sg_shell does not perform any sanity check on the
specified option name. Therefore, if you provide an incorrect option name,
sg_shell does not prints anything on the screen and returns the control
back to the sg_shell prompt.
To remove an option from the scope of a particular goal, specify the
remove_goal_option command.

Arguments This command has the following arguments:

<option>
Specifies the name of the option that needs to be removed or whose
value is to be unset.

Examples sg_shell> set_option mthresh "abcd"


sg_shell> remove_option mthresh
sg_shell> get_option mthresh
4096

See Also set_option, set_goal_option, get_option, get_goal_option, get_run_option,


and remove_goal_option

84 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands link_design

link_design Reads the design to check design read errors


Syntax Usage 1
link_design -top <top-name>
Usage 2
link_design -alltop
Usage 3
link_design

Scope Methodology

Return Value None

Description The link_design command reads the complete user design as per
design files and options settings. This includes analyzing RTL files and
performing elaboration of the design.
You cannot execute this command in scope of a goal. You first need to
select the current_goal command with none before executing this
command. The link_design command internally invokes the
Design_Read goal and runs it.
You can configure the design hierarchy to be analyzed by using the
link_design command in the following manner:
 If you want to analyze a specific top-level module hierarchy, specify that
top-level module by using the -top argument of this command.
 If your design has multiple top-level modules and you want to analyze
all of them, specify the -alltop argument of this command.
 If you want to focus on a specific top-level module during the current Tcl
session, it is best to set that top-level module by using the set_option
top <top-name> command. After the top-level module is set, the
link_design or current_goal/run_goal commands automatically
work on this top-level module only. Therefore, you need not explicitly
specify this top-level module in each of these commands.

Version 4.4.1 October 2010 85


SpyGlass® Tcl Shell Interface
Overview link_design

 If you want to determine a top-level module in your design in case the


top-level module is not specified by using the set_option top
<top-name> command, use the link_design command.
This command enables you to determine multiple top-level modules in
your design so that you can set one top-level module for subsequent
current_goal commands.
In case there is a single top-level module in the design, it would be
automatically set as a session top-level module once the link_design
command completes. Subsequent link_design or current_goal/
run_goal commands automatically work on this top-level module only,
and you need not have to explicitly specify this top-level module in each
of these commands.
When you have defined an implicit top-level module by using the
set_option top <top-name> command and you want to alter top-
level module settings during a specific link_design operation, you can
specify the -top or -alltop argument, as desired, to work on a top-level
module different from the implicit top-level module or all top-level modules
in the design respectively.
NOTE: You can either analyze a specific top-level module or all the top-level
modules in the design, but not anything in between, such as two top-level modules
if there are ten top-level modules in the design.
You can generate a report after specifying the link_design command to
view the design read messages and fix them before proceeding ahead with
the detailed analysis of your design. It is recommended that you analyze all
the black boxes and provide appropriate models/constraints for them to
have more meaningful goal runs.

Arguments This command has the following arguments:

-top <top-name>
Specifies top-level design modules with which the design needs to be run

86 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands link_design

-alltop
Specifies that the link_design command should be done with all the
top-level design modules in the design
NOTE: You cannot specify the -top and -alltop arguments together.

Example sg_shell> read_file test1.v test2.v


# test1.v has top test1 and test2.v has top test2
sg_shell> link_design -top test1
# run with top test1
sg_shell> set_option -top test2
# set test2 as top for link_design done without
# -top/-alltop
sg_shell> link_design -alltop
# run with both top test1 and test2
sg_shell> link_design
# run with top test2

See Also write_report

Version 4.4.1 October 2010 87


SpyGlass® Tcl Shell Interface
Overview compile_design

compile_design
Synthesizes the design to check synthesis errors
Syntax compile_design
[ -top <top-name> ]
[ -alltop ]

Scope Methodology

Return Value None

Description The compile_design command synthesizes the complete user design as


per the design files and options settings. You cannot execute this command
in scope of a goal. In addition, select current_goal none before
executing this command. The compile_design command internally
invokes the Design_Read goal and runs it.
You can configure the design hierarchy to be synthesized by using the
compile_design command in the following manner:
 If you want to synthesize a specific top-level module hierarchy, specify
that top-level module with -top argument of this command.
 If design has multiple top-level modules and you want to synthesize all
of them, specify the -alltop argument of this command.
 If you want to focus on a specific top-level module during the current Tcl
session, it is best to set that top-level module by using the set_option
top <top_name> command. After the top-level module is set,
compile_design or current_goal/run_goal automatically works on
this top-level module only, and you need not have to explicitly specify
this top-level module in each of these commands.
 If you want to determine a top-level module in your design in case the
top-level module is not specified by using the set_option top
<top-name> command, use the compile_design command.
This command enables you to determine multiple top-level modules in
your design so that you can set one top-level module for subsequent

88 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands compile_design

current_goal commands.
In case there is a single top-level module in the design, it would be
automatically set as a session top-level module once the
compile_design command gets completed. Subsequent
compile_design or current_goal/run_goal commands automatically
work on this top-level module only, and you need not have to explicitly
specify this top-level module in each of these commands.
When you have defined an implicit top-level module using the
set_option top <top_name> command and you want to alter top-
level module settings during a specific compile_design operation, you
can specify the -top or -alltop arguments, as desired, to work on a top-
level module different from the implicit top-level module or all top-level
modules in the design respectively.
NOTE: You can either synthesize a specific top-level module or all top-level
modules in the design, but not anything in between, such as two top-level modules if
there are ten top-level modules in the design.
You can choose the type of synthesis to be performed in
compile_design by using the following command:
set_option designread_synthesis_mode <synthesis_mode>
Depending on the type of synthesis to be performed,
<synthesis_mode> can take one of the following values :
 base: Performs classical synthesis
 opt: Performs optimized synthesis
 techmap: Enables techmapping during synthesis
You can generate a report after specifying the compile_design
command to view the design read messages, and fix them before proceeding
ahead with the detailed analysis of your design. It is recommended that you
analyze all black boxes and provide appropriate models/constraints for them
to have more meaningful goal runs.

Arguments This command has the following arguments:

Version 4.4.1 October 2010 89


SpyGlass® Tcl Shell Interface
Overview compile_design

-top <top-name>
Specifies top-level design modules with which the design needs to be
run.

-alltop
Specifies that the compile_design command should be done with all
top-level design modules in the design.
NOTE: You cannot specify the -top and -alltop arguments together.

Example sg_shell> read_file test1.v test2.v


# test1.v has top test1 and test2.v has top test2
sg_shell> compile_design -top test1
# run with top test1
sg_shell> set_option top test2
# set test2 as top for compile_design done without
# -top/-alltop
sg_shell> compile_design -alltop
# run with both top test1 and test2
sg_shell> compile_design
# run with top test2

See Also write_report

90 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands compile_design

Goal Setup/Run Commands


Commands under this group allow you to configure goal settings such as
parameters and sgdc. You can run the selected goal, and view its messages.
Following are the goal setup/run commands:

Command Description
current_methodology Loads the specified methodology
current_goal Loads the specified goals
set_goal_option Sets the specified goal option to the specified value
get_goal_option Get value(s) in the goal scope for the specified option
remove_goal_option Removes or unsets the specified option in the goal scope
get_run_option Gets values for the current run
set_parameter Sets the value of the specified parameter
get_parameter Gets the value of the specified parameter set in the current goal
run_goal Runs the selected goals

Version 4.4.1 October 2010 91


SpyGlass® Tcl Shell Interface
Overview current_methodology

current_methodology
Selects a methodology
Syntax Usage 1
current_methodology
Usage 2
current_methodology [ <methodology-name> ]

Scope Project

Return Value Usage 1: Returns current selected methodology name


Usage 2: Returns nothing

Description The current_methodology command loads the specified


methodology. If you do not specify the name of the methodology, currently
selected methodology name is returned.
The methodology name specified in this Tcl command should be the
complete path till the top-level directory where various goals are present.
sg_shell automatically selects a default methodology whenever you
start a project. This command can be used to change it.
Use the following help commands to view information regarding
methodologies:
 help -methodology: View the list of available methodologies.
 help -methodology <methodology-name>: View the help of
a particular methodology.
 help -goals: View the list of available goals inside the currently
selected methodology.
 help -goals <goal-name>: View the help of a specific goal.
 write_report goal_summary: View the summary information
about the goals in the currently selected methodology.

Arguments This command has the following arguments:

92 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands current_methodology

<methodology-name>
Specifies the name of the methodology to be loaded

Example sg_shell> new_project new


sg_shell> current_methodology $::env(SPYGLASS_HOME)/
GuideWare/IP_netlist
current_methodology: info: methodology is now
'SPYGLASS_HOME/GuideWare/IP_netlist'

sg_shell> set curr_meth [ current_methodology ]


sg_shell> puts $curr_meth [ current_methodology ]
SPYGLASS_HOME/GuideWare/IP_netlist

See Also current_goal

Version 4.4.1 October 2010 93


SpyGlass® Tcl Shell Interface
Overview current_goal

current_goal Selects a goal


Syntax Usage 1
current_goal <goal_name>
[ -top <top-name> | -alltop ]
Usage 2
current_goal Regression_Run
-goal <goal-list>
[ -top <top-name> | -alltop ]
Usage 3
current_goal none
Usage 4
current_goal

Scope Methodology

Return Value Usage 1, 2, and 3: Returns nothing


Usage 4: Returns an array of selected goals

Description The current_goal command selects a goal to be run by consequent


run_goal command. The selected goal should be a part of the currently
active methodology (methodology currently selected by the
current_methodology command or default methodology in setup file in case
not set explicitly). You can view the help for goals in the currently selected
methodology by using the help -goals <goal-name> command.
If you specify a substring for the complete goal name, sg_shell displays a
list of matching goals from which you can choose the required goal. Any
previously selected goal is deselected when this command is issued.
If you select a goal which has already been run, its message database is
loaded, and you can create/view its report containing messages as reported
while running this goal.
sg_shell provides you the following flavors of the current_goal
specification for different purposes:

94 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands current_goal

 current_goal with specific goal name


This specification enables you to run a specified goal.
 current_goal with Regression_Run
This specification enables you to run multiple goals in a single run_goal
command.
 current_goal with none
This specification enables you to switch to no goal selected mode. This
is useful if you want to set parameter/SGDC applicable for all goals, or
run the link_design command.
 current_goal without any argument
This specification returns the currently selected goals in an array.
The current_goal command fails if none of -top or -alltop
options is specified as well as no session top-level module is set by the
set_option top <top-name> command.
If you have specified the -alltop argument, sg_shell ignores the top-
level module set by using the set_option top <top-name>
command, and the goal is run with all top-level modules in the design. In
case top-level module is specified with -top option, that top-level module
is used for running the goal.
Top-level module specification given with this command (-alltop or -
top) would overrride current session top-level module.
You can get information about rules and their dependent parameters inside
the currently selected goal by using the write_report goal_setup
command. This command dumps a table comprising of rules, their
dependent parameters, and current/default value for each parameter.
If the selected goal has already been run in a previous session and there is a
mismatch between its saved results versus the setup information saved in
the project, a message is flagged while loading this goal. It is recommended
to re-run it by using the run_goal command to ensure that results are
consistent with its saved setup information.

Version 4.4.1 October 2010 95


SpyGlass® Tcl Shell Interface
Overview current_goal

Arguments This command has the following arguments:

-goal <goal-list>
Specifies a list of goals to be run as part of the regression run

-top <top-name>
Specifies the top design unit with which goal needs to be run

-alltop
Specifies that goal should be run with all top-level modules in the design.
This option is specifically helpful if there is already a top-level module
set for the current session by using the set_option top <top-
name> command and if you want to run the given goal with all top-level
modules in the design.
NOTE: The -top and -alltop arguments cannot be specified together.

Example # test1.v has top test1 and test2.v has top test2
sg_shell> read_file test1.v test2.v
# run with top test1
sg_shell> current_goal initial_rtl/lint/connectivity -top
test1
sg_shell> run_goal
# run with both top test1 and test2
sg_shell> current_goal initial_rtl/lint/connectivity
-alltop
sg_shell> run_goal
# session top overriden by -alltop, no session top selected
so current_goal would fail
sg_shell> current_goal initial_rtl/lint/connectivity
# set test2 as top for current_goal specified without -top/
-alltop
sg_shell> set_option top test2
# run with top test2
sg_shell> current_goal initial_rtl/lint/connectivity
sg_shell> run_goal
# inform currently active goal

96 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands current_goal

sg_shell> set goal_sel [ current_goal ]


sg_shell> puts $goal_sel
initial_rtl/lint/connectivity
# run goals initial_rtl/lint/synthesis and initial_rtl/
lint/simulation with top test2
sg_shell> current_goal Regression_Run -goal {initial_rtl/
lint/synthesis initial_rtl/lint/simulation}
sg_shell> run_goal
# inform currently active goal
sg_shell> current_goal
initial_rtl/lint/synthesis initial_rtl/lint/simulation
# deselect currently selected goal and switch to
methodology scope
sg_shell> current_goal none
current_goal: info: removed current goals (sg_shell is now
back to methodology scope)
(selected methodology is '/u/release/spyglass/
SPYGLASS_HOME/GuideWare/New_RTL')
# inform currently active goal i.e. none
sg_shell> current_goal
current_goal: info: no goal is currently selected

See Also run_goal

Version 4.4.1 October 2010 97


SpyGlass® Tcl Shell Interface
Overview set_goal_option

set_goal_option
Sets the specified goal option to the specified value
Syntax set_goal_option <option_name> <value(s)>

Scope Goal

Return Value None

Description The set_goal_option command sets the specified goal option to the
specified value to be used for the current goal.
Before using this command, you must select some goal first. To set an
option, which is not bounded to a goal, use the set_option command.
The option value can be of any of the following types:

Type Description
BOOLEAN If the option is of the type, boolean, the values for the
option can be <true|on|yes|1>, which get evaluated to
true. Similarly, values for this option can be
<false|off|no|0>, which get evaluated to false.
If more than one value is specified for the boolean
option, the last alue would be considered as the final
value. You will get a warning about the multiple values
specified in the boolean option.
LIST If the option is of type, list, the values are appended in
the form of a string list. The option value should be
specified in curly braces { }.
STRING If the option is of type, string, and you specify more than
one value for the given string option, then the last value
will be considered as the final value. You will get a
warning about the multiple values specified in the scalar
option.
If the option specified by the set_goal_option command already
exists and the option is of list type, sg_shell appends the value specified in

98 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands set_goal_option

the option's value-list. Otherwise, it overwrites the existing option value.


Following sanity checks are performed on value (s) passed before an option
is set:
 Invalid value specified in a boolean option
 More than one value specified in a boolean/scalar option
 Invalid enum value specified in an enum type of option
 String type of value specified for integer/float type of option
 Out of range value specified for options that accept a range of values
 More than two values specified for options that accept a pair of values,
such as lib and define_incr_dirmap.
Following File/Directory checks are performed for File/Directory type of
options:
 File/Directory does not exist
 Read/Write permission are not there on the file directory
 File given for Directory or vice-versa
 Directory specified for directory type of option is empty
 File/Directory that has been already added or duplicate entries in value
list are ignored for list type of options
Above checks can be either be of Error or Warning severity. If check is
flagged with Error severity, the current set_goal_option is ignored.
Else, the option will be set as per the values passed in the command.
The remaining sanity checks as done by SpyGlass are performed at the time
of the run_goal command.
You can view the list of options, which can be set using this command, by
using the help -option command. This command provides a list of
options that can be set by using the set_option and set_goal_option
commands, respectively. In addition, you can also view man pages for each
option in sg_shell by using the man <option-name> command.

Version 4.4.1 October 2010 99


SpyGlass® Tcl Shell Interface
Overview set_goal_option

The following table lists various options that you can set by using this Tcl
command:

Option Description
DEBUG Decompiles debug information about various
stages during a SpyGlass run
addrules Selectively adds a rule in Current Goal
cell_library Skip rule checking on design units loaded from
precompiled libraries
check_celldefine Turns on the rule checking on all the 'celldefine'
modules
define_incr_dirmap Provides mapping for different locations of RTL
files
define_severity Defines a user-specified severity label
disable_encrypted_hdl_checks Disables RTL rule checking on the encrypted
design units
disable_hdllibdu_lexical_checks Disallows lexical rule checking on precompiled
libraries
dump_precompile_builtin Saves design parsing builtin messages in
precompile dump
enable_const_prop_thru_seq Allows constant propagation beyond sequential
elements during logic simulation
enable_inactive_rtl_checks Enables semantic checking capability in
SpyGlass
enable_pass_exit_codes Causes SpyGlass to print more detailed exit
status codes and messages
enable_save_restore_builtin Restores design parsing, elaboration, and
synthesis messages in restore run
enable_sglib_debug Provides SpyGlass Library Compiler debug
information
extractDomainInfo Enables/Disables extraction of domain info from
the sdc file during the sdc to sgdc translation

100 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands set_goal_option

Option Description
hdllibdu Enables RTL and lexical rule checking on pre-
compiled Verilog/VHDL design units
ignore_undefined_rules Continue after issuing a warning message if an
undefined rule is specified
ignorelibs Skips the rule checking for modules in the library
files specified through v/y option
ignorerules Specifies the rule names or rule group names to
be ignored in rule checking
ignorewaivers Causes SpyGlass to ignore waivers supplied as
embedded SpyGlass Waiver pragmas
lvpr Specifies the maximum number of messages to
report
net_osc_count_limit Overrides the oscillation count limit for nets. By
default, oscillation count is set to 100
nodefparam Ignores explicit parameter re-definition given by
defparam Verilog construct
noispy Suppresses the generation of module schematic
data
noreport Suppresses report generation
norules Suppresses rule checking
nosch Suppresses the generation of schematic data by
rules
old_vdbfile Specifies path of previous Violation Database
file for consideration in Incremental Mode
operating_mode Enables setting value of special variable
SG_OPERATING_MODE for SGDC
conditional compilation
overload Runs the specified named overloads for all
specified policies
overloadpolicies Runs the specified policies with the overloaded
components

Version 4.4.1 October 2010 101


SpyGlass® Tcl Shell Interface
Overview set_goal_option

Option Description
overloadpolicy Runs the specified policies with the overloaded
components
overloadrules Overloads the severity or weight of a rule
perflog Specifies to generate the SpyGlass
performance log
preserve_mux Enables SpyGlass to pick mux cells from the
technology library
report Specifies the report format type to be generated
report_incr_messages Enables reporting of incremental messages
report_max_size Specifies the maximum number of messages for
sorted reports
report_style Enables customization of report format
rules List of rules or rule group names for which rule
checking should be done
sdc2sgdc Enables the SDC-to-SGDC feature
sdc2sgdc_mode Specifies the mode of the SDC file to be
translated to SGDC
sdc2sgdcfile Specifies the file to save the output of SDC-to-
SGDC translation
sortrule Specifies the sort order for messages in
SpyGlass reports
sgsyn_clock_gating Causes SpyGlass to create a simple clock
gating logic instead of creating a MUX-based
enable logic
sgsyn_clock_gating_threshold Specifies threshhold number (default 16) of flip-
flops beyond which SpyGlass creates a simple
clock gating logic
support_sdc_style_escaped_name Enable Synopsys-style escaped names in
SpyGlass Design Constraints files
target Specifies libraries to be used for technology
mapping out of the specified SGLIB libraries

102 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands set_goal_option

Option Description
translateIODelay Enables/disables translation of
set_input_delay/
set_output_delay in the sdc file to the
sgdc file during the sdc to sgdc translation
use_goal_rule_sort Sorts violation messages in SpyGlass reports
based on the order of rules specified in a goal
file
w Turns on generation of warnings for PERL-level
compilation

Arguments This command has the following arguments:

<option-name>
Specifies the name of the goal option.

<value(s)>
Specifies a space-separated list of values for the goal option.

Example To generate a summary report for the currently selected goal, report option
can be set by using the following command on the sg_shell prompt:
sg_shell> set_goal_option report { "summary" }
To ignore rules W19 and W467 in the currently selected goal, the
ignorerules option can be set as follows:
sg_shell> set_goal_option ignorerules { "W19" "W467" }

See Also set_option, get_option, get_goal_option, get_run_option, remove_option,


and remove_goal_option.

Version 4.4.1 October 2010 103


SpyGlass® Tcl Shell Interface
Overview get_goal_option

get_goal_option
Get value(s) in the goal scope for the specified option
Syntax Usage 1
get_goal_option

Usage 2
get_goal_option <option-name>

Scope Goal

Return Value  Usage 1: Returns nothing


 Usage 2: Returns the value of the specified option

Description The get_goal_option command gets the option value(s) set for the
specified option in current goal. To use this command, some goals must be
selected first. To get option value set at project scope, use the get_option
command. When the <option_name> is not specified, sg_shell
displays all the options set for the current goal scope, otherwise it returns
the value set for the specified option in current goal.
In case the option value is not set by using the set_goal_option command,
sg_shell returns the default value, if present, for the specified option. If the
option does not have a default value, sg_shell does not print anything on
the screen, and returns the control back to the sg_shell prompt. If you
specify the wrong option name, sg_shell displays an error message.

Arguments This command has the following arguments:

<option-name>
Specifies the name of the option whose value needs to be displayed.

Example # To get values of report option set in current goal:


sg_shell> set_goal_option report { simple drag }
sg_shell> puts [ get_goal_option report ]

104 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands get_goal_option

simple drag
sg_shell> set_goal_option report { inline }
sg_shell> puts [ get_goal_option report ]
simple drag inline

See Also set_goal_option, get_option, set_option, get_run_option, remove_option,


remove_goal_option

Version 4.4.1 October 2010 105


SpyGlass® Tcl Shell Interface
Overview remove_goal_option

remove_goal_option
Removes or unsets the specified option in the goal scope
Syntax remove_goal_option <option-name>

Scope Goal

Return Value None

Description The remove_goal_option command removes or unsets the specified


option from the goal scope.
To remove an option from the project scope, use the remove_option
command.
sg_shell does not perform any sanity check on the specified option
name. Therefore, if you specify a wrong option name, sg_shell does not
print anything on the screen and returns the control back to the sg_shell
prompt.

Arguments This command has the following arguments:

<option-name>
Specifies the name of the option.

Example sg_shell> set_goal_option report { drag inline }


sg_shell> get_goal_option report
drag inline
sg_shell> remove_goal_option report
sg_shell> get_goal_option report
sg_shell>

See Also set_goal_option, get_option, set_option, get_goal_option, remove_option,


get_run_option

106 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands get_run_option

get_run_option
Gets values for the current run
Syntax Usage 1
get_run_option

Usage 2
get_run_option <option-name>

Scope Project

Return Value  Usage 1: Returns nothing


 Usage 2: Returns the value of the specified option

Description The get_run_option command gets the option value(s) that would be
used in the current run for the specified option name. When the
<option_name> is not specified, sg_shell displays all the options
and their values that sg_shell would use for the current run, otherwise it
returns the value (s) for the specified option only.
In case the option value is not set by either using the set_option command or
set_goal_option command, sg_shell returns the default value, if present, for
the specified option. However, if the specified option does not have a
default value, sg_shell does not print anything on the screen and returns
the control back to the sg_shell prompt. If you specify the wrong option
name, sg_shell displays an error message.
The get_run_option command combines the results of the get_option
and get_goal_option commands. If an option can be set by using the
set_option/set_goal_option commands only, the result of this command is
identical to that of the get_option/get_goal_option commands respectively.

Arguments This command has the following arguments:

Version 4.4.1 October 2010 107


SpyGlass® Tcl Shell Interface
Overview get_run_option

<option-name>
Specifies the name of the run option whose value(s) is to be retrieved.

Example sg_shell> get_option mthresh


# returns value set by the "set_option" command, since
# nothing is set so far, so empty string is returned
{}

sg_shell> get_run_option mthresh


# returns value as going to be used during run, since
# default for 'mthresh' is 4096, so it is printed
4096

sg_shell> set_option report { inline }


sg_shell> set_goal_option report { drag }
sg_shell> puts [get_option report]
inline
sg_shell> puts [get_goal_option report]
drag
sg_shell> set x [get_run_option report]
inline drag
sg_shell> puts $x
inline drag

See Also set_goal_option, get_option, set_option, get_goal_option, remove_option,


remove_goal_option

108 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands set_parameter

set_parameter Sets the value of the specified parameter


Syntax Usage 1:
set_parameter <param-name> <param-value>

Usage 2:
set_parameter <param-name> -default

Scope Methodology, Goal

Return Value None

Description The set_parameter command sets the value of the specified parameter.
A parameter which is set after selecting a methodology is applicable to all
goals of the selected methodology. A parameter set in methodology scope
can be overridden with a new value after selecting a goal. If the value of the
parameter is changed in goal scope, it does not affect the value of that
parameter in the methodology scope. If a parameter is not set in current
goal, its value is inherited from the methodology scope of the goal.
A parameter may have a default value. You can review the current value
versus the default value for each parameter as part of the report generated
by using the write_report goal_setup command. Alternatively,
you can use the get_parameter ALL command to view this
information. Please note that these commands are valid for goal scope only.
It is recommended to enclose the parameter value in curly braces ({}) so
that any Tcl specific interpretation is not applied on it. Further, the value
should be specified exactly as on SpyGlass command-line. For example,
consider the following command in SpyGlass:
-synchronize_data_cells="sync2sdffcq_f4_d?"
The above command in sg_shell prompt should be specified as follows:
sg_shell> set_parameter synchronize_data_cells
{sync2sdffcq_f4_d?}
If the parameter is boolean, that is, specified with no =<param-value>

Version 4.4.1 October 2010 109


SpyGlass® Tcl Shell Interface
Overview set_parameter

like -strict, then it should be specified with value, 1, as shown below:


sg_shell> set_parameter strict 1
The boolean values (true, on, 1, or yes), which are supported for boolean
option set in set_option/set_goal_option commands, are also supported by
the set_parameter command in sg_shell. When the parameter
value specified is different from the allowed values specified in the
parameter registration (in case the parameter registration restricts allowable
values), the given value is converted to the corresponding true or false
value as specified in the parameter registration. In such a case, save_project
saves the converted parameter value in the project file.
When the project is opened in Atrenta Console, the parameter value
specified in the project file should be one of the allowed values in the
parameter registration.
If a parameter has been set multiple times, sg_shell considers the last set
value and uses that value during the run_goal command.
sg_shell does not perform any sanity checks on the parameter value
when it is set in methodology scope. These checks are performed at the time
of the run_goal command when these parameters are being actually used.
Similarly, no sanity checks are performed if a wrong parameter name is
specified.
However, the following sanity checks are performed when a parameter is
set after selecting a goal:
 Whether parameter specified is registered in the set of policies loaded as
part of the goal that has been loaded
 Whether parameter has been made obsolete
 Invalid enum value specified in an enum type of parameter
 String type of value specified for integer/float type of parameter
 Out of range value specified for parameters that accept a range of values
Following File/Directory checks are performed for File/Directory type of
parameters:
 File/Directory does not exist

110 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands set_parameter

 Read/Write permissions are not there on the file directory


 File given for Directory or vice-versa
 Directory specified for directory type of parameter is empty
The remaining sanity checks as done by SpyGlass are performed at the time
of the run_goal command.
You can view the list of parameters available in the current scope by using
the help -params command. To view the help of a particular parameter,
use the help -params <parameter-name> command.

Arguments This command has the following arguments:

<param-name>
Specifies the name of the parameterto be set

<param-value>
Specifies the value of the parameter

-default
Sets default value for the specified parameter in the goal scope. This
option has no meaning in the methodology scope and is therefore not
allowed in the methodology scope.

Examples sg_shell> new_project new

sg_shell> current_methodology $::env(SPYGLASS_HOME)/


GuideWare/New_RTL
sg_shell> set_parameter clock_reduce_pessimism mux_sel
# sets parameter in methodology scope
sg_shell> get_parameter clock_reduce_pessimism
mux_sel

sg_shell> current_goal initial_rtl/cdc_exhaustive/


cdc_verif_base_strict

Version 4.4.1 October 2010 111


SpyGlass® Tcl Shell Interface
Overview set_parameter

sg_shell> get_parameter clock_reduce_pessimism


# inherits settings from the methodology scope
mux_sel
sg_shell> set_parameter clock_reduce_pessimism latch_en
# overrides parameter value with local goal setting
sg_shell> get_parameter clock_reduce_pessimism
latch_en

sg_shell> current_goal none


sg_shell> get_parameter clock_reduce_pessimism
# value in methodology scope
mux_sel

sg_shell> current_goal initial_rtl/cdc_exhaustive/


cdc_verif_base_strict
sg_shell> get_parameter clock_reduce_pessimism
latch_en
sg_shell> set_parameter clock_reduce_pessimism -default
# default setting as part of goal, which
# is "all" for clock_reduce_pessimism
sg_shell> get_parameter clock_reduce_pessimism
all

sg_shell> current_goal none


sg_shell> get_parameter clock_reduce_pessimism
# value in methodology scope
mux_sel

See Also get_parameter

112 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands get_parameter

get_parameter Gets the value of the specified parameter set in the current goal
Syntax Usage 1
get_parameter

Usage 2
get_parameter <param-name>

Scope Methodology, Goal

Return Value  Usage 1: Returns nothing


 Usage 2: Returns value set for the <param-name> specified

Description The get_parameter command gets the value of the specified parameter
in the current scope (methodology or goal).
In the methodology scope, this command returns parameter value as
applicable to all goals of the methodology. In the goal scope, this command
returns parameter value as applicable to the current goal. If a parameter is
not set in the current goal, its value is inherited from the methodology
scope. If the parameter name is not specified, the get_parameter
command returns the value for all the parameters applicable in current
scope.
In case the parameter value is not set by using the set_parameter command,
sg_shell returns the default value, if present, for the specified parameter.
However, if the parameter does not have a default value, sg_shell does
not print anything on the screen and returns the control back to the
sg_shell prompt. The same thing happens if you specify a wrong
parameter name as there is no sanity check done on the parameter name.
However, a message is printed on the screen when you specify an
unregistered or obsolete parameter after selecting a goal.

Arguments This command has the following arguments:

Version 4.4.1 October 2010 113


SpyGlass® Tcl Shell Interface
Overview get_parameter

<param-name>
Specifies the name of the parameter whose value needs to be retrieved.

Example sg_shell> new_project new


sg_shell> current_methodology $::env(SPYGLASS_HOME)/
GuideWare/New_RTL
sg_shell> set_parameter clock_reduce_pessimism mux_sel
sg_shell> get_parameter clock_reduce_pessimism
mux_sel

sg_shell> current_goal initial_rtl/cdc_exhaustive


/cdc_verif_base_strict
sg_shell> get_parameter clock_reduce_pessimism
# inherits settings from the methodology scope
mux_sel
sg_shell> set_parameter clock_reduce_pessimism latch_en
sg_shell> get_parameter clock_reduce_pessimism
latch_en

sg_shell> current_goal none


sg_shell> get_parameter clock_reduce_pessimism
# value in methodology scope
mux_sel

sg_shell> current_goal initial_rtl/cdc_exhaustive


/cdc_verif_base_strict
sg_shell> get_parameter clock_reduce_pessimism
latch_en
sg_shell> set_parameter clock_reduce_pessimism -default
# default setting as part of goal, which
# is "all" for clock_reduce_pessimism

sg_shell> get_parameter clock_reduce_pessimism


all

sg_shell> current_goal none

114 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands get_parameter

sg_shell> get_parameter clock_reduce_pessimism


# value in methodology scope
mux_sel

See Also set_parameter

Version 4.4.1 October 2010 115


SpyGlass® Tcl Shell Interface
Overview run_goal

run_goal Runs the selected goal


Syntax run_goal

Scope Goal

Return Value None

Description The run_goal command runs the currently selected goal with the
currently selected top. This command runs all the rules as specified in the
goal.
NOTE: By default, the SpyGlass save-restore feature is enabled during
run_goal. To turn off this feature, specify the set_option
enable_save_restore false command. This command turns off the
save-restore feature for the complete project. Therefore, goals will be run with this
feature turned off.
The run_goal command normally prints lots of messages on the screen.
You can re-direct its output to a file by using shell re-direction operator, >,
or capture it in some file by using the capture command.

See Also current_goal

116 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands run_goal

Reporting Commands
Commands under this group allow you to customize the message set, and
generate custom, standard, or policy specific reports.
Following are the reporting commands:

Command Description
define_filter Defines a criteria to filter a set of messages from the set of
all generated non-waived messages
define_view Defines how the selected output should be displayed
define_report Defines a new report of the specified name
write_report Generates the specified report
write_aggregate_report Generates the specified aggregate report

Version 4.4.1 October 2010 117


SpyGlass® Tcl Shell Interface
Overview define_filter

define_filter Defines a criteria to filter a set of messages from the set of all
generated non-waived messages.
Syntax define_filter
-name <filter-name>
[ -filter <filter-list> ]
[ -du <design-unit-list> ]
[ -ip <ip-list> ]
[ -file <file-list> ]
[ -file_line <file> <line> ]
[ -file_lineblock <file> <start-line> <end-line> ]
[ -severity <severity> ]
[ -rules <rules> ]
[ -msg <message> ]
[ -except <list of rules/groups or keywords> ]
[ -weight <weight> ]
[ -weight_range <weight-start> <weight-end> ]
[ -regexp ]
[ -invert ]

Description The define_filter command filters a set of messages from the pool of
all non-waived messages. The filter can be used to define the schema of a
report or used as an input to consequent filter definitions. It enables to
define set of messages that you want to view in a specific report.
If there is no filtering criteria specified and just define_filter -name
<filter-name> is specified, the specified <filter-name> holds all
non-waived messages. Please note that the filtering works on non-waived
messages only. If there are any messages already waived at the time of
run_goal, those are ignored by this command.
This command has many options which are identical to the waive
command. For example, -du, -ip, -file, -file_line, and others
behave in the same manner as in the waive command. The only difference
is that in the define_filter command, these options allow to get the
message list to be viewed, whereas it is opposite in context of the waive
command.

118 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands define_filter

sg_shell does not perform any sanity check on various options of the
define_filter command. Therefore, you should re-check your
specification if there is any mismatch in the filtered set.
NOTE: Most of the arguments of this command are there in the SpyGlass waive
command also. Please refer to the Waiving Messages section in SpyGlass
Predictive Analyzer User Guide for more details.

Arguments This command has the following arguments:

-name <filter-name>
Specifies the name of the filter. If the filter with same is already defined,
it is overwritten by the current definition.

-filter <filter-list>
(Optional) Specifies the name of filters defined earlier by using the
define_filter commands. If you want to start from a filtered set,
this argument accepts those previously defined filter names. If you
specify multiple filter names, union of messages filtered by them is
considered as the starting point for further filtering. All generated
messages are considered if this argument is not specified.

-du <design-unit-list>
(Optional) Specifies space-separated lists of design unit names (module
names for Verilog or architecture names in the format
<entity-name>, for the entity and all its architectures, or in the
<entity-name>.<arch-name> format for the entity and the
specified architecture, package names, or configuration names for
VHDL) or the logical library name of a pre-compiled Verilog/VHDL
library. Use the -du argument to filter the rule messages for the
specified design units or all design units in the specified library. Please
note that messages reported on the specified design units are filtered by
this argument.

Version 4.4.1 October 2010 119


SpyGlass® Tcl Shell Interface
Overview define_filter

-ip <ip-list>
(Optional) Specifies space-separated lists of design unit names (module
names for Verilog or architecture names in the <entity-name>
format, for the entity and all its architectures, and in the
<entity-name>.<arch-name> format for the entity and the
specified architecture, package names, or configuration names for
VHDL) or the logical library name of a pre-compiled Verilog/VHDL
library. Use the -ip argument to filter the rule messages for the
specified design units (IP blocks) or all design units in the specified IP
library.

-file <file-list>
(Optional) Specifies a space-separated list of source file names. Use this
argument to filter all messages for the specified files.

-file_line <file> <line>


(Optional) Specifies a space-separated pair of source file name and line
number. Use this argument to filter the rule messages for a particular line
of a source file.

-file_lineblock <file> <start-line> <end-line>


(Optional) Specifies a space-separated tuple of source file name, start
line number, and end line number. Use this argument to filter the rule
messages for a block of lines in a source file.

-severity <severity>
(Optional) Specifies the actual severity-label or severity class.

-rules <rules>
(Optional) Specifies a space-separated list of rule names, rule group
names, or policy mnemonics. Use this argument to filter messages of the
specified rules, rule groups, policies or by rule type keywords. Following
are allowed keywords:

120 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands define_filter

 ALL
 ALL_INFO
 ALL_ELAB
 ALL_SYNTHERR
 ALL_SYNTHWRN
 ALL_WRN

-msg <message>
(Optional) Specifies the actual rule message. Use this argument to filter a
message. You should specify the message in this argument in curly
braces {} to prevent any Tcl interpretation being applied on it. For
example, a bit-select, top.i1.n1[0], would be taken as command
"0", therefore, always enclose your message in {} for it to read
verbatim.

-except <rule-list>
(Optional) Specifies a space-separated list of rule names, rule group
names, or policy mnemonics. Use this argument to exclude messages of
the specified rules, rule groups, or policies or by rule type keywords
from the filtered set. The allowed keywords are same as in -rules
argument.

-weight <weight>
(Optional) Specifies the actual rule weight value. Use this argument to
filter the messages of the rules with the specified weight.

-weight_range <weight-start> <weight-end>


(Optional) Specifies a weight range for message filtering. Use this
argument to filter messages of the rules with the weight within the
specified range (both range values inclusive).

Version 4.4.1 October 2010 121


SpyGlass® Tcl Shell Interface
Overview define_filter

-regexp
(Optional) Turns on regular expression matching for various fields. This
argument allows the use of regular expressions in many other arguments,
such as -du, -ip, -file, -file_line, -file_lineblock, and
-msg.

-invert
(Optional) Inverts the filtered selection. If the complete message set is
100 messages and set without -invert has 20 messages there would be
remaining 80 messages in the filtered set if the -invert argument is
specified.

Example sg_shell> define_filter -name f1 -msg {q/Module clcell is


a top level design unit/} -regexp
sg_shell> define_filter -name f2 -msg {m/Module clcell is
a top level.*/} -regexp
sg_shell> define_filter -name f3 -du {cl.* sr.*} -regexp
sg_shell> define_filter -name f4 -severity {warning info}
-except {DetectTopDesignUnits checkSGDC_01}
sg_shell> define_filter -name f5 -file_lineblock test.v 3
5 -file_lineblock test4.v 1 22 -file_lineblock a bc.v 4 5
sg_shell> define_filter -name f6 -file_line test4.v 22
-file_line test4.v 4
sg_shell> define_filter -name f7 -weight 2
sg_shell> define_filter -name f8 -weight_range 2 10
sg_shell> define_filter -name f9 -filter {f6 f8}
# union of messages filtered by filters f6 & f8

See Also define_view, define_report, and write_report

122 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands define_view

define_view Defines how the selected output should be displayed


Syntax define_view
-name <view-name>
[ -header <header-string> ]
[ -filter <filter-name> ]
[ -display <field-list> ]
[ -sort <field-list> ]
[ -group <field-list> ]

Scope Any

Return Value None

Description The define_view command defines the sorting and grouping criteria for
a set of messages selected by the specified filter. This command also defines
the fields to be displayed.

Arguments This command has the following arguments:

-name <view-name>
Specifies the name of the view. This name is then later used by the
define_report command. If the view with the same name is already
defined, it is overwritten by the current definition.

-header <header-string>
Specifies the header string of the view being created.

-filter <filter-name>
Specifies the name of the filter as created by using the define_filter
command. Messages filtered by the specified filter are part of the current
view. If you do not specify this argument, all messages are considered as
part of current view.

Version 4.4.1 October 2010 123


SpyGlass® Tcl Shell Interface
Overview define_view

-display <fields-list>
Specifies the list of fields to be displayed. Following are the allowed
values:
 policy
 rule
 alias
 severityclass
 severitylabel
 weight
 file
 line
 message
 du
The fields are displayed in the order specified in this argument. If you do
not specify this argument, sg_shell consider the default value as the
following:
1. rule
2. alias
3. severitylabel
4. file
5. line
6. weight
7. message
If there is a grouping criteria specified, you can skip displaying those
fields, as all the messages of a group would have same values for these
grouped fields. In addition, these grouped field values are also displayed
as part of the group header.

124 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands define_view

-sort <fields-list>
(Optional) Specifies the list of fields on the basis of which the output is
sorted. Following are the allowed values:
 message_id
 builtin
 policy
 rulegroup
 rule
 alias
 severityclass
 severitylabel
 weight
 file
 line
 message
 du
By default, sg_shell does no sorting on the messages. For string values,
sorting is done alphabetically ascending (in case-sensitive manner),
whereas it is numerically ascending for numeric fields. However, for
numeric field - weight, sorting is done in descending order of weight. In
case of sorting based on severityclass, the order is FATAL, ERROR,
WARNING, and INFO. This difference is there for weight and
severityclass, so that more severe messages come on the top after
sorting.
If there is grouping done on any of the above fields, you can skip that
field in the sorting criteria, since all messages of any group would have
same value for that field.

Version 4.4.1 October 2010 125


SpyGlass® Tcl Shell Interface
Overview define_view

-group <fields-list>
(Optional) Specifies the list of fields on the basis of which grouping is
required. Following are the allowed values:
 builtin
 policy
 rulegroup
 rule
 alias
 severityclass
 severitylabel
 weight
 file
 line
 message
 du
 goal
The filtered messages are first grouped as per the grouping criteria and
then each group is sorted as per the sorting criteria. If grouping is done
based on multiple fields then each group has messages where those
multiple fields have the same value for all messages. Further, each group
has a header containing the grouped fields values for the current group.

Example sg_shell> define_view -name v1 -filter f1 -display "rule


policy severitylabel message" -header "DISPLAY: rule
policy severitylabel message"
# display specified fields for messages in 'f1' filter

sg_shell> define_view -name v2 -filter f1 -display "rule


policy severityclass message" -sort "severityclass"
-header "SORT: severityclass"

126 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands define_view

# sort messages in 'f1' filter as per severityclass

sg_shell> define_view -name v3 -filter f2 -display "rule


policy severityclass message" -group "severityclass"
-header "GROUP: severityclass"
# group messages in 'f2' filter as per severityclass

sg_shell> define_view -name v4 -display "rule policy


severityclass message" -group "severityclass"
-header "GROUP: severityclass"
# group all messages as per severityclass

See Also define_filter, define_report, write_report

Version 4.4.1 October 2010 127


SpyGlass® Tcl Shell Interface
Overview define_report

define_report Defines a new report of the specified name


Syntax define_report
-name <report-name>
-view <view-list>
[ -helpfile <help-file> ]

Scope Any

Return Value None

Description The define_report command defines a new report of the specified


name.
This report is basically an aggregation of the specified views. You can
define your custom report by performing the following steps:
1. Define filter commands to isolate message set that you want to capture
in the final report. You can specify multiple define_filter commands to
achieve the final objective.
2. Once the filtered set is defined, you can create a layout for it by using
the define_view command.
3. Finally, you can hook-up various views in a single report by using the
define_report command.
You can optionally pass the path of the help file by using the -helpfile
option which is displayed by using the help -report
<report-name> command.
It is recommended to have complete report specification including
define_filter, define_view, and define_report in a separate Tcl file,
which can be sourced as desired to define the report schema, and then
generate this report for different projects.

Arguments This command has the following arguments:

128 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands define_report

-name <report-name>
Specifies the name of the report. If the report with same name is already
defined, it is overwritten with the current definition.

-view <view-list>
Specifies a list of view names as defined by the define_view command.
You should have previously defined the view names listed here by using
the define_view command.

-helpfile <help-file>
Specifies the name of the help file containing the help of the report.

Example sg_shell> define_report -name my_report -view v1


# defines report 'my_report' using 'v1' view
sg_shell> define_report -name onlyFiltered -view v2 -
helpfile ./helpOnlyFiltered

See Also define_filter, define_view, write_report

Version 4.4.1 October 2010 129


SpyGlass® Tcl Shell Interface
Overview write_report

write_report Generates the specified report


Syntax write_report <report-name>

Scope Goal

Return Value None

Description The write_report command generates the specified report. By default,


the report is displayed on the screen. You can optionally re-direct the output
of the report to any file by using shell re-direction operator, >, or capture
that report it in some file by using the capture command.
The report name specified by using the write_report command can be
any of the following:
1. SpyGlass standard report, such as moresimple, simple, waiver, etc.
2. Policy report, such as Audit-Structure, CDC-report, CKSync01, etc.
3. Any custom report defined by using the define_report command
4. The goal_summary report that has information about all goals in the
currently selected methodology
5. The goal_setup report that has information about rules and their
parameters in the currently selected goal
NOTE: The waived messages are not shown in any report except for the waiver
report. Further, waivers are applied at the time of the run_goal command. Therefore,
if you change waivers and regenerate the report, the waived messages would still
appear in the report unless you issue the run_goal command again.
You can view the list of all the reports available in the current scope by
using the help -report command. For example, goal_setup is available
in goal scope only.

Example sg_shell> write_report goal_summary


# methodology goal summary report

sg_shell> current_goal initial_rtl/clock_reset_integrity/

130 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands write_report

clock_reset_integrity
sg_shell> write_report goal_setup
# goal setup report

sg_shell> write_report summary > summary.rpt


# standard report
sg_shell> capture moresimple.rpt {write_report moresimple}

sg_shell> write_report onlyFiltered


# custom report defined using define_report

sg_shell> write_report Clock-Reset-Detail


# policy specific report

See Also define_filter, define_view, and define_report

Version 4.4.1 October 2010 131


SpyGlass® Tcl Shell Interface
Overview write_aggregate_report

write_aggregate_report
Used to generate the specified aggregate report
Syntax write_aggregate_report <report_name>
[-config_file <file_path>]
[-reportdir <output_directory>]

Scope Any

Return Value None

Description The write_aggregate_report command generates the specified


aggregate report.
The report name specified in the write_aggregate_report
command can be one of the following:
 project_summary
 datasheet
 dashboard

Arguments This command has the following arguments:

-config_file <config_file>
Specifies a configuration file having project files path for which the
aggregate report needs to be generated. If this argument is not specified,
then by default, the aggregate report is generated for the current project.
An error is displayed if you specifiy this argument when there is no current
active project.

-reportdir <output directory>


The user can optionally redirect generated reports to a directory specified
with this argument. By default, the report is generated in the
'./aggregate_reports' directory. If the output directory is already present, it is
overwritten. In addition, if this output directory is not present then only the

132 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands write_aggregate_report

leaf level directory is created.

Example # generate the 'datasheet' report for the current project -


'project1.prj'
sg_shell> open_project project1.prj
sg_shell> write_aggregate_report datasheet

# generate the 'project_summary' report in the 'myreport'


directory for the current project - 'project1.prj'
sg_shell> write_aggregate_report project_summary -
reportdir myreport

Version 4.4.1 October 2010 133


SpyGlass® Tcl Shell Interface
Overview write_aggregate_report

Debug Commands
Commands under this group allow you to debug messages. Currently, you
can open the Console UI to debug messages via schematic, waveform etc.
Following are the debug commands:

Command Description
gui_start Invokes SpyGlass Console
help Displays help for a particular command/item

134 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands gui_start

gui_start Invokes Atrenta Console


Syntax gui_start
[ -force ]

Scope Any

Return Value None

Description The gui_start command invokes Atrenta Console with the currently
active project. This command allows you to go back and forth between the
shell environment and the GUI interface to interactively debug design
issues.
Before launching GUI, current project is saved and closed. If project could
not be saved, this command fails to execute unless you specify the -force
argument. After you exit Console GUI, sg_shell reloads the last active
project at the time of launching GUI. If there are any changes done in the
GUI environment and saved at the time of GUI exit, those changes are
visible when control comes back to the sg_shell prompt.
You can debug messages inside the GUI environment via schematic,
waveform etc., update project settings/fix RTL to resolve these messages,
and come back to the sg_shell prompt once the debugging is over.

Arguments This command has the following arguments:

-force
(Optional) Closes the current project and starts GUI even if the project
was not saved successfully.

Version 4.4.1 October 2010 135


SpyGlass® Tcl Shell Interface
Overview help

help Displays help for a particular command/item


Syntax help
[ -verbose ]
[ -list ]
[ -methodology | -goals | -rules | -params | -sgdc
| -reports | -options | -preferences ]
[ <pattern> ]

Scope Any

Return Value All the invocations, when done without a pattern but by using the -list
argument, sg_shell returns an array of strings specifying the available
values for the requested category (such as goals and methodology).

Description The help command displays the help for a particular command/item. This
command is like the usual shell's help command. It is used to know the
usage of any sg_shell command/item. The help command can be used
for any of the following purposes:
 To show the list of commands under help
 To show the usage of a particular command
 To show the list of methodologies available
 To show the help of a particular methodology
 To show the list of goals available
 To show the help of a particular goal
 To show the list of rules available
 To show the help of a particular rule
 To show the list of parameters in current scope
 To show the help of a particular parameter
 To show the list of constraints in current scope
 To show the help of a particular constraint

136 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands help

 To show the list of reports available in current scope


 To show the help of a particular report
 To show the list of options in current scope
 To show the help of a particular option
 To show the list of recognized preference variables and help for any
particular preference variable(s)
Different Ways of Using the help Command
Following are the different ways to use the help command:
 If you specify the help command without specifying any arguments, all
the sg_shell specific commands are displayed.
 If you specify the help <command-pattern> command, sg_shell
displays the help of all the commands matching the specified pattern.
 If you specify the command, <command-name> -help, sg_shell
displays the help of the specified command.
Other than the above ways, you can also invoke the help command in the
following ways:
 help [-list] -methodology [meth_pattern]
 help [-list] -goals [goal_pattern]
 help [-list] -rules [rule_pattern]
 help [-list] -params [param_pattern]
 help [-list] -sgdc [sgdc_pattern]
 help [-list] -reports [report_pattern]
 help [-list] -options [option_pattern]
 help [-list] -preferences [variable_pattern]

Example
sg_shell> help new_project
new_project # starts a new project

Version 4.4.1 October 2010 137


SpyGlass® Tcl Shell Interface
Overview help

Usage:
new_project <prj_name> [-projectwdir <path>] [-force]

sg_shell> help -verbose new_project


new_project # starts a new project

Usage:
new_project <prj_name> [-projectwdir <path>] [-force]
Options:
-force # do not ask user for confirmation
-projectwdir <path> # directory to store all the project
related data
<project> # project file name for the new project

sg_shell> current_goal rtl_handoff/dft_readiness/


dft_latches
sg_shell> help -rules TA_*

-- shows help for rules TA_01,TA_02,TA_06,TA_07,TA_08

138 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands help

Miscellaneous Commands
This section lists miscellaneous commands related to shell features.
Following are the miscellaneous commands:

Command Description
capture Captures output (stdout/stderr) of script to a file
show_error Displays the last error that occurred during a particular command
invocation along with its trace
alias Creates an alias for a group of word(s)
unalias Removes an alias set for a group of word(s)
benchmark Monitors run-time and memory usage between two designated check
points in sg_shell

Version 4.4.1 October 2010 139


SpyGlass® Tcl Shell Interface
Overview capture

capture Captures output (stdout/stderr) of script to a file


Syntax capture
[ -stdout ] [ -stderr ] [ -append ]
<output-file>
<command-string>

Scope Any

Return Value None

Description The capture command redirects the output (stdout/stderr) of the specified
command, <command-string>, to the specified output file,
<output-file>. Here, <command-string> must be provided in
curly braces {}.
If there is any error generated by a command, that error is also captured in
the specified file depending on whether error is flagged on stdout/stderr.
The capture command is useful to store the output of commands
generating voluminous output, such as the link_design, run_goal, and
write_report commands.

Arguments This command has the following arguments:

-stdout
(Optional) Redirects stdout to the specified output file.

-stderr
(Optional) Redirects stderr to the specified output file.

-append
(Optional) Appends the output to the specified output file. If the
specified output file does not exist, sg_shell creates that output file.

140 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands capture

<output-file>
Specifies the output file in which the output is to be stored.

<command-string>
Specifies one or more command strings.

Example sg_shell> capture -stdout output.log {link_design}


In the above example, only stdout (default) part of the output from
link_design is captured and written into output.log. If output.log exists, the
content of the file is overwritten. If output.log does not exist, it will be
created. Nothing is returned.
sg_shell> capture -stderr output.log {link_design}
In the above example, only stderr part of the output from link_design is
captured and written into output.log. If output.log exists, the content of the file
is overwritten. If output.log does not exist, it will be created. Nothing is
returned.
sg_shell> capture -stdout -stderr output.log {link_design}
In the above example, both stdout and stderr parts of the output from
link_design is captured and written into output.log. If output.log exists, the
content of the file is overwritten. If output.log does not exist, it will be
created. Nothing is returned.
sg_shell> capture -append -stdout output.log {link_design}
In the above example, only stdout part of the output from link_design is
captured and written into output.log. If output.log exists, the content of the file
is appended. If output.log does not exist, it will be created. Nothing is
returned.

Version 4.4.1 October 2010 141


SpyGlass® Tcl Shell Interface
Overview show_error

show_error Displays the last error that occurred during a particular command
invocation along with its trace
Syntax show_error

Scope Any

Return Value None

Description The show_error command displays the last error that occurred during a
particular command execution along with its trace.

Example sg_shell> this_is_an_erroneous_command


invalid command name "this_is_an_erroneous_command"
sg_shell> show_error
Detailed Error Trace
--------------------

invalid command name "this_is_an_erroneous_command"


while executing
"this_is_an_erroneous_command"

142 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands alias

alias Creates an alias for a group of word(s)


Syntax alias <alias-name>
[ <expansion> ]

Scope Any

Return Value String , <alias-name>, if a new alias is being created. Otherwise,


returns nothing.

Description The alias command creates an alias for a group of words, the first of
which should be an existing command. This command is like the usual Unix
shell's alias command.
The alias command can be used in the following ways:
 To display the list of existing aliases
Specify the alias command without any argument to display a list of
existing aliases. This command returns nothing.
 To display the value of a particular alias
Specify the command, alias <alias-name>, to display the value of
the specified alias (<alias-name>). This command returns nothing.
 To create a new alias
Specify the command, alias <alias-name> [ <expansion> ],
to create a new alias of the specified name (<alias-name>), which
expands to the words as specified in the expansion (<expansion>).
This command returns the string, <alias-name>.

Example sg_shell> alias np { new_project start.prj -projectwdir ./


start }
new_project start.prj -projectwdir ./start
sg_shell> np

sg_shell> alias ho { help -option }


help -option

Version 4.4.1 October 2010 143


SpyGlass® Tcl Shell Interface
Overview alias

sg_shell> ho

sg_shell> alias
[ho] -> help -option
[np] -> new_project start.prj -projectwdir ./start
[quit] -> exit

sg_shell> alias np
[np] -> new_project start.prj -projectwdir ./start

See Also unalias

144 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands unalias

unalias Removes an alias set for a group of word(s)


Syntax unalias <alias-name>

Scope Any

Return Value None

Description The unalias command unalias a previously set alias for a group of words.
This command is similar to the unix shell's unalias command.

Example sg_shell> alias np { new_project start.prj -projectwdir ./


start }
new_project start.prj -projectwdir ./start
sg_shell> unalias np

See Also alias

Version 4.4.1 October 2010 145


SpyGlass® Tcl Shell Interface
Overview benchmark

benchmark Monitors run-time and memory usage between two designated


check points in sg_shell
Syntax benchmark
[ -start <check-point-name> ] | [ -show <data-object> ]
[ -h ]

Scope Any

Return Value  Returns a data object when the -start argument is specified
 Returns nothing when the -show argument is specified

Description The benchmark command monitors runtime and memory usage at various
stages. The benchmark data shown is calculated with respect to some
previous check points as marked by the benchmark -start command.
Therefore, sg_shell first determines a check point by using the
benchmark -start point-1 command, and store the result in some
variable. Then, at a later time, whenever you wish to see the details such as
memory usage and runtime, with respect to the check-point "point-1", you
can specify the command, benchmark -show $data.
The invocation benchmark -start point-1 returns a list containing
some data. The contents are like the following:
{ malloc'ed-memory heap-memory user-time system-time
cpu-time elapsed-time check-point-name }
The data in the above list denotes the absolute figures at the time of fetching
this list. This list should be stored in some variable, say
check_point_start_data. This variable should be used to see the
incremental statistics at any later stage by using the command,
benchmark -show $check_point_start_data.

Arguments This command has the following arguments:

-h
(Optional) Prints memory figures in human readable units, such as KB

146 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
SpyGlass Tcl Commands benchmark

and MB).

-show <data-object>
(Optional) Displays the information for the specified data,
<data-object>.

-start <check-point-name>
(Optional) Marks a start check point for benchmarking.

Example sg_shell> set lnk_dsg_data [benchmark -start


link_design_start]
mmem 11008308 hmem 88879104 usr_tm 0.11 sys_tm 0.11 cpu_tm
0.22 elapsed_tm 1252041322.090611 name link_design_start

sg_shell> link_design
.
.
.
sg_shell> benchmark -show $lnk_dsg_data
Benchmark (memory/time related) information
-------------------------------------------
check-point: link_design_start
malloc'ed memory = 35426708 bytes ( 24418400 bytes )
heap size = 118157312 bytes ( 29278208 bytes )
user time = 2.480 sec ( 2.370 sec)
system time = 1.060 sec ( 0.950 sec)
cpu time = 3.540 sec ( 3.320 sec)
Note: figures in the parentheses show incremental data wrt
the nearest check-point named 'link_design_start'
(Use '-h' for human readable units)

sg_shell> benchmark -show $lnk_dsg_data -h


Benchmark (memory/time related) information
-------------------------------------------
check-point: link_design_start
malloc'ed memory = 33.79 MB ( 23.29 MB )

Version 4.4.1 October 2010 147


SpyGlass® Tcl Shell Interface
Overview benchmark

heap size = 112.68 MB ( 27.92 MB )


user time = 2.480 sec ( 2.370 sec)
system time = 1.060 sec ( 0.950 sec)
cpu time = 3.540 sec ( 3.320 sec)
Note: figures in the parentheses show incremental data wrt
the nearest check-point named 'link_design_start'

148 October 2010 Version 4.4.1


Known Problems and
Solutions in Tcl Shell

Known Problems and Solutions


Following are the known problems and solutions in sg_shell:
 Problem: Custom reports may not work properly if filtering is done based on -du
or -ip arguments.
Description: If a custom report is defined with filtering based on -du or -ip
arguments of the define_filter command, that report may not work properly except
when generated after the run_goal command. In case you are generating report for
an already run goal after switching to it and without a re-run, this report will not
have the expected filtered messages.
Solution: Re-run the goal after switching to it, and then generate such custom
reports. The same is true after the open_project command also, since it would take
you to the last active goal, and its re-run would ensure that custom report works fine
consequently.
This problem is expected to be fixed in a future release.
 Problem: Custom reports may not work correctly when the rulegroup option is
used as a sorting or grouping criteria in the define_view command

SpyGlass® Tcl Shell Interface 149


SpyGlass® Tcl Shell Interface
Known Problems and Solutions

Description: If a custom report is defined and then sorted or grouped according to


the rulegroup criteria, that report may not work properly except when generated
after the run_goal command. In case you are generating report for an already run
goal after switching to it and without a re-run, this report will not have the expected
sorting or grouping.
Solution: Re-run the goal after switching to it, and then generate such custom
reports. The same is true after the open_project command also, since it would take
you to the last active goal, and its re-run would ensure that custom report works
fine consequently.
This problem is expected to be fixed in a future release.
 Problem: Escaped names not supported in Tcl shell
Description: For an escaped name design, you cannot refer to escaped names while
setting some design options or parameters. However, if you do not intend to refer
these escape names during setup, there should not be any issue in analyzing such
designs in Tcl shell.
Solution: This problem is expected to be fixed in a future release.
 Problem: The help -report command does not display some policy specific
reports unless the goal is being currently run.
Description: Some of the policy specific reports become visible on issuing the
help -report command only after the goal has been currently run. Therefore,
if you switch to a previously run goal, then even though these reports are available,
you may not find them listed by using the help -report command.
Solution: You can re-run the goal after switching to it, to get the complete active
reports list. This problem is expected to be fixed in a future release.
 Problem: Waiver are applied only at the time of running the goal, and not in every
write_report command
Description: Waivers are currently applied when you are actually running the goal.
If there are waivers specified after the run_goal command, these would be applied
during consequent run_goal command only. Therefore, if there are messages
present in your standard/custom reports which you want to waive, specify the
additional waiver files, re-run goal, and then generate these reports again.

150 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Known Problems and Solutions in Tcl Shell

Solution: Re-run goal whenever waivers are changed. This problem is expected to
be fixed in a future release.
 Problem: Ctrl-Z not supported in Tcl shell
Description: If you are on sg_shell prompt, and you open a file using vim as
shown below:
sg_shell> vim output.log
In the above case, you are working in vim and if you press CTRL-Z, this will
suspend the vim session as well as the sg_shell session, and you will return to your
native shell (tcsh etc.).
However, when you do an "fg" or "%" to resume the suspended job, then it should
take you to the vim session (or at least to the sg_shell session). In this case,
there is some known issue and it does not allow you to type anything on the shell,
or if you are able to type in something then that command will not be honoured.
Solution: It is recommended to start unix shell from within sg_shell by typing
tcsh or sh etc. (depending on the shell you want to start), and then exit this unix
shell whenever you want to return to sg_shell.
 Problem: DesignWare is not supported in Tcl shell
Description: The set_option dw true command is not supported in Tcl
shell. DesignWare involves multiple design read passes to identify DesignWare
components, and then fill their definitions. Therefore, it is not supported currently
in Tcl shell. However, if you have a netlist for DesignWare components generated
from earlier SpyGlass runs or otherwise, then you can directly use the netlist for
DesignWare components in the Tcl shell.
Solution: Generate DesignWare components definition outside of Tcl shell, and
then feed it directly by using appropriate read_file command.
 Problem: Custom reports do not work directly for goals run from Console.
Description: There is a separate message database created in sg_shell which
helps you to query message database. This database is not generated by default in
the Console runs. Therefore, if you want to use sg_shell and Console UI/BATCH
together and generate custom reports, please set following environment variable
before invoking Console UI/BATCH:

Version 4.4.1 October 2010 151


SpyGlass® Tcl Shell Interface
Known Problems and Solutions

% setenv SPYGLASS_SMDB_SUPP 1
This would create the necessary message database so that you can re-use the run
results from Console inside the sg_shell.
Solution: Either set the specified environment variable prior to Console invocation,
or re-run goals inside sg_shell prior to custom report generation.
 Problem: Tab completion does not work if space is first character
Description: sg_shell supports tab completion which let you choose from the
displayed list as you are typing the partial string. However, this feature does not
work if space is the first character on sg_shell prompt.
Solution: Please be aware of this behavior.
 Problem: Tcl shell re-direction operators, > and >>, are not supported for Tcl
built-in commands or procedures.
Description: Tcl shell re-direction operator, >, is not supported for Tcl built-in
commands or procedures. This is, however, supported for Tcl shell commands
listed by using the help command. Further, UNIX shell re-direction operator, >>, is
not supported for append operation in Tcl shell. Use the capture -append Tcl
command to implement the append operation.
Solution: Please be aware of this behavior.
 Problem: DDR goal not supported in Tcl shell
Description: If there is a goal referring to multiple designs in a single run where
one is a reference design and other is the implementation design, such goals are not
supported in Tcl shell currently.
Solution: This problem is expected to be fixed in a future release.
 Problem: Error messages on old project files have new command names only
Description: Some of the command names in project files have changed in
SpyGlass 4.3.0 release. Project files generated from SpyGlass 4.2.0 or
SpyGlass4.2.1 are still supported, but if there is any error in these older project
files, the error messages would show the name of the new command names only.
Solution: Use the new command names only. Further, if there are any old project
files, open them in sg_shell, and save back to get updated project files with new

152 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Known Problems and Solutions in Tcl Shell

command names.
 Problem: Wildcard support is not present for the read_file and remove_file
commands
Description: Currently, wildcard is not supported for the read_file and remove_file
commands. Therefore, you should provide the expanded list in these commands.
Solution: You can use Tcl glob function to expand the wildcard as follows:
sg_shell> set temp [glob *.v]
sg_shell> read_file -type verilog $temp # read all *.v files
 Problem: Help for rules, parameter, and sgdc is not available without goal
selection
Description: There is the help command available in sg_shell to view the help
for commands, methodology, goal, rules, options, parameters, sgdc, and reports.
You can get help for rules, parameters, and sgdc only after a goal has been selected.
These objects are not available outside of goal scope.
Solution: Please be aware of this behavior.
 Problem: Error message during capture would come in the captured file and not on
the screen
Description: The capture command can be used to re-direct output of some other
command to the specified file. If there are any errors reported during execution of
that command, those error messages are also captured in the specified file and are
not displayed on the screen. For example, consider that an error has been reported
during the execution of the write_report <rpt_name> command as part of
following command:
sg_shell> capture my.rpt {write_report <rpt_name>}
In this case, the error is captured in the my.rpt file itself.
Solution: Please be aware of this behavior.
 Problem: Hierarchical SGDC migration flow is not supported inside Tcl shell
Description: Options gen_hiersgdc and validate_hiersgdc are not
supported.
Solution: In classic batch, perform SGDC migration using the gen_hiersgdc

Version 4.4.1 October 2010 153


SpyGlass® Tcl Shell Interface
Known Problems and Solutions

and validate_hiersgdc options. Then, use these migrated sgdc files inside
Tcl shell.
 Problem: Boolean options set using set_option not unset in goal scope with
set_goal_option
Description: If there is a boolean option set in global scope for all goals using
set_option, then it can't be unset in goal scope using set_goal_option. For example,
consider the following.
sg_shell> set_option ignorelibs yes
sg_shell> current_goal initial_rtl/lint/synthesis
sg_shell> set_goal_option ignorelibs no
sg_shell> run_goal
In the above case, even if ignorelibs is being set to no inside goal scope, it
would still be treated as yes during run_goal. This problem is there with only
boolean options.
Solution: It is currently recommended that if a specific boolean option is intended
to be turned on/off on per goal basis, then set it inside goal scope only, and not have
it set globally using set_option.
 Problem: Support for optional & pre-requisite goal in Tcl shell
Description: The following problems exist:
• Optional goal support in sg_shell: When optional goal preference
is ON through the configuration file, optional goals are not visible in
Tcl shell as part of goal_summary report, wildcard match, and
help -goal.
• Pre-requisite goal support in sg_shell: When pre-requisite goal
preference is ON, Tcl shell does not provide feedback to a user even
if a pre-requiste goal has not been run prior to running the main goal.
Solution: This problem is expected to be fixed in a future release.

154 October 2010 Version 4.4.1


Appendix

Deprecated Command Names and Their


Corresponding New Commands
The following table lists the old commands and their corresponding new
commands in Console:

Old Command New Command


set_option current_methodology current_methodology
set_option stop_module set_option stop
set_option define_macro set_option define <macro>
set_option set_option incdir <path>
include_file_search_paths
set_option set_option libext <exts>
verilog_library_extensions
set_option verilog_library_files set_option v <files>
set_option set_option y <dirs>
verilog_library_directories

SpyGlass® Tcl Shell Interface 155


SpyGlass® Tcl Shell Interface
Deprecated Command Names and Their Corresponding New Commands

Old Command New Command


set_option verilog_standard set_option enableSV <yes | no>
set_option disablev2k <yes | no>
set_option set_option allow_module_override <yes |
allow_duplicate_modules no>
set_option vhdl_standard set_option 87 <yes | no>
set_option work_logical_name set_option work <arg>
set_option vhdl_sort_method set_option sort <yes | no>
set_option hdl_parameter set_option param <parameter>
set_option analyze_designware set_option dw <yes | no>
set_option black_boxes set_option inferblackbox <yes | no>
set_option inferblackbox_rtl <yes | no>
set_option nobb <yes | no>
set_option message_printing_limit set_option lvpr <value>
set_option define_synthesis_pragma set_option pragma <list-of-pragmas>
set_option enable_clock_gating set_option sgsyn_clock_gating
set_option clock_gating_threshold set_option sgsyn_clock_gating_threshold
set_option memory_size_limit set_option mthresh <value>
set_option handle_large_memory set_option handlememory <yes | no>
set_option enable_save_restore set_option enable_save_restore
set_option sgdc_check set_option strict_sgdc_check <yes | no>
set_option precomp_lib_check set_option hdllibdu <yes | no>
set_option cache_directory set_option cachedir <dir-name>
add_file read_file
create_report set_option report
create_report -file set_option reportfile
create_report -maxsize set_option report_max_size
create_report -style set_option report_style
define_precomp_lib set_option libhdlfiles <lib-name>

156 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Appendix

Old Command New Command


define_lib_map set_option lib <lib-name>
define_goal_setup current_goal

Preference Variables Supported by the set_pref


Command
The following prefernce variable is supported by the set_pref command:
• sh_command_log_file

Version 4.4.1 October 2010 157


SpyGlass® Tcl Shell Interface
Preference Variables Supported by the set_pref Command sh_command_log_file

sh_command_log_file Specifies the path name for sg_shell's command log file
Syntax set_pref sh_command_log_file "./mycommands.log"

Scope Any

Return Value None

Description The sh_command_log_file preference variable is used to set the path


name of the command log file.The default value for this preference variable
is './sg_shell_command.log'. This means that if sg_shell is being run in
interactive mode, then all the commands being entered on sg_shell's prompt
will be logged into a file called sg_shell_command.log in the current
directory. If this log file already exists, then it gets truncated.
To preserve the commands log for each run of sg_shell, you should specify
a unique name for the commands log file for each interactive run of
sg_shell. You can achieve this by inserting the following command in your
.sg_shell.startup file (either $HOME/.sg_shell.startup or $CWD/
.sg_shell.startup or through "-tcl $MYPATH/startup.tcl"):
set_pref sh_command_log_file "./sg_shell_command_[clock
seconds].log"
You can set the sh_command_log_file variable variable at any stage
of sg_shell's interactive run and its effect will be visible immediately after
being set. The commands entered before setting this variable (including the
set_pref command to set the new log file) will get logged into the
previously set command log file. All the commands entered after setting the
new log file will be logged in the new log file.

Example The following example shows how to display the variable/value pairs.
You start the sg_shell as:
unix_shell> sg_shell

sg_shell banner ....

158 October 2010 Version 4.4.1


SpyGlass® Tcl Shell Interface
Appendix sh_command_log_file

sg_shell> help
...
...
sg_shell> open_project xyz.prj
...
sg_shell> run_goal
...
sg_shell> set_pref sh_command_log_file "new_log_file.log"
set_pref: info: command log file is now at
`new_log_file.log'
(Previously, it was at `./sg_shell_command.log')

sg_shell> close_project
...
sg_shell> exit

Considering the sequence above, the contents of default log file (./
sg_shell_command.log) will be:

------------------------------------------------
help
open_project xyz
run_goal
set_pref sh_command_log_file "new_log_file.log"
------------------------------------------------

and, the contents of new log file (that is, "new_log_file.log") will be:

------------------------------------------------

Version 4.4.1 October 2010 159


SpyGlass® Tcl Shell Interface
Preference Variables Supported by the set_pref Command sh_command_log_file

close_project
exit
------------------------------------------------

If you specify a path name for sh_command_log_file, then ensure that


intermediate directories in the path name already exist. If they don't exist,
then an error message will come and this variable specification will be
ignored. Mentioned below is an example of this:

sg_shell> pwd
/u/sam/prj
sg_shell> exec ls ./logs/
other_cmds.log
sg_shell_command.log
sg_shell> set_pref sh_command_log_file "/u/sam/prj/logs/
today/sg_shell_command_[clock seconds].log"
set_pref: error: could not open `/u/sam/prj/logs/today/
sg_shell_command_1255417358.log' for writing
(Please re-check the value of `sh_command_log_file'
variable)

sg_shell> get_pref
sh_command_log_file ./sg_shell_command.log
sg_shell>

See Also set_pref, get_pref and help

160 October 2010 Version 4.4.1

You might also like