Saikat Chatterjee
Saikat Chatterjee

Reputation: 1

Running a test in Questa from Makefile

I have written a Makefile to run tests in questasim. I am using the following commands.

vsim -l transcript -voptargs=+acc test -do $(WAVEDIR)/$(WAVE_FILE)

This helps to open the questa window and simulate the test case. With thin the questa console,I need to run "run -a" so that the complete test execution.

Is there any command which I can add inside my Makefile which will execute the testcase without using the questa console command.

Thanks in advance

Regards S

Upvotes: 0

Views: 5951

Answers (2)

Saikat Chatterjee
Saikat Chatterjee

Reputation: 1

Here I am posting the Makefile example below.

TEST = test_top_0006
WAVE_FILE = wave_test0006.do

PREFIX = europractice questa 10.6c
RTLDIR = ..
WAVEDIR = waves
TRANSCRIPT_FILE = transcript

GITBRANCH = feature

VSIM = $(PREFIX) vsim
VLOG = $(PREFIX) vlog
VCOM = $(PREFIX) vcom
VLIB = $(PREFIX) vlib

VLOG_OPTS = -suppress vlog-2583 +acc





compile: rtl tb

 

# compile all spu sources
spu = $(RTLDIR)/rtl/opcodeDefs_pkg.sv \
    $(RTLDIR)/rtl/au/fp_pkg.sv  \
    $(RTLDIR)/rtl/spu.sv  \
    $(RTLDIR)/rtl/spu_top.sv


rtl:
    if [ ! -d work ]; then $(VLIB) work; fi
     ${VLOG} -lint -work ${VLOG_OPTS} ${spu}
    

# compile verification environment
tb:
    if [ ! -d work ]; then $(VLIB) work; fi
    $(VLOG) $(VLOG_OPTS)    $(RTLDIR)/rtl/typedefs_pkg.sv
    $(VLOG) $(VLOG_OPTS)    $(RTLDIR)/rtl/harness.sv
    if [ ! -e "${TEST}.sv" ]; then false; fi
    ${VLOG} $(VLOG_OPTS) ${TEST}.sv

# run simulator in GUI mode 
run:
    ${VSIM} -l $(TRANSCRIPT_FILE) test -do $(WAVEDIR)/$(WAVE_FILE) -do 'run -all'


runc: tb
    ${VSIM} -c -l $(TRANSCRIPT_FILE) -voptargs=+acc test -do $(WAVEDIR)/nogui.do
    
    
# GIT commands

push:
        git push origin $(GITBRANCH)
        
pull:
        git pull
        
commit:
        git commit -a
        
stat:
        git status
    
    
clean:
    rm -rf work 
    rm -rf vsim.wlf 
    rm -f $(TRANSCRIPT_FILE)

Upvotes: 0

Renaud Pacalet
Renaud Pacalet

Reputation: 29290

Simply add a second -do option:

vsim -l transcript -voptargs=+acc test -do $(WAVEDIR)/$(WAVE_FILE) -do 'run -all'

Side note: be careful when using make with Modelsim or Questa. These tools are not parallel safe. If you try to run several compilations in parallel you will probably corrupt your target libraries and get strange errors.

So, if you use make to also compile, create the libraries, etc. you must guarantee that make will not try to launch in parallel several jobs modifying the same library or the same configuration file (e.g. modelsim.ini). With GNU make always add the .NOTPARALLEL: special target to your Makefiles (there are smarter and more efficient ways to handle this parallel problem with locks but this is out of scope).

Upvotes: 1

Related Questions