Basic syntax

Tcl scripts contain one or more commands separated by either new lines or semicolons. A Tcl command consists of the name of the command followed by one or more arguments. The format of a Tcl command is:

command arg1 ... argN

The command in the following example computes the sum of 2 plus 2 and returns the result, 4.

expr 2 + 2

The expr command handles its arguments as an arithmetic expression, computing and returning the result as a string. All Tcl commands return results. If a command has no result to return, it returns an empty string.

To continue a command on another line, enter a backslash (\) character at the end of the line. For example, the following Tcl command appears on two lines:

import -format "edif" -netlist_naming "Generic" -edif_flavor "GENERIC" {prepi.edn}

To enter a comment line, the comment delimiter, which is the pound sign (#), must be the first character on a line or the first character following a semicolon, which also indicates the start of a new line. To create a multi-line comment, you must put a pound sign (#) at the beginning of each line.

Sample Tcl script

#Set up a new design

new_design -name "multiclk" -family "Axcelerator" -path {.}

 

# Set device, package, speed grade, default I/O standard and

# operating conditions

set_device -die "AX1000" -package "BG729" -speed "-3" \

-voltage "1.5" -iostd "LVTTL" -temprange "COM" -voltrange "COM"

 

# Import the netlist

import -format "verilog" {multiclk.v}

 

# Compile the netlist

compile

 

# Import a PDC file

import_aux -format "pdc" {multiclk.pdc}

 

# Run standard layout

layout -incremental "OFF"

 

# Generate backannotated sdf and netlist file

backannotate -name {multiclk_ba} -format "sdf" -language "Verilog"

 

# Generate timing report

report -type "timing" -sortby "actual" -maxpaths "100" {report_timing.txt}

 

# Generate programming file

export -format "AFM" -signature "ffff" {multiclk.afm}