Questa: Passing variables to dofile

Hi all,

Is there a way to pass variables from a Makefile to a questasim dofile.
I wrote a dofile with this line
coverage save -onexit $.ucdb

where TESTNAME is defined in my Makefile. This doesn’t work…
Does someone have an idea?

Thanks

Julien Trilles

All environment variables are available in Tcl via the “env” array,
where the array index is the name of the environment variable.

So you can use env(TESTNAME)

Dave

Thank you Dave. It’s OK for environment variables but is it possible for Makefile variables?

TESTNAME is set inside my Makefile only and I have a target run_mti which calls vsim

TESTNAME = test1

run_mti:
vsim -do vsim.do …

Julien

export TESTFILE=test1

Thank you Dave again.
It works fine with Makefile export command.

Julien

Hi all,

I understand that this is very old question but today I faced the same issue and this thread was among the first find by google but while helpful I still spend a lot of time making it work due to my missing TCL knowledge. Therefore I am posting my full solution in hope it will be helpful.

Makefile/script:

export TEST_NAME="real_pcap_test"
vsim -c -do "file.do"

file.do:

global env
set UCDB_NAME $env(TEST_NAME)

run 1ms
coverage save -onexit  ${UCDB_NAME}.ucdb