Aminvo
Aminvo

Reputation: 41

How to pass an argument to dc_shell in tcl mode?

I am trying to pass an argument to the design compiler shell through my shell script.

clk_period=20.30
dc_shell-t -f my_scripts.tcl $clk_period

it gives an error

 Error: Unexpected argument '20.30'

how it is possible to use such a feature? I use it in tcl programming when using tclsh compiler by means of argc and argv. but dc shell does not accept extra arguments

Upvotes: 2

Views: 1381

Answers (2)

Ian Wrzesinski
Ian Wrzesinski

Reputation: 11

You can also pass in environment variables from the shell and access them with getenv:

# my_scripts.tcl:
try {
    set clk_period [getenv CLK_PERIOD]
} on error {msg} {
    puts "ERROR: missing CLK_PERIOD environment variable"
    puts "Message: $msg"
    exit 1
}

Command:

CLK_PERIOD="20.30" dc_shell-t -f my_scripts.tcl

Upvotes: 1

jp83
jp83

Reputation: 31

I just finally discovered a way to do this myself after this came up in my search. Some tools apparently use -tclargs, but not the case w/ Synopsys. The -x option allows you to pass in a tcl command. So something like this works:

% dc_shell -f script.tcl -x "set test true"

script can echo $test and show true.

Upvotes: 0

Related Questions