I'm trying to automate unit-testing of VHDL code using a TCL-script (TCL version 8.4) in ModelSim (6.5 PE).
Based on the relevant TCL-reference manual, I am currently able to handle assertions with the onbreak {}
command as follows, which allows me to continue or stop simulation in a controlled way.
However, I would also like to be able to get some more context in that handler, in particular file-name, line-number and label of the assertion that triggered the break. I would then forward this information to a continuous-integration tool.
proc break_handler {} {
upvar #0 now now
# this is where I would need some more information about the current break point:
set break_point_information "???"
puts "Break: after $now with $break_point_information!"
# prevent infinite simulation:
if {$some_condition} {
stop
} else {
run -continue
}
}
# Skipped: scripted compilation of project
# Stop on Note (1) ... Failure (4)
set BreakOnAssertion 1
onbreak { break_handler }
# Skipped: scripted simulation start and report generation
The information I want is essentially already printed to the console as
# ** Warning: End of Testbench
# Time: 1234 ns Iteration: 0 Process: /something/testing File: C:/something.vhd
# Break in Process testing at C:/comething.vhd line 1234
Hence, I could probably record and parse a transcript file
. However, that's what I wanted to avoid in the first place...
The closest I come is using [runStatus -full]
, but that gives much less information (e.g. just break simulation_stop
).