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?


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)


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

vsim -do …


export TESTFILE=test1

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


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.


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

global env

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