@@ -634,8 +634,8 @@ variable HaveNotCreatedBuildOutputDirectory
634634variable OsvvmBuildOutputDirectory
635635variable BuildName
636636
637- # if {$::osvvm::BuildStarted } {}
638- if {$::osvvm::BuildName ne " " } {
637+ # if {$::osvvm::BuildName ne "" } {}
638+ if {$::osvvm::BuildStarted } {
639639 if {$HaveNotCreatedBuildOutputDirectory } {
640640 # When run as part of a build, use the BuildName
641641 set OsvvmBuildOutputDirectory [file join $::osvvm::CurrentSimulationDirectory $::osvvm::OutputBaseDirectory $::osvvm::BuildName ]
@@ -1195,52 +1195,61 @@ proc NoNullRangeWarning {} {
11951195proc simulate {LibraryUnit args} {
11961196 variable vendor_simulate_started
11971197
1198- set SavedInteractive [GetInteractiveMode]
1199- if {!($::osvvm::BuildStarted )} {
1198+ if {$::osvvm::LastAnalyzeHasError } {
1199+ SkipTest $LibraryUnit " Previous analyze failed. Skipping simulate."
1200+
1201+ } elseif {!($::osvvm::BuildStarted )} {
1202+ # called simulate from console - run as a build with just simulate in it.
1203+ set SavedInteractive [GetInteractiveMode]
1204+ CheckWorkingDir
12001205 SetInteractiveMode " true"
1201- BuildName $LibraryUnit
1202- }
1206+ set SimProFileName [file join $::osvvm::CurrentSimulationDirectory $::osvvm::OsvvmTempOutputDirectory OsvvmSimulateBuild.pro]
1207+ set SimProFile [open ${SimProFileName} w]
1208+ puts $SimProFile " simulate $LibraryUnit $args "
1209+ close $SimProFile
12031210
1204- set SimulateErrorCode [catch {LocalSimulate $LibraryUnit {*}$args } SimErrMsg]
1205- set LocalSimulateErrorInfo $::errorInfo
1206-
1207- if {($SimulateErrorCode != 0) && (!$::osvvm::SimulateInteractive )} {
1208- # if simulate ended in error, EndSimulation to close open files.
1209- # $osvvm_testbench/AlertLogPkg tests require extra run after simulate
1210- # so checking only SimulateInteractive not sufficient
1211- EndSimulation
1212- unset vendor_simulate_started
1213- }
1214-
1215- if {$::osvvm::GenerateOsvvmReports } {
1216- set ReportErrorCode [catch {AfterSimulateReports} ReportErrMsg]
1217- set LocalReportErrorInfo $::errorInfo
1218- } else {
1219- set ReportErrorCode 0
1220- }
1211+ catch [build $SimProFileName [BuildName $LibraryUnit ]] ;# Errors to std_output, but interactive and stopping anyway
1212+
1213+ SetInteractiveMode $SavedInteractive ; # Restore original value
1214+ catch [file delete -force $SimProFile ]
12211215
1222- # Reset Temporary Settings
1223- if {[info exists ::osvvm::TestCaseName]} {
1224- unset ::osvvm::TestCaseName
1225- }
1226- set ::osvvm::GenericDict " "
1227- set ::osvvm::GenericNames " "
1228- set ::osvvm::GenericOptions " "
1229- set ::osvvm::RunningCoSim " false"
1230-
1231- if {$SimulateErrorCode != 0} {
1232- CallbackOnError_Simulate $SimErrMsg $LocalSimulateErrorInfo [concat $LibraryUnit $args ]
12331216 } else {
1234- set ::osvvm::ConsecutiveSimulateErrors 0
1235- }
1217+ set SimulateErrorCode [catch {LocalSimulate $LibraryUnit {*}$args } SimErrMsg]
1218+ set LocalSimulateErrorInfo $::errorInfo
1219+
1220+ if {($SimulateErrorCode != 0) && (!$::osvvm::SimulateInteractive )} {
1221+ # if simulate ended in error, EndSimulation to close open files.
1222+ # $osvvm_testbench/AlertLogPkg tests require extra run after simulate
1223+ # so checking only SimulateInteractive not sufficient
1224+ EndSimulation
1225+ unset vendor_simulate_started
1226+ }
1227+
1228+ if {$::osvvm::GenerateOsvvmReports } {
1229+ set ReportErrorCode [catch {AfterSimulateReports} ReportErrMsg]
1230+ set LocalReportErrorInfo $::errorInfo
1231+ } else {
1232+ set ReportErrorCode 0
1233+ }
12361234
1237- if {$ReportErrorCode != 0} {
1238- CallbackOnError_AfterSimulateReports $ReportErrMsg $LocalReportErrorInfo
1239- }
1240- if {!($::osvvm::BuildStarted )} {
1241- SetInteractiveMode $SavedInteractive ; # Restore original value
1242- set BuildName " "
1243- set ::osvvm::HaveNotCreatedBuildOutputDirectory " true"
1235+ # Reset Temporary Settings
1236+ if {[info exists ::osvvm::TestCaseName]} {
1237+ unset ::osvvm::TestCaseName
1238+ }
1239+ set ::osvvm::GenericDict " "
1240+ set ::osvvm::GenericNames " "
1241+ set ::osvvm::GenericOptions " "
1242+ set ::osvvm::RunningCoSim " false"
1243+
1244+ if {$SimulateErrorCode != 0} {
1245+ CallbackOnError_Simulate $SimErrMsg $LocalSimulateErrorInfo [concat $LibraryUnit $args ]
1246+ } else {
1247+ set ::osvvm::ConsecutiveSimulateErrors 0
1248+ }
1249+
1250+ if {$ReportErrorCode != 0} {
1251+ CallbackOnError_AfterSimulateReports $ReportErrMsg $LocalReportErrorInfo
1252+ }
12441253 }
12451254}
12461255
0 commit comments