HDL Designer SeriesTM Tcl Reference Manual

Software Version 2008.1

September 18, 2008

© 1996-2008 Mentor Graphics Corporation All rights reserved.

This document contains information that is proprietary to Mentor Graphics Corporation. The original recipient of this document may duplicate this document in whole or in part for internal business purposes only, provided that this entire notice appears in all copies. In duplicating any part of this document, the recipient agrees to make every reasonable effort to prevent the unauthorized use and distribution of the proprietary information. This document is for information and instruction purposes. Mentor Graphics reserves the right to make changes in specifications and other information contained in this publication without prior notice, and the reader should, in all cases, consult Mentor Graphics to determine whether any changes have been made.

The terms and conditions governing the sale and licensing of Mentor Graphics products are set forth in written agreements between Mentor Graphics and its customers. No representation or other affirmation of fact contained in this publication shall be deemed to be a warranty or give rise to any liability of Mentor Graphics whatsoever.

MENTOR GRAPHICS MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

MENTOR GRAPHICS SHALL NOT BE LIABLE FOR ANY INCIDENTAL, INDIRECT, SPECIAL, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING BUT NOT LIMITED TO LOST PROFITS) ARISING OUT OF OR RELATED TO THIS PUBLICATION OR THE INFORMATION CONTAINED IN IT, EVEN IF MENTOR GRAPHICS CORPORATION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

RESTRICTED RIGHTS LEGEND 03/97

U.S. Government Restricted Rights. The SOFTWARE and documentation have been developed entirely at private expense and are commercial software provided with restricted rights. Use, duplication or disclosure by the U.S. Government or a U.S. Government subcontractor is subject to the restrictions set forth in the license agreement provided with the software pursuant to DFARS 227.7202- 3(a) or as set forth in subparagraph (c)(1) and (2) of the Commercial Computer Software - Restricted Rights clause at FAR 52.227-19, as applicable.

Contractor/manufacturer is: Mentor Graphics Corporation 8005 S.W. Boeckman Road, Wilsonville, Oregon 97070-7777. Telephone: 503.685.7000 Toll-Free Telephone: 800.592.2210 Website: www.mentor.com SupportNet: supportnet.mentor.com/ Send Feedback on Documentation: supportnet.mentor.com/user/feedback_form.cfm

TRADEMARKS: The trademarks, logos and service marks ("Marks") used herein are the property of Mentor Graphics Corporation or other third parties. No one is permitted to use these Marks without the prior written consent of Mentor Graphics or the respective third-party owner. The use herein of a third- party Mark is not an attempt to indicate Mentor Graphics as a source of a product, but is intended to indicate a product from, or associated with, a particular third party. A current list of Mentor Graphics’ trademarks may be viewed at: www.mentor.com/terms_conditions/trademarks.cfm. Table of Contents

Chapter 1 HDS Library Contents API ...... 9 Introduction ...... 9 API Command Modes...... 9 Accessing the Console ...... 9 Document Conventions...... 10 Command Basics ...... 10 Example Scripts ...... 11 Generated HDL File Paths ...... 11

Chapter 2 HDS Tcl API Command Reference...... 23 Pre-Defined Commands...... 23 General Commands...... 23 addLibraryMapping ...... 24 configureProperties...... 25 invokeGUI ()...... 26 setDefaultView ...... 27 setRulesetLocation ...... 28 HDL2Graphics Commands...... 29 runH2G ...... 30 runHdlImport ...... 31 runHtmlExport ...... 32 setupH2G ...... 33 setupHdlImport ...... 36 setupHtmlExport...... 37 Batch Mode Tasks...... 39 runTask ...... 40 setCompileAlways (enable) ...... 41 setupTask (args) ...... 42 Generation Commands ...... 43 runConfigGenerate ...... 44 runGenerate...... 45 setupGenerate ...... 46 Library Commands ...... 48 library names() ...... 49 library open ...... 50 Version Management Commands...... 51 runVMChangeLock ...... 52 runVMCheckIn ...... 53 runVMCheckOut...... 54 runVMGet...... 55

HDL Designer Series Tcl Reference Manual, V2008.1 3 September 18, 2008 Table of Contents

runVMHistory...... 56 runVMLabel ...... 57 runVMSynchronize (args) ...... 58 runVMUndoCheckOut ...... 59 setupVM ...... 60 setupVMChangeLock ...... 61 setupVMCheckIn ...... 62 setupVMCheckOut ...... 63 setupVMGet ...... 64 setupVMHierarchy ...... 65 setupVMLabel...... 66 setupVMSynchronize ...... 67 Dynamically Created Commands ...... 68 Command Structure ...... 68 HDS objects ...... 69 Option ...... 70 Command list ...... 70 architecture object commands...... 71 blockFrame object commands ...... 72 caseFrame object commands ...... 73 configuration object commands ...... 74 declaration object commands ...... 76 elseFrame object commands...... 77 embeddedFrame object commands...... 78 entity option object commands ...... 79 file object commands ...... 81 forFrame object commands...... 83 frameConfiguration object commands ...... 84 frame object commands ...... 85 ifFrame object commands...... 86 instance object commands ...... 87 library object commands...... 88 machineFrame object commands ...... 90 packageHeader object commands...... 91 packageBody object commands ...... 92 Command List ...... 92 Index End-User License Agreement

4 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 Table of Contents

HDL Designer Series Tcl Reference Manual, V2008.1 5 September 18, 2008 List of Tables

Table 1-1. Generated HDL Commands ...... 12 Table 2-1...... 24 Table 2-2...... 25 Table 2-3...... 27 Table 2-4...... 28 Table 2-5...... 30 Table 2-6...... 31 Table 2-7...... 32 Table 2-8...... 33 Table 2-9...... 36 Table 2-10...... 37 Table 2-11...... 40 Table 2-12...... 41 Table 2-13...... 42 Table 2-14...... 44 Table 2-15...... 45 Table 2-16...... 46 Table 2-17...... 49 Table 2-18...... 50 Table 2-19...... 52 Table 2-20...... 53 Table 2-21...... 54 Table 2-22...... 55 Table 2-23...... 56 Table 2-24...... 57 Table 2-25...... 58 Table 2-26...... 59 Table 2-27...... 60 Table 2-28...... 61 Table 2-29...... 62 Table 2-30...... 63 Table 2-31...... 64 Table 2-32...... 65 Table 2-33...... 66 Table 2-34...... 67 Table 2-35. architecture object commands ...... 71 Table 2-36. blockFrame object commands ...... 72 Table 2-37. caseFrame object commands ...... 73 Table 2-38. configuration object commands ...... 74 Table 2-39. declaration object commands ...... 76

HDL Designer Series Tcl Reference Manual, V2008.1 6 September 18, 2008 List of Tables

Table 2-40. elseFrame object commands ...... 77 Table 2-41. embeddedFrame object commands ...... 78 Table 2-42. entity option object commands ...... 79 Table 2-43. file object commands ...... 81 Table 2-44. forFrame object commands ...... 83 Table 2-45. frameConfiguration object commands ...... 84 Table 2-46. frame object commands ...... 85 Table 2-47. ifFrame object commands ...... 86 Table 2-48. instance object commands ...... 87 Table 2-49. library object commands ...... 88 Table 2-50. machineFrame object commands ...... 90 Table 2-51. packageHeader object commands ...... 91 Table 2-52. packageBody object commands ...... 92

HDL Designer Series Tcl Reference Manual, V2008.1 7 September 18, 2008 8 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 Chapter 1 HDS Library Contents API

Introduction This document is designed to help you use the HDS library contents API more effectively. The HDS library contents API enables Tcl scripts to:

1. Access the structure of a design 2. Navigate the libraries, files and declarations of the design 3. Examine the hierarchies produced by component instantiation. For more information on the Tcl language refer to:

http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html

API Command Modes The API commands can be used in one of two modes:

• Interactive: via the console page of the HDS log window. This mode provides a convenient way of learning about the API and debugging scripts, since the commands provide considerable feedback on how they should be used.This is described in more detail in the following sections. • Batch: via the -tcl command line switch in HDS.

Accessing the Console Text entered here will be executed as Tcl commands and can use the API commands described in the following sections.

To access the log window:

1. Invoke HDS to display the Design Manager window. 2. Select Window > HDS Log Window.

HDL Designer Series Tcl Reference Manual, V2008.1 9 September 18, 2008 HDS Library Contents API Command Basics

Figure 1-1. 2. Log Window

Document Conventions In the following examples, text in bold represents commands typed into the console, text in italics represents output from HDS in response to a command. Command Basics HDS API commands are either dynamically created or predefined. To start using the API commands you should gain access to your design library using the library open command:library open is an example of a predefined command. HDS responds to the command by creating a handle that refers to the library object to be accessed. HDS created handles are designated by hds followed by a unique number.

In this example hds0 is a handle referring to the library UART.

library open uart hds0

The following is an example of a dynamically created command composed of the above returned UART library handle and the files option.The command returns a set of handles referring to the UART library files. Refer to “library object commands” on page 88.

hds0 files hds1 hds2 hds3 hds4 hds5 hds6 hds7 hds8 hds9 hds10 hds11 hds12 hds13 hds14

The Tcl language supports the concept of variables. Variables are set and unset with the standard Tcl set and unset commands. To ease the use of the created handles, they are stored

10 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Library Contents API Example Scripts

in variables. In the following example the set command stores the UART handle hds0 in variable lib

set lib [library open uart] hds0

Notice the use of nested commands where the result of the second command [library open uart] is used as a part of the first command.

You can now use the lib variable which carries a handle to the UART library instead of the handle itself in the command.

$lib files hds1 hds2 hds3 hds4 hds5 hds6 hds7 hds8 hds9 hds10 hds11 hds12 hds13 hds14

All objects have a ‘configure’ command option, this provides access to the attributes of the object. If you use the configure command with no arguments, it shows the names and values of all the attributes.

To get a list of all object command options you can type:

$lib help Error: bad option "help" should be configure or file Example Scripts This section provides and explains some sample scripts that show how an HDS design can be accessed using the Tcl API commands.

Generated HDL File Paths Some source files of a design may be HDS graphics files. Using the Tcl API commands you can navigate to and print out the HDL text files generated from the graphics:

Steps By copying the Tcl commands in the following table and pasting it into the HDS log window, HDS responds with a set of handles referring to the designated HDS objects and finally prints out the to the uart_tb generated HDL file.

HDL Designer Series Tcl Reference Manual, V2008.1 11 September 18, 2008 HDS Library Contents API Example Scripts

Table 1-1. Generated HDL Commands Tcl Command HDS Response set lib [library open uart] hds0 set tb [$lib declaration uart_tb struct] hds1 set generatedHdlFile [[$tb file] generated] hds43 puts [$lib configure C:/Lastbuild/32/LatestBuild/examples/ hardHdlDir]/[$generatedHdlFileconfigure uart/hdl/uart_tb_struct.vhd relativePathname]

Now let us see how this piece of code works.

set lib [library open UART]

A variable lib is automatically declared using the Set tcl command. The value of the variable lib is substituted with the value of the command within []

In other words the result of the library open command is given to the variable lib. Refer to “library object commands” on page 88. When a '[' appears in a command, Tcl treats everything between it and the matching ']' as a nested Tcl command. Tcl evaluates the nested API command and substitutes its result into the enclosing command in place of the bracketed text. So the above command is translated as follows:

set lib hds0

where hds0 is an HDS handle referring to the library UART

set tb [$lib declaration uart_tb struct]

Again the value of the automatically declared variable tb is substituted with the result of the second command.

When a $ appears in a command, Tcl treats the letters and digits following it as a variable name, and substitutes the value of the variable in place of the name.

So $lib carries the value hds0 mentioned in the first step which is a handle referring to the UART library. The $lib together with the declaration option and the uart_tb struct argument constitute a new command.This command returns hds1 which is a handle referring to an HDS declaration. Refer to “library object commands” on page 88.

set generatedHdlFile [[$tb file] generated]

In this step you can see that there are multiple nested Tcl API commands. The value hds1of the command [$tb file] is used to create a second dynamic command i.e. hds1 generated. The value of the second command substitutes the value of the variable generatedHDLFile.

12 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Library Contents API Example Scripts

puts [$lib configure hardHdlDir]/[$generatedHdlFile configure relativePathname]

Finally you can print out the path of the UART_tb generated file using the puts Tcl command. Refer to “library object commands” on page 88 and “file object commands” on page 81.

/home/designs/UART/hdl/uart_tb_struct.vhd

Reporting VHDL Packages Directly Referenced by a Library Instead of using discrete Tcl commands, Tcl procedures will be used. Procedures in Tcl serve much the same purpose as functions in C. They may take arguments, and may return values. The basic syntax for defining a procedure is:

proc name argList body

Once a procedure is created, it is considered to be a command, just like any other built-in Tcl command. As such, it may be called using its name, followed by a value for each of its arguments. The return value from a procedure is equivalent to the result of a built-in Tcl command. Thus, command substitution can be used to substitute the return value of a procedure into another expression.

In this example the procedure showPkgs is considered a command which takes a library object as an argument and finally prints out the VHDL packages directly referenced by that library.

The API refers to entities and architectures, since these correspond to the separation of interface and implementation found both in VHDL designs and in HDS graphics files. A Verilog module corresponds to both an entity and architecture, so each module in Verilog text files becomes both an entity and an architecture in the API. This allows scripts using the API to treat VHDL text, Verilog text and HDS graphics in a consistent fashion.

All objects have a class attribute. The class attribute may have one of the following values (architecture, architectureFrame, blockFrame, caseFrame, configuration, directory, elseFrame, embeddedFrame, entity, file, forFrame, frameConfiguration, ifFrame, instance, library, machineFrame, packageBody or packageHeader).

Objects of class entity, architecture, packageHeader and packageBody support a 'packages' command that returns a list of packages used by the declaration. Refer to“Dynamically Created Commands” on page 68.

Steps proc showPkgs {lib} { foreach file [$lib files] { foreach decl [$file declarations] { foreach pkg [$decl packages] { if {![info exists alreadyDone($pkg)]} { puts "[$pkg configure fullName]" set alreadyDone($pkg) 1 }

HDL Designer Series Tcl Reference Manual, V2008.1 13 September 18, 2008 HDS Library Contents API Example Scripts

} } } } showPkgs [library open uart]

ieee.std_logic_1164 ieee.std_logic_arith std.TEXTIO

Note You can ask a Verilog declaration for its packages, the result is always an empty list. This uniformity can be helpful when examining mixed language designs.

Reporting Verilog Include Files File objects support an 'includes' command that provides access to the files `included by a file. Unlike most API functions, the include files are given in text form. This is because include files are not constrained to reside within HDS libraries, they can be present anywhere in the filesystem.

The following example reports all files included by the files of a library:

proc showIncls {lib} { foreach file [$lib files] { foreach inc [$file includes] { if {![info exists alreadyDone($inc)]} { puts $inc set alreadyDone($inc) 1 } } } }

Refer to “library object commands” on page 88 and “file object commands” on page 81.

Issue: our example designs have no include statements.

Note You can ask a VHDL file for its includes, the result is always an empty list. This uniformity can be helpful when examining mixed language designs.

Simple Design Hierarchy Traversal The following example shows a script that walks the hierarchy of a design and reports its structure:

proc indent {} { return [string repeat { } $::indent] }

14 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Library Contents API Example Scripts

The procedure indent is used as a command in the procedure walkArch. It adds indentations to the produced results. Indent has 0 arguments and uses the string repeat command to return a space repeated a number of times equal to the value of the variable $:: indent

proc walkArch {arch} { puts "[indent]ARCH [$arch configure fullName]" incr ::indent foreach inst [$arch instances] { puts "[indent]INST [$inst configure name]" walkArch [$inst child] } incr ::indent -1 puts "[ indent]-- end [$arch configure fullName]" } set lib [library open uart] set indent 0 walkArch [$lib declaration uart_tb struct]

Refer to “library object commands” on page 88, “instance object commands” on page 87 and “architecture object commands” on page 71.

The procedure walkArch takes a library declaration as an argument and returns all the library architectures and their instances.

ARCH UART.uart_tb(struct) INST U_0 ARCH UART.tester(flow) -- end UART.tester(flow) INST U_1 ARCH UART.uart_top(struct) INST U_1 ARCH UART.cpu_interface(intconx) INST U_0 ARCH UART.control_operation(fsm) -- end UART.control_operation(fsm) -- end UART.cpu_interface(intconx) INST U_2 ARCH UART.clock_divider(flow) -- end UART.clock_divider(flow) INST U_3 ARCH UART.address_decode(tbl) -- end UART.address_decode(tbl) INST U_4 ARCH UART.serial_interface(struct) INST ser_out_mux Error: Instance ser_out_mux is unbound

In this case, the command reports an error, since moduleware instances do not have a corresponding architecture.

HDL Designer Series Tcl Reference Manual, V2008.1 15 September 18, 2008 HDS Library Contents API Example Scripts

Robust Design Hierarchy Traversal If you want your script to trap unbound component instances and continue walking the hierarchy, you need to use the 'catch' command. The catch command evaluates a script and traps exceptional returns

proc indent {} { return [string repeat { } $::indent] } proc walkArch {arch} { puts "[indent]ARCH [$arch configure fullName]" incr ::indent foreach inst [$arch instances] { if {![catch {$inst child} child]} { puts "[indent]INST [$inst configure name]" walkArch $child } } incr ::indent -1 puts "[ indent]-- end [$arch configure fullName]" } set lib [library open uart] set indent 0 walkArch [$lib declaration uart_tb struct]

Refer to “library object commands” on page 88, “instance object commands” on page 87 and “architecture object commands” on page 71.

ARCH UART.uart_tb(struct) INST U_0 ARCH UART.tester(flow) -- end UART.tester(flow) INST U_1 ARCH UART.uart_top(struct) INST U_1 ARCH UART.cpu_interface(intconx) INST U_0 ARCH UART.control_operation(fsm) -- end UART.control_operation(fsm) -- end UART.cpu_interface(intconx) INST U_2 ARCH UART.clock_divider(flow) -- end UART.clock_divider(flow) INST U_3 ARCH UART.address_decode(tbl) -- end UART.address_decode(tbl) INST U_4 ARCH UART.serial_interface(struct) INST U_0 ARCH UART.xmit_rcv_control(fsm) -- end UART.xmit_rcv_control(fsm) INST U_1 ARCH UART.status_registers(spec) -- end UART.status_registers(spec) -- end UART.serial_interface(struct) -- end UART.uart_top(struct) -- end UART.uart_tb(struct)

16 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Library Contents API Example Scripts

Design Hierarchy and Frames The API uses the term 'frame' to refer to a number of constructs that add hierarchy within an architecture:

• FOR frames, IF frames, and BLOCK frames in a VHDL block diagram • FOR frames, IF frames and ELSE frames in a Verilog block diagram • FOR GENERATE, IF GENERATE and BLOCK statements in a VHDL text file • FOR GENERATE statements in a Verilog text file • Concurrent and hierarchical states in a state machine or algorithmic state machine (ASM) • Concurrent flowcharts and hierarchical actions in a flow chart With a slightly more complex script, you can gain access to these additional details:

proc indent {} { return [string repeat { } $::indent] } proc walkFrame {frame} { puts "[indent][$frame configure]" incr ::indent foreach sub [$frame subFrames] { walkFrame $sub } foreach inst [$frame instances] { if {![catch {$inst child} child]} { puts "[indent]INST [$inst configure name]" walkArch $child } } incr ::indent -1 } proc walkArch {arch} { puts "[indent]ARCH [$arch configure fullName]" incr ::indent walkFrame [$arch frame] incr ::indent -1 puts "[ indent]-- end [$arch configure fullName]" } set lib [library open uart] set indent 0 walkArch [$lib declaration uart_tb struct]

Refer to “library object commands” on page 88, “instance object commands” on page 87 and “architecture object commands” on page 71 and “frame object commands” on page 85.

ARCH UART.uart_tb(struct) class architectureFrame name struct INST U_0 ARCH UART.tester(flow) class architectureFrame name flow

HDL Designer Series Tcl Reference Manual, V2008.1 17 September 18, 2008 HDS Library Contents API Example Scripts

class machineFrame name tester_top class machineFrame name {tester_top test_rcv} class machineFrame name {tester_top test_status} class machineFrame name {tester_top test_xmit} -- end UART.tester(flow) INST U_1 ARCH UART.uart_top(struct) class architectureFrame name struct INST U_1 ARCH UART.cpu_interface(intconx) class architectureFrame name intconx class embeddedFrame name data_out_mux INST U_0 ARCH UART.control_operation(fsm) class architectureFrame name fsm class machineFrame name cntrl_op class machineFrame name {cntrl_op RX} class machineFrame name {cntrl_op TX} -- end UART.control_operation(fsm) -- end UART.cpu_interface(intconx) INST U_2 ARCH UART.clock_divider(flow) class architectureFrame name flow class machineFrame name clk_div -- end UART.clock_divider(flow) INST U_3 ARCH UART.address_decode(tbl) class architectureFrame name tbl -- end UART.address_decode(tbl) INST U_4 ARCH UART.serial_interface(struct) class architectureFrame name struct class embeddedFrame name convert class machineFrame name conv INST U_0 ARCH UART.xmit_rcv_control(fsm) class architectureFrame name fsm class machineFrame name rcv class machineFrame name xmit -- end UART.xmit_rcv_control(fsm) INST U_1 ARCH UART.status_registers(spec) class architectureFrame name spec -- end UART.status_registers(spec) -- end UART.serial_interface(struct) -- end UART.uart_top(struct) -- end UART.uart_tb(struct)

Design Hierarchy and VHDL Configurations The previous examples walked the design hierarchy assuming that each component instance was bound to a single architecture. In a design using VHDL configuration declarations, an architecture can have multiple configurations, each with different bindings for the component instances. Walking the hierarchy of such a design requires keeping track of the configuration.

18 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Library Contents API Example Scripts

The API includes configuration objects, which correspond to VHDL configuration declarations and frameConfiguration objects which correspond to a single level within the hierarchical structure of a configuration declaration. Designs containing FOR GENERATE, IF GENERATE and BLOCK statements will need corresponding entries in the configuration declarations, so when walking a design using configuration declarations, frames should be taken into account.

The following example shows how to walk a hierarchy using configuration declarations. It uses configuredSubFrames in place of subFrames and configuredChild in place of child.

proc indent {} { return [string repeat { } $::indent] } proc walkFrame {frame frameCfg} { puts "[indent][$frame configure]" incr ::indent foreach {childFrame childFrameCfg} [$frame configuredSubFrames $frameCfg] { walkFrame $childFrame $childFrameCfg } foreach inst [$frame instances] { if {![catch {$inst configuredChild $frameCfg} childInfo]} { foreach {childCfg childArch childFrameCfg} $childInfo {break} puts "[indent]INST [$inst configure name]" walkArch $childArch $childFrameCfg } } incr ::indent -1 } proc walkArch {arch frameCfg} { puts "[indent]ARCH [$arch configure fullName]" incr ::indent walkFrame [$arch frame] $frameCfg incr ::indent -1 puts "[ indent]-- end [$arch configure fullName]" } set lib [library open someLib] set indent 0 set cfg [$lib declaration someCfg] walkArch [$cfg architecture] [$cfg frameConfiguration]

Refer to “library object commands” on page 88, “instance object commands” on page 87 and “architecture object commands” on page 71 and “frame object commands” on page 85.

Issue: our sample designs do not use configurations.

Pruning the Hierarchy The previous examples will expand each component instance, regardless of how many times it has previously been encountered within the hierarchy. In some cases, it is appropriate to prune the traversal so that a declaration is seen only once. This can be accomplished by adding a check at the start of walkArch:

proc walkArch {arch} { if {[info exists ::alreadyDone($arch)]} { return

HDL Designer Series Tcl Reference Manual, V2008.1 19 September 18, 2008 HDS Library Contents API Example Scripts

}

puts "[indent]ARCH [$arch configure fullName]" incr ::indent walkFrame [$arch frame] incr ::indent -1 puts "[ indent]-- end [$arch configure fullName]" }

Finding the Compilation Order Most VHDL compilation tools and some Verilog compilation tools need to be given the source files in an order which ensures that declarations are encountered before they are used. The API can be used to determine an appropriate order. The script shown below does this, though with some restrictions:

• For graphical VHDL designs, it assumes that the generation setting is for combined entity and architecture files. • It does not handle VHDL configuration declarations, these require a more sophisticated form of pruning, since a single architecture can have a different structure for each configuration • It does not handle HDL text files containing declarations that are not part of the design hierarchy proc walkDependencies {decl} { global alreadyDone

# Only look at each declaration once. if {[info exists alreadyDone($decl)]} { return } set alreadyDone($decl) 1

# Only report each file once. set declFile [$decl file] if {[info exists alreadyDone($declFile)]} { set reportFile 0 } else { set reportFile 1 set alreadyDone($declFile) 1 }

foreach pkg [$decl packages] { walkDependencies $pkg }

if {[$decl configure class] eq "architecture"} { walkDependencies [$decl entity]

foreach inst [$decl instances] { if {![catch {$inst child} child]} { walkDependencies $child }

20 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Library Contents API Example Scripts

} }

set file [$decl file] set fileType [$file configure type] if {![regexp {Text$} $fileType]} { if {[lsearch {symbol blockInterface} $fileType] != -1} { # This assumes ent+arch are generated to a single file. set reportFile 0 } else { set file [$file generated] } }

if {$reportFile} { set lib [$file library] # Exclude standard and downstreamOnly libraries. if {[$lib configure type] eq "regular"} { puts "[$lib configure hardHdlDir]/[$file configure relativePathname]" } }

if {[$decl configure class] eq "packageHeader"} { walkDependencies [$decl body] } }

catch {unset alreadyDone} set lib [library open uart] walkDependencies [$lib declaration uart_tb struct]

Refer to “library object commands” on page 88, “declaration object commands” on page 76, and “file object commands” on page 81.

/hds/install/UART/hdl/tester_flow.vhd /hds/install/UART/hdl/control_operation_fsm.vhd /hds/install/UART/hdl/cpu_interface_intconx.vhd /hds/install/UART/hdl/clock_divider_flow.vhd /hds/install/UART/hdl/address_decode_tbl.vhd /hds/install/UART/hdl/xmit_rcv_control_fsm.vhd /hds/install/UART/hdl/status_registers_spec.vhd /hds/install/UART/hdl/status_registers_spec.vhd /hds/install/UART/hdl/serial_interface_struct.vhd /hds/install/UART/hdl/uart_top_struct.vhd /hds/install/UART/hdl/uart_tb_struct.vhd

HDL Designer Series Tcl Reference Manual, V2008.1 21 September 18, 2008 HDS Library Contents API Example Scripts

22 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 Chapter 2 HDS Tcl API Command Reference

Mentor Graphics has added a number of command extensions to the Tcl language to handle and support the HDL Designer operations. These commands are “built-in” and are executed the same as the standard Tcl commands.

This chapter provides a set of commands that can be used to work with and reference HDS objects. HDS Tcl commands are either pre-defined or dynamically created. Pre-Defined Commands

General Commands • addLibraryMapping (library args) • configureProperties (designObject args) • invokeGUI () • setDefaultView (library file primary secondary) • setRulesetLocation (location)

HDL Designer Series Tcl Reference Manual, V2008.1 23 September 18, 2008 HDS Tcl API Command Reference addLibraryMapping addLibraryMapping Add a library mapping and save the current .hdp file. Syntax addLibraryMapping (library args) Arguments

library Library name. args Option names and values. hdl The path for the library hdl mapping. protected Make the library protected. regular Make the library regular. downstream

24 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference configureProperties configureProperties Set and get properties on a design object. Syntax configureProperties (designObject args) Arguments

designObject Design object: {library|library/file|library.unit ?primaryName? ?secondaryName? ?filePath?}. args Optional sequence of property keys and values: key ?value? ?key value? ....

Returns Pass only a design object to return it's property names/values as a list {{name1} val1 {name2} val2}: set properties [::configureProperties $designObject]

Pass a design object and a property name to get the value of the property on this object: set propertyValue [::configureProperties $designObject $propertyName]

Pass a design object and a list of property name/value pairs to set the value of properties on this object: ::configureProperties $designObject {$propertyName $propertyValue}

HDL Designer Series Tcl Reference Manual, V2008.1 25 September 18, 2008 HDS Tcl API Command Reference invokeGUI () invokeGUI () Invoke the graphical user interface.

26 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference setDefaultView setDefaultView Set Default View. Syntax setDefaultView (library file primary secondary) Arguments

library Library name. file File path, relative to the library HDS mapping. primary Primary HDL declaration (VHDL entity or verilog module). secondary Secondary HDL declaration (VHDL architecture, use module name for verilog).

HDL Designer Series Tcl Reference Manual, V2008.1 27 September 18, 2008 HDS Tcl API Command Reference setRulesetLocation setRulesetLocation Set the location for DesignChecker Rulesets. Syntax setRulesetLocation (location) Arguments

location Directory path beneath which the Rulesets are located.

28 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference setRulesetLocation HDL2Graphics Commands • runH2G (hierarchyType library file primary secondary) • runHdlImport (library args) • runHtmlExport (library unit view file) • setupH2G (args) • setupHdlImport (args) • setupHtmlExport (args)

HDL Designer Series Tcl Reference Manual, V2008.1 29 September 18, 2008 HDS Tcl API Command Reference runH2G runH2G Convert specified text declarations to graphics. Uses options set by setupH2G. Syntax runH2G (hierarchyType library file primary secondary) Arguments

hierarchy Type SINGLE | HIERARCHY. library Library name. file File path, relative to the library HDL mapping. primary Primary HDL declaration (VHDL entity or verilog module). secondary Secondary HDL declaration (VHDL architecture).

30 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference runHdlImport runHdlImport Import HDL files. Uses options set by setupHdlImport. Syntax runHdlImport (library args) Arguments

library Default target library. args Files to import (Use filelist option to import all files in a file list)

HDL Designer Series Tcl Reference Manual, V2008.1 31 September 18, 2008 HDS Tcl API Command Reference runHtmlExport runHtmlExport Run the HTML export on the given design object. Uses options set by setupHtmlExport. Syntax runHtmlExport (library unit view file) Arguments

library Library name. unit Design unit name. view View name for graphics or secondary declaration name for HDL (VHDL architecture). View name can be left empty when exporting primary unit files (e.g. graphical symbol). file File path, relative to the library HDS/HDL mapping.

32 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference setupH2G setupH2G Setup the options for runH2G. Syntax setupH2G (args) Arguments

args Option names and values. View Styles Options: createAltSmFlowChart ON|OFF If a State Diagram view cannot be created, create a (ON) FlowChart view instead. createBlockDiagram ON|OFF Create a structural Block Diagram view. (ON) createFlowChart ON|OFF (OFF) Create a Flow Chart view. createIBD ON|OFF (OFF) Create an IBD view. createLeafBlockDiagram Create a leaf level Block Diagram view. ON|OFF (OFF) createStateDiagram ON|OFF Create a State Diagram view. (OFF) createSymbolAlways ON|OFF Create a symbol even if no view styles are (OFF) selected. General Options: overwrite ON|OFF (OFF) If a graphical view already exists, overwrite it. copyOnOverwrite ON|OFF Copy a view before overwriting it. (OFF) searchLibraries Search for black box components in these libraries. setDefaultView ON|OFF (ON) Set graphical views as default. setLibrary Specify a library for a black box component. verbose ON|OFF (OFF) Display additional information during conversion. setCreateForGenerate ON|OFF Create graphical views rather than visualizations. (ON) Block Diagram Options: assignmentShape Specify the shape of concurrent assignments, if RECTANGLE|BUFFER extracted. (RECTANGLE)

HDL Designer Series Tcl Reference Manual, V2008.1 33 September 18, 2008 HDS Tcl API Command Reference setupH2G

connectEmbedded ON|OFF Create signals between embedded blocks. (OFF) createEmbeddedStateDiagram Create embedded state machines if possible. ON|OFF (OFF) defaultInstanceView ON|OFF Apply to instances in preference to a specified (OFF) view. diagramTextVisibility Specify the visibility of text associated with the NONE|ALL|PREFS (NONE) diagram. extractAssignments ON|OFF Create separate embedded blocks for concurrent (OFF) assignments. instanceLimit Maximum number of instances allowed in a Block (1000) Diagram. netTextVisibility Specify the visibility of text associated with nets. NONE|PORT_ONLY|ALL|PRE FS (PORT_ONLY) portTextVisibility Specify the visibility of text associated with NONE|NAME_ONLY|NAME_ PortIO. AND_TYPE|PREFS (PREFS) Placement Options: instanceAutoSize Size component instances to fit the visible text. WIDTH|HEIGHT|WIDTH_AND _HEIGHT|NONE (WIDTH_AND_HEIGHT) placementLimit (50) preservePlacement ON|OFF Preserve placement of existing diagrams. (OFF) Routing Options: alignPorts ON|OFF (ON) Align port I/O with connections. bundleLimit Maximum number of signals allowed in a bundle. (5) bundleSignals Bundle signals between nodes. DIRECT|INDIRECT|NONE (NONE) busReconstruct ON|OFF (OFF) Reconstruct buses for signal slices. connectionLimit net.

34 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference setupH2G

globalConnectors ON|OFF (ON) Create global connectors for global signals. movePorts ON|OFF (ON) Allow connector end points to move during routing. routeSignals ON|OFF (ON) Connect and route signals on the diagram. useDefaults Set all options to default values. Default values are shown in brackets, above.

HDL Designer Series Tcl Reference Manual, V2008.1 35 September 18, 2008 HDS Tcl API Command Reference setupHdlImport setupHdlImport Setup the options for runHdlImport. Syntax setupHdlImport (args) Arguments

args Option names and values. defaultLanguage Specify the language of source files with VHDL|VERILOG|UNKNOWN unrecognized extensions. Use UNKNOWN to (UNKNOWN) import non-HDL files. importDirectoryStructure Import directory structure of source files. ON|OFF (ON) importReferencedText ON|OFF Reference files from their original location instead (OFF) of copying. setTargetDirectory Specify a target directory within a target library. If not specified, the root of the library HDL mapping is used. setTargetLibrary Specify a library as the target for one or more source files. overwrite ON|OFF (ON) Overwrite existing files. useDefaults Set all options to default values. Default values are shown in brackets, above.

36 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference setupHtmlExport setupHtmlExport Setup the options for runHTMLExport. Syntax setupHtmlExport (args) Arguments

args Option names and values. HTML Settings: -reset_defaults Reset all options back to their defaults. -export_directory Target directory for export. -hierarchy_levels ALL| Levels of hierarchy to descend. (ALL) -export_visualizations ON|OFF Switch to creation of visualization. (ON) -include_doc_types Add a list of document types to include in the ALL| (ALL) export (see the Documentation and Visualization Options dialog box for document type names). -include_only_doc_types Make these document types the only ones included for export. More types can be added with subsequent include_doc_types calls (see the Documentation and Visualization Options dialog box for document type names). -export_all_ict ON|OFF Switch to export all ICT views. -export_generated ON|OFF (ON) Switch to export generated files. -export_sidedata_files Set the types of sidedata files to export. ALL|REGISTERED (ALL) -export_sidedata_type Set the types of sidedata to export. USER|DESIGN|ALL|NONE (ALL) -title_page AUTO| (AUTO) Set the path to the title page to use. -index_page AUTO| Set the index page name. (AUTO) Graphics Settings: -graphics_format JPEG|PNG|SVG Set the format to use when exporting graphics. (SVG) -jpeg_quality <1- 100> (100) Quality to use for JPEG graphics.

HDL Designer Series Tcl Reference Manual, V2008.1 37 September 18, 2008 HDS Tcl API Command Reference setupHtmlExport

-graphics_size <1- 100> (100) Percentage size for graphics.

38 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference setupHtmlExport Batch Mode Tasks o runTask(args) o setCompileAlways (enable) o setupTask (args) Use these commands to setup and run tasks in batch mode.

When specifying a task, be aware that it is a tcl list, with each element of the list being a level of hierarchy

As each element is separated with whitespace, be sure to escape whitespace that is part of a task name

For example, if you have a flow arranged like this:

Flow 1 |--- Tool A |--- Tool B |--- Flow 2 |--- Tool C |--- Tool D This refers to "Flow 1" : {Flow\ 1} This refers to "Tool A" : {Flow\ 1 Tool\ A} This refers to "Tool D" : {Flow\ 1 Flow\ 2 Tool\ D}

HDL Designer Series Tcl Reference Manual, V2008.1 39 September 18, 2008 HDS Tcl API Command Reference runTask runTask Run a task. Syntax runTask (args) Arguments

args Option names and values. Specify the task run. Must be specified. [library [unit [view [pathName] ] ] ] Specifies the view to run the task on. If none are specified uses design root. user If HDS finds a user and a team task with the same name, pick the user task. This is the default. team If HDS finds a user and a team task with the same name, pick the team task.

40 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference setCompileAlways (enable) setCompileAlways (enable) Enable or disable incremental compilation for all incremental compilers. Syntax setCompileAlways (enable) Arguments

enable ON|OFF: Set the global compile always switch (defaults to off)

HDL Designer Series Tcl Reference Manual, V2008.1 41 September 18, 2008 HDS Tcl API Command Reference setupTask (args) setupTask (args) Setup options for a task. Syntax setupTask (args) Arguments

Specify the task to apply these setup options to. Must be specified. setting Changes the value of the setting given by on the specified task. single Changes the hierarchy depth to be used when running the task to single level. hierarchical Changes the hierarchy depth to be used when running the task to hierarchy through blocks. throughCpt Changes the hierarchy depth to be used when running the task to hierarchy through components. user If HDS finds a user and a team task with the same name, pick the user task. This is the default. team If HDS finds a user and a team task with the same name, pick the team task.

42 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference setupTask (args) Generation Commands • runConfigGenerate • runGenerate • setupGenerate

HDL Designer Series Tcl Reference Manual, V2008.1 43 September 18, 2008 HDS Tcl API Command Reference runConfigGenerate runConfigGenerate Generate VHDL configuration files for the specified graphical objects. Uses options set by setupGenerate. Syntax runConfigGenerate (library entity arch) Arguments

library (= {}) Library name. entity (= {}) Design unit name for graphics. arch (= {}) View name (file name without extension) for graphics file.

44 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference runGenerate runGenerate Generate HDL for the specified graphical objects. Uses options set by setupGenerate. Syntax runGenerate (library entity arch) Arguments

library (= {}) Library name. (If you want to generate a whole library, then specify this value only). entity (= {}) Design unit name for graphics. arch (= {}) View name (file name with extension) for graphics file.

HDL Designer Series Tcl Reference Manual, V2008.1 45 September 18, 2008 HDS Tcl API Command Reference setupGenerate setupGenerate Setup options for runGenerate and runConfigGenerate. Syntax setupGenerate (args) Arguments

useDefaults Using this value will allow you to override your preference values to the following. generateAlways ON|OFF Always generate even if no changes have been made. Default (OFF). semanticChecking ON|OFF Default (ON). semanticWarnings ON|OFF Default (OFF). tabWidth (POSITIVE INTEGER) Default (3). autoTypeConversion NONE | Default (FULL). CONV_FUNC_ONLY | FULL> combineEntityArch ON|OFF Default (OFF). embedConfigStatements ON|OFF Default (ON). embedViewNameInConfig ON|OFF Default (ON). embedViewNameInConfig ON|OFF Default (OFF). hierarchicalConfigSpecification Default (OFF). ON|OFF thruCptsConfigSpecification ON|OFF Default (OFF). synopsysPragmasForEmbeddedConfig Default (ON). ON|OFF single This is the default. hierarchical Goes down through blocks. throughCpt Goes down through blocks and components. genericsInConfig ON|OFF Default (OFF). workAsLibInConfig ON|OFF Default (OFF). leafInConfig ON|OFF Default (OFF). viewInStandaloneConfig ON|OFF Default (OFF).

46 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference setupGenerate

customCodeGen ON|OFF Default (OFF). If you require a flat configuration file, when using runConfigGenerate specify - hierarchicalConfigSpecification and - thruCptsConfigSpecification with OFF. useDefaultCustomCodeScript ON|OFF Default (ON). Specify whether you want to use the default custom code script. includeVhdlGenProps ON|OFF Include generation properties after header in generated VHDL. includeVerilogGenProps ON|OFF Include generation properties after header in generated Verilog.

HDL Designer Series Tcl Reference Manual, V2008.1 47 September 18, 2008 HDS Tcl API Command Reference setupGenerate Library Commands • library names() • library open

48 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference library names() library names() Obtains the names of all libraries in the project. Syntax library names() Arguments

entity (= {}) Design unit name for graphics. arch (= {}) View name (file name without extension) for graphics file.

Returns List of library names.

HDL Designer Series Tcl Reference Manual, V2008.1 49 September 18, 2008 HDS Tcl API Command Reference library open library open Opens a library so its content can be examined. Syntax library open (libraryName) Arguments

libraryName The library to open.

Returns The library object, see “library object commands” on page 88.

50 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference library open Version Management Commands • runVMChangeLock (args) • runVMCheckIn (args) • runVMCheckOut (args) • runVMGet (args) • runVMHistory (args) • runVMLabel (args) • runVMSynchronize (args) • runVMUndoCheckOut (args) • setupVM (option arg) • setupVMChangeLock (option arg) • setupVMCheckIn (option arg) • setupVMCheckOut (option arg) • setupVMGet (option arg) • setupVMHierarchy (option arg) • setupVMLabel (option arg) • setupVMSynchronize (option arg)

HDL Designer Series Tcl Reference Manual, V2008.1 51 September 18, 2008 HDS Tcl API Command Reference runVMChangeLock runVMChangeLock Change lock on a specified library, design unit, view. Uses options set by setupVMChangeLock. Syntax runVMChangeLock (args) Arguments

library The library name. This is required. view View name (optional, absent if design unit not specified).

52 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference runVMCheckIn runVMCheckIn Check in a specified library, design unit, view. Uses options set by setupVMCheckIn. Syntax runVMCheckIn (args) Arguments

library The library name. This is required. designUnit Design unit name (optional). view View name (optional, absent if design unit not specified).

HDL Designer Series Tcl Reference Manual, V2008.1 53 September 18, 2008 HDS Tcl API Command Reference runVMCheckOut runVMCheckOut Check out a specified library, design unit, view. Uses options set by setupVMCheckOut. Syntax runVMCheckOut (args) Arguments

library The library name. This is required. designUnit Design unit name (optional). view View name (optional, absent if design unit not specified).

54 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference runVMGet runVMGet Get a specified library, design unit, view. Uses options set by setupVMGet. Syntax runVMGet (args) Arguments

library The library name. This is required. designUnit Design unit name (optional). view View name (optional, absent if design unit not specified).

HDL Designer Series Tcl Reference Manual, V2008.1 55 September 18, 2008 HDS Tcl API Command Reference runVMHistory runVMHistory Get the history of a specified library, design unit, view. Syntax runVMHistory (args) Arguments

library The library name. This is required. designUnit Design unit name (optional). view View name (optional, absent if design unit not specified).

56 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference runVMLabel runVMLabel Label a specified library, design unit, view. Uses options set by setupVMLabel. Syntax runVMLabel (args) Arguments

library The library name. This is required. designUnit Design unit name (optional). view View name (optional, absent if design unit not specified).

HDL Designer Series Tcl Reference Manual, V2008.1 57 September 18, 2008 HDS Tcl API Command Reference runVMSynchronize (args) runVMSynchronize (args) Synchronize a specified library, design unit, view. Uses options set by setupVMSynchronize. Syntax runVMSynchronize (args) Arguments

library The library name. This is required. designUnit Design unit name (optional). view View name (optional, absent if design unit not specified).

58 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference runVMUndoCheckOut runVMUndoCheckOut Undo the check out of a specified library, design unit, view. Syntax runVMUndoCheckOut (args) Arguments

library The library name. This is required. designUnit Design unit name (optional). view View name (optional, absent if design unit not specified).

HDL Designer Series Tcl Reference Manual, V2008.1 59 September 18, 2008 HDS Tcl API Command Reference setupVM setupVM Setup the options for Version Management. Syntax setupVM (option arg) Arguments

option Option name. arg Option value. tool Specify the library on which you want to invoke these options (this is only necessary if you want to set the repository mappings). repository Specify the repository mapping. hds_repository Specify the hds repository mapping. hdl_repository The hdl repository mapping. include_default_view ON|OFF You can choose to version manage the default view file. include_side_data ON|OFF Side data for a version managed object is included. verbose ON|OFF Additional info is displayed in the log window. create_empty_side_data Automatically create side data directories if they ON|OFF do not exist. multiple_repository_mode Repository is defined on a mapping by mapping ON|OFF basis. include_generated_hdl ON|OFF Generated HDL for a version managed object is included.

60 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference setupVMChangeLock setupVMChangeLock Setup the change lock options for Version Management. Syntax setupVMChangeLock (option arg) Arguments

option Option name. arg Option value. version The version required. change_lock ON|OFF When you lock an object, the version in your private workspace is made editable. If you unlock an object, the version in your workspace is made read-only.

HDL Designer Series Tcl Reference Manual, V2008.1 61 September 18, 2008 HDS Tcl API Command Reference setupVMCheckIn setupVMCheckIn Setup the check-in options for Version Management. Syntax setupVMCheckIn (option arg) Arguments

option Option name. arg Option value. version The version required. label You can specify a symbolic label which is associated with a particular set of objects. description Specify a description for the check in. overwrite_label ON|OFF Transfer the label to the new version number. retain_lock ON|OFF You can choose to retain a lock on the checked in objects.

62 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference setupVMCheckOut setupVMCheckOut Setup the check-out options for Version Management. Syntax setupVMCheckOut (option arg) Arguments

option Option name. arg Option value. version The version required. lock ON|OFF The objects are normally checked out with a lock to prevent concurrent editing by other users but you can choose to unset this option. comment If you are using ClearCase, you can enter a comment in the description field.

HDL Designer Series Tcl Reference Manual, V2008.1 63 September 18, 2008 HDS Tcl API Command Reference setupVMGet setupVMGet Setup the Get options for Version Management. Syntax setupVMGet (option arg) Arguments

option Option name. arg Option value. version The version required. overwrite ON|OFF Transfer the label to the new version number.

64 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference setupVMHierarchy setupVMHierarchy Setup the hierarchy options for Version Management. Syntax setupVMHierarchy (option arg) Arguments

option Option name. arg Option value. hierarchy ON|OFF Include the hierarchy below the selected object. through_components ON|OFF If hierarchy selected, then include components. through_libraries ON|OFF You can choose to limit the to the current library or operate on objects through all libraries. include_protected_libraries Include objects in protected libraries. ON|OFF packages ON|OFF Automatically include referenced VHDL packages or Verilog include files.

HDL Designer Series Tcl Reference Manual, V2008.1 65 September 18, 2008 HDS Tcl API Command Reference setupVMLabel setupVMLabel Setup the label options for Version Management. Syntax setupVMLabel (option arg) Arguments

option Option name. arg Option value. version The version required. label Specify the required label. add ON|OFF Add or remove the label. overwrite ON|OFF Transfer the label to the new version number.

66 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference setupVMSynchronize setupVMSynchronize Setup the Synchronize options for Version Management. Syntax setupVMSynchronize (option arg) Arguments

option Option name. arg Option value. version The version required. add_files ON|OFF If this option is not set, only objects that already exist are synchronized.

HDL Designer Series Tcl Reference Manual, V2008.1 67 September 18, 2008 HDS Tcl API Command Reference Dynamically Created Commands Dynamically Created Commands

Command Structure A dynamically created Tcl command consists of an HDS object or a variable holding the value of a handle to that object. The object is followed by an option possibly followed by one or more arguments and is written according to the following format:

HDS object /Option/?Arguments

68 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference HDS objects HDS objects HDS Objects listing architecture - block - blockFrame - caseFrame - configuration - declaration - elseFrame - embeddedFrame - file - forFrame - frameConfiguration - frame - ifFrame - instance - library - machineFrame - package Body

Example $lib configure class

The command in the above example is a library command in other words the HDS object referenced in this command is a library object. The variable $lib holds the value of a handle referring to the UART library.

Variables are created using the standard Tcl set command. HDS refers to objects through a set of handles.The pre-defined library open command returns a handle to the UART library that substitutes the value of the lib variable.

set lib [library open uart]

A variable can hold the value of one or more handles referring to HDS objects i.e

set fl [$lib files]

While the variable $lib holds the value of the handle hds0 which refers to the library UART, variable $fl holds the values of a set of handles referring to the UART library files.

Notice that variable names are always preceded by a $.

HDL Designer Series Tcl Reference Manual, V2008.1 69 September 18, 2008 HDS Tcl API Command Reference Option Option Options Listing configure - entity - file - frame instances - packages - configuredSubFrames - subFrames - architecture - configuredChild - close - declaration - files - hdlDirectory - packages

Example $lib configure class

All objects have a ‘configure’ command option, this provides access to the attributes of the object. If you use the configure command with no arguments, it shows the names and values of all the attributes

Arguments

Each command may have one or more argument

Command list architecture - block - blockFrame - caseFrame - configuration - declaration - elseFrame - embeddedFrame - file - forframe - frameConfiguration - frame - ifframe - instance - library - machineFrame - package Body

70 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference architecture object commands architecture object commands Associated with an implementation of an entity. Corresponds to a VHDL architecture, a Verilog module and an HDS structural or leaf graphics file.

• $architecture configure (args) • $architecture entity () • $architecture file () • $architecture frame () • $architecture instances () • $architecture packages () Table 2-1. architecture object commands Command Description $architecture configure (args) With no arguments lists the names and values of all options. The following arguments are available: class : identifies the object as an architecture name : name of the declaration itself fullName : including those of parent objects startLine : the line number where the declaration begins in the source file refName : Name that can be to refer to the object when running tasks or accessing properties $architecture entity () Gets the entity associated with the architecture. Refer to “entity option object commands” on page 79. Returns: The entity object. $architecture file () Obtains the file containing the object. Returns: A single object, refer to“file object commands” on page 81. $architecture frame () Obtains the root frame of the architecture. Refer to “frame object commands” on page 85. Returns: The root frame. $architecture instances () Gets all the instances in all frames of the architecture. Refer to “instance object commands” on page 87. $architecture packages () Obtains the packages referenced. Returns: A list of packages, refer to “packageHeader object commands” on page 91, or an empty list if the declaration is not VHDL.

HDL Designer Series Tcl Reference Manual, V2008.1 71 September 18, 2008 HDS Tcl API Command Reference blockFrame object commands blockFrame object commands A VHDL block statement

• $blockFrame configure (args) • $blockFrame configuredSubFrames (frameConfiguration) • $blockFrame instances () • $blockFrame subFrames () Table 2-2. blockFrame object commands Command Description $blockFrame configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments class : identifies the object as a blockFrame name : $blockFrameconfiguredSubFrames Obtains the sub-frames. (frameConfiguration) Arguments frameConfiguration : defines a level in a VHDL configuration declaration from which the bindings are selected Returns A list of sub-frame information, each consecutive pair represents a frame and a frameConfiguration in that order. $blockFrame instances () Obtains the component instances; Instances contained within a sub-frame are not included. Refer to “instance object commands” on page 87. Returns A list of instances. $blockFrame subFrames () Obtains the sub-frames. Returns A list of sub-frames.

72 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference caseFrame object commands caseFrame object commands A Verilog case statement

• $caseFrame configure (args) • $caseFrame configuredSubFrames (frameConfiguration) • $caseFrame instances () • $caseFrame subFrames () Table 2-3. caseFrame object commands Command Description $caseFrame configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments class : identifies the object as a caseFrame name : $caseFrame configuredSubFrames Obtains the sub-frames. (frameConfiguration) Arguments frameConfiguration :defines a level in a VHDL configuration declaration from which the bindings are selected Returns A list of sub-frame information, each consecutive pair represents a frame and a frameConfiguration in that order. $caseFrame instances () Obtains the component instances, directly contained within the frame. Instances contained within a sub-frame are not included. Refer to “instance object commands” on page 87. Returns A list of instances. $caseFrame subFrames () Obtains the sub-frames. Returns A list of sub-frames.

HDL Designer Series Tcl Reference Manual, V2008.1 73 September 18, 2008 HDS Tcl API Command Reference configuration object commands configuration object commands A VHDL configuration declaration

• $configuration architecture () • $configuration configure (args) • $configuration file () • $configuration frameConfiguration () • $configuration packages () Table 2-4. configuration object commands Command Description $configuration architecture () Gets the architecture associated with the configuration. Refer to“architecture object commands” on page 71. Returns The architecture object. $configuration configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments class : identifies the object as a configuration name : name of the declaration itself fullName : fully qualified name including those of parent objects startLine : the line number where the declaration begins in the source file refName : Name that can be to refer to the object when running tasks or accessing properties $configuration file () Obtain the file containing the object. Returns A single object. Refer to “file object commands” on page 81.

74 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference configuration object commands

Table 2-4. configuration object commands (cont.) Command Description $configuration frameConfiguration () Gets the frame configuration associated with the configuration, refer to “frameConfiguration object commands” on page 84. Returns The architecture object. $configuration packages () Obtains the packages referenced. Returns A list of packages, refer to “packageHeader object commands” on page 91, or an empty list if the declaration is not VHDL.

HDL Designer Series Tcl Reference Manual, V2008.1 75 September 18, 2008 HDS Tcl API Command Reference declaration object commands declaration object commands • $declaration configure (args) • $declaration file () • $declaration packages () Table 2-5. declaration object commands Command Description $declaration configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments name : name of the declaration itself fullName : fully qualified name including those of parent objects startLine : the line number where the declaration begins in the source file refName : Name that can be to refer to the object when running tasks or accessing properties class : identifies the object as a declaration $declaration file () Obtains the file containing the object. Returns A single object, refer to “file object commands” on page 81. $declaration packages () Obtains the packages referenced. Returns A list of packages, see “packageHeader object commands” on page 91, or an empty list if the declaration is not VHDL.

76 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference elseFrame object commands elseFrame object commands A Verilog `else statement

• $elseFrame configure (args) • $elseFrame configuredSubFrames (frameConfiguration) • $elseFrame instances () • $elseFrame subFrames () Table 2-6. elseFrame object commands Command Description $elseFrame configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments class : identifies the object as an elseFrame name : $elseFrame configuredSubFrames Obtains the sub-frames. (frameConfiguration) Argument frameConfiguration :defines a level in a VHDL configuration declaration from which the bindings are selected Returns A list of sub-frame information, each consecutive pair represents a frame and a frameConfiguration in that order. $elseFrame instances () Obtains the component instances, refer to“instance object commands” on page 87, directly contained within the frame. Instances contained within a sub- frame are not included. Returns A list of instances. $elseFrame subFrames () Obtains the sub-frames. Returns A list of sub-frames.

HDL Designer Series Tcl Reference Manual, V2008.1 77 September 18, 2008 HDS Tcl API Command Reference embeddedFrame object commands embeddedFrame object commands Represents an embedded text within a graphics file

• $embeddedFrame configure (args) • $embeddedFrame configuredSubFrames (frameConfiguration) • $embeddedFrame instances () • $embeddedFrame subFrames () Table 2-7. embeddedFrame object commands Command Description $embeddedFrame configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments class : identifies the object as an embeddedFrame name : $embeddedFrame configuredSubFrames Obtains the sub-frames. (frameConfiguration) Argument frameConfiguration :defines a level in a VHDL configuration declaration from which the bindings are selected Returns A list of sub-frame information, each consecutive pair represents a frame and a frameConfiguration in that order. $embeddedFrame instances () Obtains the component instances, refer to “instance object commands” on page 87, directly contained within the frame. Instances contained within a sub-frame are not included. Returns A list of instances. $embeddedFrame subFrames () Obtains the sub-frames. Returns A list of sub-frames.

78 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference entity option object commands entity option object commands Associated with the interface to a design unit. Corresponds to a VHDL entity, a Verilog module and an HDS symbol or block interface file

• $entity architecture (name) • $entity configure (args) • $entity file () • $entity packages () Table 2-8. entity option object commands Command Description $entity architecture (name) Obtains the architecture for an entity. Argument name (= {}) The name of the architecture to find, if omitted uses the default view settings to choose between alternative architectures. Returns The matching architecture, refer to “architecture object commands” on page 71. $entity configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments class : identifies the object as an entity name : name of the declaration itself fullName : fully qualified name including those of parent objects startLine : the line number where the declaration begins in the source file refName : Name that can be to refer to the object when running tasks or accessing properties $entity file () Obtains the file containing the object. Returns: A single object, refer to “file object commands” on page 81.

HDL Designer Series Tcl Reference Manual, V2008.1 79 September 18, 2008 HDS Tcl API Command Reference entity option object commands

Table 2-8. entity option object commands (cont.) Command Description $entity packages () Obtains the packages referenced. Returns A list of packages, see “packageHeader object commands” on page 91, or an empty list if the declaration is not VHDL.

80 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference file object commands file object commands • $file configure (args) • $file declarations () • $file generated () • $file includes () • $file library () Table 2-9. file object commands Command Description $file configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments relativePathname : pathname relative to the library mapping language : HDL language version : version checked out from the version management system timestamp : time the file was last modified type : identifies the type of the file exclusionType : designDir : The full hard pathname of the design side data directory userDir : The full hard pathname of the design side data directory refName : Name that can be to refer to the object when running tasks or accessing properties class : identifies the object as a file $file declarations () Obtains the declarations in the file. Returns A list of declaration objects. $file generated () Gets the HDL file generated from the current file. Returns The file.

HDL Designer Series Tcl Reference Manual, V2008.1 81 September 18, 2008 HDS Tcl API Command Reference file object commands

Table 2-9. file object commands (cont.) Command Description $file includes () Gets the include files. Returns A list of files or the empty list of the language is not Verilog. $file library () Gets the library containing the file. Returns The library.

82 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference forFrame object commands forFrame object commands A VHDL 'for generate' statement.

• $forFrame configure (args) • $forFrame configuredSubFrames (frameConfiguration) • $forFrame instances () • $forFrame subFrames () Table 2-10. forFrame object commands Command Description $forFrame configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments leftBound : rightBound : class : identifies the object as a forFrame name : $forFrame configuredSubFrames Obtains the sub-frames. (frameConfiguration) Arguments frameConfiguration: defines a level in a VHDL configuration declaration from which the bindings are selected Returns A list of sub-frame information, each consecutive pair represents a frame and a frameConfiguration in that order. $forFrame instances () Obtains the component instances, refer to “instance object commands” on page 87, directly contained within the frame. Instances contained within a sub-frame are not included. Returns A list of instances. $forFrame subFrames () Obtains the sub-frames. Returns A list of sub-frames.

HDL Designer Series Tcl Reference Manual, V2008.1 83 September 18, 2008 HDS Tcl API Command Reference frameConfiguration object commands frameConfiguration object commands Represents a single level within the hierarchical structure of a VHDL configuration declaration, see configurationRefApi.tcl. These objects have do little in themselves but are passed as arguments to control the path through the design hierarchy. Refer to configuredChild in “instance object commands” on page 87 and configuredSubFrames in“architecture object commands” on page 71.

$frameConfiguration configure (args) Table 2-11. frameConfiguration object commands Command Description $frameConfiguration configure With no arguments lists the names and values of all (args) options. With one argument lists the value of the specified option. Arguments: name : class : identifies the object as a frameConfiguration

84 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference frame object commands frame object commands • $frame configure (args) • $frame configuredSubFrames (frameConfiguration) • $frame instances () • $frame subFrames () Table 2-12. frame object commands Command Description $frame configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments name : class : identifies the object as a frame $frame configuredSubFrames Obtains the sub-frames. (frameConfiguration) Argument frameConfiguration: defines a level in a VHDL configuration declaration from which the bindings are selected Returns A list of sub-frame information, each consecutive pair represents a frame and a frameConfiguration in that order. $frame instances () Obtains the component instances, see “instance object commands” on page 87, directly contained within the frame. Instances contained within a sub- frame are not included. Returns A list of instances. $frame subFrames () Obtains the sub-frames. Returns A list of sub-frames.

HDL Designer Series Tcl Reference Manual, V2008.1 85 September 18, 2008 HDS Tcl API Command Reference ifFrame object commands ifFrame object commands A VHDL 'if generate' statement or a Verilog 'ifdef

• $ifFrame configure (args) • $ifFrame configuredSubFrames (frameConfiguration) • $ifFrame instances () • $ifFrame subFrames () Table 2-13. ifFrame object commands Command Description $ifFrame configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments class : identifies the object as an ifFrame name : $ifFrame configuredSubFrames Obtains the sub-frames. (frameConfiguration) Argument frameConfiguration: defines a level in a VHDL configuration declaration from which the bindings are selected Returns A list of sub-frame information, each consecutive pair represents a frame and a frameConfiguration in that order. $ifFrame instances () Obtains the component instances, see“instance object commands” on page 87, directly contained within the frame. Instances contained within a sub- frame are not included. Returns A list of instances. $ifFrame subFrames () Obtains the sub-frames. Returns A list of sub-frames.

86 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference instance object commands instance object commands A component instance in a block diagram, IBD or structural HDL text file.

• $instance child () • $instance configure (args) • $instance configuredChild (frameConfiguration) Table 2-14. instance object commands Command Description $instance child () Obtains the architecture under the component instance. Returns The architecture object. $instance configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments name : class : identifies the object as an instance $instance configuredChild Like 'child' but supporting VHDL configuration (frameConfiguration) declarations. Arguments frameConfiguration see “frameConfiguration object commands” on page 84. Returns A 3 element list containing: The configuration declaration object, if specified in the component binding; see “configuration object commands” on page 74. The architecture object, see“architecture object commands” on page 71. The frame configuration for the root of the child architecture.

HDL Designer Series Tcl Reference Manual, V2008.1 87 September 18, 2008 HDS Tcl API Command Reference library object commands library object commands A library object is obtained from the 'library open' command. It provides access to the files and declarations within the library.

• $library close () • $library configure (args) • $library declaration (primaryName secondaryName) • $library file (relativePathname) • $library files () • $library hdlDirectory () Table 2-15. library object commands Command Description $library close () Removes the library from memory. It is an error to close a library while an editor window or Design Explorer tab is showing design items in the library. Returns None. $library configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments name : name of the library type : regular, standard or downstreamOnly hdlDir : directory as literally given hdsDir : directory as literally given hardHdlDir : directory with variables expanded hardHdsDir : directory with variables expanded refName : Name that can be to refer to the object when running tasks or accessing properties class : identifies the object as a library

88 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference library object commands

Table 2-15. library object commands (cont.) Command Description $library declaration (primaryName Finds an entity, architecture, package or secondaryName) configuration declaration by name. Raises an error if a matching architecture is not available. Argument primaryName:name to look for secondaryName (= {}) :only specified when looking for an architecture can be the empty string if the default architecture should be used Returns The matching declaration. $library file (relativePathname) Finds a file, raises an error if not available. Argument relativePathname:pathname of the file relative to the of the library. Returns The file object. $library files () Obtains the files of the library, see “file object commands” on page 81. Returns List of files. $library hdlDirectory () Obtains the root HDL directory of the library. Returns Directory object.

HDL Designer Series Tcl Reference Manual, V2008.1 89 September 18, 2008 HDS Tcl API Command Reference machineFrame object commands machineFrame object commands Represents hierarchy or concurrency within a state machine, algorithmic state machine or flow chart file.

• $machineFrame configure (args) • $machineFrame configuredSubFrames (frameConfiguration) • $machineFrame instances () • $machineFrame subFrames () Table 2-16. machineFrame object commands Command Description $machineFrame configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments class : identifies the object as a machineFrame name : $machineFrameconfiguredSubFrames Obtains the sub-frames. (frameConfiguration) Arguments frameConfiguration: defines a level in a VHDL configuration declaration from which the bindings are selected Returns A list of sub-frame information, each consecutive pair represents a frame and a frameConfiguration in that order. $machineFrame instances () Obtains the component instances, see“instance object commands” on page 87, directly contained within the frame. Instances contained within a sub-frame are not included. Returns A list of instances. $machineFrame subFrames () Obtains the sub-frames. Returns A list of sub-frames.

90 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference packageHeader object commands packageHeader object commands • $packageHeader body () • $packageHeader configure (args) • $packageHeader file () • $packageHeader packages () Table 2-17. packageHeader object commands Command Description $packageHeader body () Gets the package body implementing the interface of a package header, see “packageBody object commands” on page 92. Returns The body object. $packageHeader configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments class : identifies the object as a packageHeader name : name of the declaration itself fullName : fully qualified name including those of parent objects startLine : the line number where the declaration begins in the source file refName : Name that can be to refer to the object when running tasks or accessing properties $packageHeader file () Obtains the file containing the object. Returns A single object, see “file object commands” on page 81. $packageHeader packages () Obtains the packages referenced. Returns A list of packages, see “packageHeader object commands” on page 91, or an empty list if the declaration is not VHDL.

HDL Designer Series Tcl Reference Manual, V2008.1 91 September 18, 2008 HDS Tcl API Command Reference packageBody object commands packageBody object commands A VHDL package body

• $packageBody configure (args) • $packageBody file () • $packageBody packages () Table 2-18. packageBody object commands Command Description $packageBody configure (args) With no arguments lists the names and values of all options. With one argument lists the value of the specified option. Arguments class : identifies the object as a packageBody name : name of the declaration itself fullName : fully qualified name including those of parent objects startLine : the line number where the declaration begins in the source file refName : Name that can be to refer to the object when running tasks or accessing properties $packageBody file () Obtains the file containing the object. Returns A single object, see “file object commands” on page 81. $packageBody packages () Obtains the packages referenced. Returns A list of packages, see “packageHeader object commands” on page 91, or an empty list if the declaration is not VHDL.

Command List addLibraryMapping configureProperties invokeGUI () setDefaultView

92 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference Command List

setRulesetLocation runH2G runHdlImport runHtmlExport setupH2G setupHdlImport setupHtmlExport runTask setCompileAlways (enable) setupTask (args) runConfigGenerate runGenerate setupGenerate library names() library open runVMChangeLock runVMCheckIn runVMCheckOut runVMGet runVMHistory runVMLabel runVMSynchronize (args) runVMUndoCheckOut setupVM setupVMChangeLock setupVMCheckIn setupVMCheckOut setupVMGet setupVMHierarchy setupVMLabel setupVMSynchronize $architecture entity () $architecture file () $architecture frame () $architecture instances () $architecture packages () $blockFrame configure (args) $blockFrame configuredSubFrames (frameConfiguration) $blockFrame instances () $blockFrame subFrames () $caseFrame configure (args) $caseFrame configuredSubFrames (frameConfiguration) $caseFrame instances () $caseFrame subFrames () $configuration architecture ()

HDL Designer Series Tcl Reference Manual, V2008.1 93 September 18, 2008 HDS Tcl API Command Reference Command List

$configuration configure (args) $configuration file () $configuration frameConfiguration () $configuration packages () $declaration configure (args) $declaration file () $declaration packages () $elseFrame configure (args) $elseFrame configuredSubFrames (frameConfiguration) $elseFrame instances () $elseFrame subFrames () $embeddedFrame configure (args) $embeddedFrame configuredSubFrames (frameConfiguration) $embeddedFrame instances () $embeddedFrame subFrames () $embeddedFrame configure (args) $embeddedFrame configuredSubFrames (frameConfiguration) $embeddedFrame instances () $embeddedFrame subFrames () $file configure (args) $file declarations () $file generated () $file includes () $file library () $forFrame configure (args) $forFrame configuredSubFrames (frameConfiguration) $forFrame instances () $forFrame subFrames () $frameConfiguration configure (args) $frame configure (args) $frame configuredSubFrames (frameConfiguration) $frame instances () $frame subFrames () $ifFrame configure (args) $ifFrame configuredSubFrames (frameConfiguration) $ifFrame instances () $ifFrame subFrames () $instance child () $instance configure (args) $instance configuredChild (frameConfiguration) $library close () $library configure (args) $library declaration (primaryName secondaryName) $library file (relativePathname) $library files ()

94 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 HDS Tcl API Command Reference Command List

$library hdlDirectory () $machineFrame configure (args) $machineFrame configuredSubFrames (frameConfiguration) $machineFrame instances () $machineFrame subFrames () $packageHeader body () $packageHeader configure (args) $packageHeader file () $packageHeader packages () $packageBody configure (args) $packageBody file () $packageBody packages ()

HDL Designer Series Tcl Reference Manual, V2008.1 95 September 18, 2008 HDS Tcl API Command Reference Command List

96 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 ABCED FG HIJKLMNOPQRSTUVXWYZ

Index

Index $embeddedFrame subFrames (), 78 — Symbols — $entity architecture (name), 79 $architecture configure (args), 71 $entity configure (args), 79 $architecture entity (), 71 $entity file (), 79 $architecture file (), 71 $entity option (arg), 79 $architecture frame (), 71 $entity packages (), 80 $architecture instances (), 71 $file configure (args), 81 $architecture packages (), 71 $file declarations (), 81 $architecture/option/arguments, 71 $file generated (), 81 $blockFrame configure (args), 72 $file includes (), 82 $blockFrame configuredSubFrames $file library (), 82 (frameConfiguration), 72 $forFrame configure (args), 83 $blockFrame instances (), 72 $forFrame configuredSubFrames $blockFrame subFrames (), 72 (frameConfiguration), 83 $caseFrame configure (args), 73 $forFrame instances (), 83 $caseFrame configuredSubFrames $forFrame option (args), 83 (frameConfiguration), 73 $forFrame subFrames (), 83 $caseFrame instances (), 73 $frame configure (args), 85 $caseFrame option (args), 73 $frame configuredSubFrames $caseFrame subFrames (), 73 (frameConfiguration), 85 $configuration architecture (), 74 $frame instances (), 85 $configuration configure (args), 74 $frame option (args), 85 $configuration file (), 74 $frame subFrames (), 85 $configuration frameConfiguration (), 75 $frameConfiguration configure (args), 84 $configuration option (args), 74 $ifFrame configure (args), 86 $configuration packages (), 75 $ifFrame configuredSubFrames $declaration configure (args), 76 (frameConfiguration), 86 $declaration file (), 76 $ifFrame instances (), 86 $declaration option (args), 76 $ifFrame option (args), 86 $declaration packages (), 76 $ifFrame subFrames (), 86 $elseFrame configure (args), 77 $instance child (), 87 $elseFrame configuredSubFrames $instance configure (args), 87 (frameConfiguration), 77 $instance configuredChild $elseFrame instances (), 77 (frameConfiguration), 87 $elseFrame subFrames (), 77 $instance option (), 87 $embeddedFrame configure (args), 78 $library close (), 88 $embeddedFrame configuredSubFrames $library configure (args), 88 (frameConfiguration), 78 $library declaration (primaryName $embeddedFrame instances (), 78 secondaryName), 89 $embeddedFrame option (args), 78 $library file (relativePathname), 89

HDL Designer Series Tcl Reference Manual, V2008.1 97 September 18, 2008 ABCED FG HIJKLMNOPQRSTUVXWYZ

$library files (), 89 entity option object commands, 79 $library hdlDirectory (), 89 Example Scripts, 11 $library option (), 88 $machineFrame configure (args), 90 — F — $machineFrame configuredSubFrames file object commands, 81 (frameConfiguration), 90 forFrame object commands, 83 $machineFrame instances (), 90 frame object commands, 85 $machineFrame option (args), 90 frameConfiguration object commands, 84 $machineFrame subFrames (), 90 — G — $packageBody configure (args), 92 Generated HDL File Paths, 11 $packageBody file (), 92 $packageBody option (args), 92 — H — $packageBody packages (), 92 HDS objects, 69 $packageHeader body (), 91 Hierarchy $packageHeader configure (args), 91 Pruning, 19 $packageHeader file (), 91 $packageHeader packages (), 91 — I — ifFrame object commands, 86 — A — instance object commands, 87 addLibraryMapping, 24 invokeGUI (), 26 API Command Modes, 9 architecture object commands, 71 — L — library names (), 49 — B — library object commands, 88 blockFrame object commands, 72 library open (libraryName), 50 — C — — M — caseFrame object commands, 73 machineFrame object commands, 90 Command Basics, 10 Compilation Order, 20 — P — packageBody object commands, 92 configuration object commands, 74 packageHeader object commands, 91 configureProperties (designObject args), 25 Console — R — Accessing, 9 runConfigGenerate (library entity arch), 44 — D — runGenerate (library entity arch), 45 declaration object commands, 76 runH2G (hierarchyType library file primary Design Hierarchy and Frames, 17 secondary), 30 Design Hierarchy and VHDL Configurations, runHdlImport (library args), 31 18 runTask (args), 40 Design Hierarchy Traversal, Robust, 16 runVMChangeLock (args), 52 Design Hierarchy Traversal, Simple, 14 runVMCheckIn (args), 53 Document Conventions, 10 runVMCheckOut (args), 54 runVMGet (args), 55 — E — runVMHistory (args), 56 elseFrame object commands, 77 runVMLabel (args), 57 embeddedFrame object commands, 78 runVMSynchronize (args), 58

98 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 ABCED FG HIJKLMNOPQRSTUVXWYZ runVMUndoCheckOut (args), 59 — S — setCompileAlways (enable), 41 setDefaultView (library file primary secondary), 27 setRulesetLocation (location), 28 setupGenerate (args), 46 setupH2G (args), 33 setupHdlImport (args), 36 setupTask (args), 42 setupVM (option arg), 60 setupVMChangeLock (option arg), 61 setupVMCheckIn (option arg), 62 setupVMCheckOut (option arg), 63 setupVMGet (option arg), 64 setupVMHierarchy (option arg), 65 setupVMLabel (option arg), 66 setupVMSynchronize (option arg), 67 — V — Verilog Include Files, 14 VHDL Packages, 13

HDL Designer Series Tcl Reference Manual, V2008.1 99 September 18, 2008 ABCED FG HIJKLMNOPQRSTUVXWYZ

100 HDL Designer Series Tcl Reference Manual, V2008.1 September 18, 2008 End-User License Agreement The latest version of the End-User License Agreement is available on-line at: www.mentor.com/terms_conditions/enduser.cfm

IMPORTANT INFORMATION USE OF THIS SOFTWARE IS SUBJECT TO LICENSE RESTRICTIONS. CAREFULLY READ THIS LICENSE AGREEMENT BEFORE USING THE SOFTWARE. USE OF SOFTWARE INDICATES YOUR COMPLETE AND UNCONDITIONAL ACCEPTANCE OF THE TERMS AND CONDITIONS SET FORTH IN THIS AGREEMENT. ANY ADDITIONAL OR DIFFERENT PURCHASE ORDER TERMS AND CONDITIONS SHALL NOT APPLY.

END-USER LICENSE AGREEMENT (“Agreement”)

This is a legal agreement concerning the use of Software between you, the end user, as an authorized representative of the company acquiring the license, and Mentor Graphics Corporation and Mentor Graphics (Ireland) Limited acting directly or through their subsidiaries (collectively “Mentor Graphics”). Except for license agreements related to the subject matter of this license agreement which are physically signed by you and an authorized representative of Mentor Graphics, this Agreement and the applicable quotation contain the parties' entire understanding relating to the subject matter and supersede all prior or contemporaneous agreements. If you do not agree to these terms and conditions, promptly return or, if received electronically, certify destruction of Software and all accompanying items within five days after receipt of Software and receive a full refund of any license fee paid.

1. GRANT OF LICENSE. The software programs, including any updates, modifications, revisions, copies, documentation and design data (“Software”), are copyrighted, trade secret and confidential information of Mentor Graphics or its licensors who maintain exclusive title to all Software and retain all rights not expressly granted by this Agreement. Mentor Graphics grants to you, subject to payment of appropriate license fees, a nontransferable, nonexclusive license to use Software solely: (a) in machine-readable, object-code form; (b) for your internal business purposes; (c) for the license term; and (d) on the computer hardware and at the site authorized by Mentor Graphics. A site is restricted to a one-half mile (800 meter) radius. Mentor Graphics’ standard policies and programs, which vary depending on Software, license fees paid or services purchased, apply to the following: (a) relocation of Software; (b) use of Software, which may be limited, for example, to execution of a single session by a single user on the authorized hardware or for a restricted period of time (such limitations may be technically implemented through the use of authorization codes or similar devices); and (c) support services provided, including eligibility to receive telephone support, updates, modifications, and revisions.

2. EMBEDDED SOFTWARE. If you purchased a license to use embedded software development (“ESD”) Software, if applicable, Mentor Graphics grants to you a nontransferable, nonexclusive license to reproduce and distribute executable files created using ESD compilers, including the ESD run-time libraries distributed with ESD C and C++ compiler Software that are linked into a composite program as an integral part of your compiled computer program, provided that you distribute these files only in conjunction with your compiled computer program. Mentor Graphics does NOT grant you any right to duplicate, incorporate or embed copies of Mentor Graphics' real-time operating systems or other embedded software products into your products or applications without first signing or otherwise agreeing to a separate agreement with Mentor Graphics for such purpose.

3. BETA CODE. Software may contain code for experimental testing and evaluation (“Beta Code”), which may not be used without Mentor Graphics’ explicit authorization. Upon Mentor Graphics’ authorization, Mentor Graphics grants to you a temporary, nontransferable, nonexclusive license for experimental use to test and evaluate the Beta Code without charge for a limited period of time specified by Mentor Graphics. This grant and your use of the Beta Code shall not be construed as marketing or offering to sell a license to the Beta Code, which Mentor Graphics may choose not to release commercially in any form. If Mentor Graphics authorizes you to use the Beta Code, you agree to evaluate and test the Beta Code under normal conditions as directed by Mentor Graphics. You will contact Mentor Graphics periodically during your use of the Beta Code to discuss any malfunctions or suggested improvements. Upon completion of your evaluation and testing, you will send to Mentor Graphics a written evaluation of the Beta Code, including its strengths, weaknesses and recommended improvements. You agree that any written evaluations and all inventions, product improvements, modifications or developments that Mentor Graphics conceived or made during or subsequent to this Agreement, including those based partly or wholly on your feedback, will be the exclusive property of Mentor Graphics. Mentor Graphics will have exclusive rights, title and interest in all such property. The provisions of this section 3 shall survive the termination or expiration of this Agreement. 4. RESTRICTIONS ON USE. You may copy Software only as reasonably necessary to support the authorized use. Each copy must include all notices and legends embedded in Software and affixed to its medium and container as received from Mentor Graphics. All copies shall remain the property of Mentor Graphics or its licensors. You shall maintain a record of the number and primary location of all copies of Software, including copies merged with other software, and shall make those records available to Mentor Graphics upon request. You shall not make Software available in any form to any person other than employees and on-site contractors, excluding Mentor Graphics' competitors, whose job performance requires access and who are under obligations of confidentiality. You shall take appropriate action to protect the confidentiality of Software and ensure that any person permitted access to Software does not disclose it or use it except as permitted by this Agreement. Except as otherwise permitted for purposes of interoperability as specified by applicable and mandatory local law, you shall not reverse-assemble, reverse-compile, reverse-engineer or in any way derive from Software any source code. You may not sublicense, assign or otherwise transfer Software, this Agreement or the rights under it, whether by operation of law or otherwise (“attempted transfer”), without Mentor Graphics’ prior written consent and payment of Mentor Graphics’ then-current applicable transfer charges. Any attempted transfer without Mentor Graphics' prior written consent shall be a material breach of this Agreement and may, at Mentor Graphics' option, result in the immediate termination of the Agreement and licenses granted under this Agreement. The terms of this Agreement, including without limitation, the licensing and assignment provisions shall be binding upon your successors in interest and assigns. The provisions of this section 4 shall survive the termination or expiration of this Agreement.

5. LIMITED WARRANTY.

5.1. Mentor Graphics warrants that during the warranty period Software, when properly installed, will substantially conform to the functional specifications set forth in the applicable user manual. Mentor Graphics does not warrant that Software will meet your requirements or that operation of Software will be uninterrupted or error free. The warranty period is 90 days starting on the 15th day after delivery or upon installation, whichever first occurs. You must notify Mentor Graphics in writing of any nonconformity within the warranty period. This warranty shall not be valid if Software has been subject to misuse, unauthorized modification or improper installation. MENTOR GRAPHICS' ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL BE, AT MENTOR GRAPHICS' OPTION, EITHER (A) REFUND OF THE PRICE PAID UPON RETURN OF SOFTWARE TO MENTOR GRAPHICS OR (B) MODIFICATION OR REPLACEMENT OF SOFTWARE THAT DOES NOT MEET THIS LIMITED WARRANTY, PROVIDED YOU HAVE OTHERWISE COMPLIED WITH THIS AGREEMENT. MENTOR GRAPHICS MAKES NO WARRANTIES WITH RESPECT TO: (A) SERVICES; (B) SOFTWARE WHICH IS LICENSED TO YOU FOR A LIMITED TERM OR LICENSED AT NO COST; OR (C) EXPERIMENTAL BETA CODE; ALL OF WHICH ARE PROVIDED “AS IS.”

5.2. THE WARRANTIES SET FORTH IN THIS SECTION 5 ARE EXCLUSIVE. NEITHER MENTOR GRAPHICS NOR ITS LICENSORS MAKE ANY OTHER WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, WITH RESPECT TO SOFTWARE OR OTHER MATERIAL PROVIDED UNDER THIS AGREEMENT. MENTOR GRAPHICS AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT OF INTELLECTUAL PROPERTY.

6. LIMITATION OF LIABILITY. EXCEPT WHERE THIS EXCLUSION OR RESTRICTION OF LIABILITY WOULD BE VOID OR INEFFECTIVE UNDER APPLICABLE LAW, IN NO EVENT SHALL MENTOR GRAPHICS OR ITS LICENSORS BE LIABLE FOR INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS) WHETHER BASED ON CONTRACT, TORT OR ANY OTHER LEGAL THEORY, EVEN IF MENTOR GRAPHICS OR ITS LICENSORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO EVENT SHALL MENTOR GRAPHICS' OR ITS LICENSORS' LIABILITY UNDER THIS AGREEMENT EXCEED THE AMOUNT PAID BY YOU FOR THE SOFTWARE OR SERVICE GIVING RISE TO THE CLAIM. IN THE CASE WHERE NO AMOUNT WAS PAID, MENTOR GRAPHICS AND ITS LICENSORS SHALL HAVE NO LIABILITY FOR ANY DAMAGES WHATSOEVER. THE PROVISIONS OF THIS SECTION 6 SHALL SURVIVE THE EXPIRATION OR TERMINATION OF THIS AGREEMENT.

7. LIFE ENDANGERING ACTIVITIES. NEITHER MENTOR GRAPHICS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY DAMAGES RESULTING FROM OR IN CONNECTION WITH THE USE OF SOFTWARE IN ANY APPLICATION WHERE THE FAILURE OR INACCURACY OF THE SOFTWARE MIGHT RESULT IN DEATH OR PERSONAL INJURY. THE PROVISIONS OF THIS SECTION 7 SHALL SURVIVE THE EXPIRATION OR TERMINATION OF THIS AGREEMENT.

8. INDEMNIFICATION. YOU AGREE TO INDEMNIFY AND HOLD HARMLESS MENTOR GRAPHICS AND ITS LICENSORS FROM ANY CLAIMS, LOSS, COST, DAMAGE, EXPENSE, OR LIABILITY, INCLUDING ATTORNEYS' FEES, ARISING OUT OF OR IN CONNECTION WITH YOUR USE OF SOFTWARE AS DESCRIBED IN SECTION 7. THE PROVISIONS OF THIS SECTION 8 SHALL SURVIVE THE EXPIRATION OR TERMINATION OF THIS AGREEMENT.

9. INFRINGEMENT.

9.1. Mentor Graphics will defend or settle, at its option and expense, any action brought against you alleging that Software infringes a patent or copyright or misappropriates a trade secret in the United States, Canada, Japan, or member state of the European Patent Office. Mentor Graphics will pay any costs and damages finally awarded against you that are attributable to the infringement action. You understand and agree that as conditions to Mentor Graphics' obligations under this section you must: (a) notify Mentor Graphics promptly in writing of the action; (b) provide Mentor Graphics all reasonable information and assistance to defend or settle the action; and (c) grant Mentor Graphics sole authority and control of the defense or settlement of the action.

9.2. If an infringement claim is made, Mentor Graphics may, at its option and expense: (a) replace or modify Software so that it becomes noninfringing; (b) procure for you the right to continue using Software; or (c) require the return of Software and refund to you any license fee paid, less a reasonable allowance for use.

9.3. Mentor Graphics has no liability to you if infringement is based upon: (a) the combination of Software with any product not furnished by Mentor Graphics; (b) the modification of Software other than by Mentor Graphics; (c) the use of other than a current unaltered release of Software; (d) the use of Software as part of an infringing process; (e) a product that you make, use or sell; (f) any Beta Code contained in Software; (g) any Software provided by Mentor Graphics’ licensors who do not provide such indemnification to Mentor Graphics’ customers; or (h) infringement by you that is deemed willful. In the case of (h) you shall reimburse Mentor Graphics for its attorney fees and other costs related to the action upon a final judgment.

9.4. THIS SECTION IS SUBJECT TO SECTION 6 ABOVE AND STATES THE ENTIRE LIABILITY OF MENTOR GRAPHICS AND ITS LICENSORS AND YOUR SOLE AND EXCLUSIVE REMEDY WITH RESPECT TO ANY ALLEGED PATENT OR COPYRIGHT INFRINGEMENT OR TRADE SECRET MISAPPROPRIATION BY ANY SOFTWARE LICENSED UNDER THIS AGREEMENT.

10. TERM. This Agreement remains effective until expiration or termination. This Agreement will immediately terminate upon notice if you exceed the scope of license granted or otherwise fail to comply with the provisions of Sections 1, 2, or 4. For any other material breach under this Agreement, Mentor Graphics may terminate this Agreement upon 30 days written notice if you are in material breach and fail to cure such breach within the 30 day notice period. If Software was provided for limited term use, this Agreement will automatically expire at the end of the authorized term. Upon any termination or expiration, you agree to cease all use of Software and return it to Mentor Graphics or certify deletion and destruction of Software, including all copies, to Mentor Graphics’ reasonable satisfaction.

11. EXPORT. Software is subject to regulation by local laws and United States government agencies, which prohibit export or diversion of certain products, information about the products, and direct products of the products to certain countries and certain persons. You agree that you will not export any Software or direct product of Software in any manner without first obtaining all necessary approval from appropriate local and United States government agencies.

12. RESTRICTED RIGHTS NOTICE. Software was developed entirely at private expense and is commercial computer software provided with RESTRICTED RIGHTS. Use, duplication or disclosure by the U.S. Government or a U.S. Government subcontractor is subject to the restrictions set forth in the license agreement under which Software was obtained pursuant to DFARS 227.7202-3(a) or as set forth in subparagraphs (c)(1) and (2) of the Commercial Computer Software - Restricted Rights clause at FAR 52.227-19, as applicable. Contractor/manufacturer is Mentor Graphics Corporation, 8005 SW Boeckman Road, Wilsonville, Oregon 97070-7777 USA.

13. THIRD PARTY BENEFICIARY. For any Software under this Agreement licensed by Mentor Graphics from Microsoft or other licensors, Microsoft or the applicable licensor is a third party beneficiary of this Agreement with the right to enforce the obligations set forth herein.

14. AUDIT RIGHTS. You will monitor access to, location and use of Software. With reasonable prior notice and during your normal business hours, Mentor Graphics shall have the right to review your software monitoring system and reasonably relevant records to confirm your compliance with the terms of this Agreement, an addendum to this Agreement or U.S. or other local export laws. Such review may include FLEXlm or FLEXnet report log files that you shall capture and provide at Mentor Graphics’ request. Mentor Graphics shall treat as confidential information all of your information gained as a result of any request or review and shall only use or disclose such information as required by law or to enforce its rights under this Agreement or addendum to this Agreement. The provisions of this section 14 shall survive the expiration or termination of this Agreement. 15. CONTROLLING LAW, JURISDICTION AND DISPUTE RESOLUTION. THIS AGREEMENT SHALL BE GOVERNED BY AND CONSTRUED UNDER THE LAWS OF THE STATE OF OREGON, USA, IF YOU ARE LOCATED IN NORTH OR SOUTH AMERICA, AND THE LAWS OF IRELAND IF YOU ARE LOCATED OUTSIDE OF NORTH OR SOUTH AMERICA. All disputes arising out of or in relation to this Agreement shall be submitted to the exclusive jurisdiction of Portland, Oregon when the laws of Oregon apply, or Dublin, Ireland when the laws of Ireland apply. Notwithstanding the foregoing, all disputes in Asia (except for Japan) arising out of or in relation to this Agreement shall be resolved by arbitration in Singapore before a single arbitrator to be appointed by the Chairman of the Singapore International Arbitration Centre (“SIAC”) to be conducted in the English language, in accordance with the Arbitration Rules of the SIAC in effect at the time of the dispute, which rules are deemed to be incorporated by reference in this section 15. This section shall not restrict Mentor Graphics’ right to bring an action against you in the jurisdiction where your place of business is located. The United Nations Convention on Contracts for the International Sale of Goods does not apply to this Agreement.

16. SEVERABILITY. If any provision of this Agreement is held by a court of competent jurisdiction to be void, invalid, unenforceable or illegal, such provision shall be severed from this Agreement and the remaining provisions will remain in full force and effect.

17. PAYMENT TERMS AND MISCELLANEOUS. You will pay amounts invoiced, in the currency specified on the applicable invoice, within 30 days from the date of such invoice. Any past due invoices will be subject to the imposition of interest charges in the amount of one and one-half percent per month or the applicable legal rate currently in effect, whichever is lower. Some Software may contain code distributed under a third party license agreement that may provide additional rights to you. Please see the applicable Software documentation for details. This Agreement may only be modified in writing by authorized representatives of the parties. Waiver of terms or excuse of breach must be in writing and shall not constitute subsequent consent, waiver or excuse.

Rev. 060210, Part No. 227900