Testbench flow control with TCL

Joined
Dec 20, 2011
Messages
2
Reaction score
0
I am currently attempting to use the following TCL script to control the simulation flow of my DUT. It basically does the following:
Reads in a txt file to get individual test names, passes each individual test name to the testbench framework. The idea being that each test is performed under a separate vsim command as opposed to having them concatenated together in one simulation run. I extract the system time at the start and end of each simulation run to pass into a log file. The first system time is passed in as a generic, the final system time is passed in as a force command when I encounter a pre-set breakpoint towards the end of the sim.

When my testbench eventually completes a simulation, it finishes with the following statement:
assert not(V_FINISH) report "Test Complete " severity failure;

The problem that I am having is that when the above line is executed, control is not passed back to the TCL file (which makes sense I guess as I’ve killed the simulation run). Is there a way of cleanly passing control back to the TCL script to get it to continue around the loop?

while { [gets $infile line] >= 0 } {
set length [string length $line]
if {[lsearch $line --* ] == -1} {
if {$length != 0} {
#Set the simulation time string
set str [clock format [clock seconds]]
#Vsim command and dereferenced tcl variable passed in as generic for time & date & test name
vsim -onfinish exit -G/uart_tb/u_uart_tb_control/time_string=\"$str" -G/uart_tb/u_uart_tb_control/g_test_name=\"$line" work.uart_tb
#Set the breakpoints for time insertion
bp ../testbench/UART_TB_CONTROL.vhd 415
# Set the commands that get executed when we encounter the breakpoints
# Capture the system time
# force the string value set in the design with this value
# continue the simulation
onbreak {set str [clock format [clock seconds]]; force -freeze sim:/uart_tb/U_UART_TB_CONTROL/FINAL_TIME $str 0; run -continue }
do wave.do
run -all
}
}
}

Many thanks.
 
Joined
Dec 20, 2011
Messages
2
Reaction score
0
Found the answer if anyone's interested:

in the 'onbreak' command, if I replace 'run -continue' with 'resume' then control is passed back to the TCL script.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,034
Messages
2,570,356
Members
47,002
Latest member
RobertoLip

Latest Threads

Top