Skip to content

Commit d9cb9ae

Browse files
committed
When run simulate from console - run it as a build and generate reports linked to the index
1 parent d1aa179 commit d9cb9ae

2 files changed

Lines changed: 55 additions & 46 deletions

File tree

OsvvmScriptsCore.tcl

Lines changed: 52 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,8 @@ variable HaveNotCreatedBuildOutputDirectory
634634
variable OsvvmBuildOutputDirectory
635635
variable 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 {} {
11951195
proc 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

OsvvmScriptsCreateYamlReports.tcl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ proc WriteBuildInfoYaml {RunFile BuildName {NamePrefix ""} {InfoPrefix ""} } {
124124
# -------------------------------------------------
125125
proc FinishBuildYaml {BuildName} {
126126
variable BuildStartTimeMs
127-
# variable BuildStartTime
127+
variable BuildStartTime
128128
variable BuildFinishTime
129129
variable BuildElapsedTime
130130

@@ -133,7 +133,7 @@ proc FinishBuildYaml {BuildName} {
133133

134134
set BuildFinishTime [clock seconds]
135135
set BuildElapsedTime [ElapsedTimeMs $BuildStartTimeMs]
136-
# set BuildElapsedTime [expr ($BuildFinishTime - $BuildStartTime)]
136+
set BuildElapsedTimeSec [expr ($BuildFinishTime - $BuildStartTime)]
137137

138138
WriteBuildInfoYaml $RunFile $BuildName
139139

@@ -142,7 +142,7 @@ proc FinishBuildYaml {BuildName} {
142142
close $RunFile
143143

144144
puts "Build Start time [clock format $BuildStartTime -format {%T %Z %a %b %d %Y }]"
145-
puts "Build Finish time [clock format $BuildFinishTime -format %T], Elapsed time: [format %d:%02d:%02d [expr ($BuildElapsedTime/(60*60))] [expr (($BuildElapsedTime/60)%60)] [expr (${BuildElapsedTime}%60)]] "
145+
puts "Build Finish time [clock format $BuildFinishTime -format %T], Elapsed time: [format %d:%02d:%02d [expr ($BuildElapsedTimeSec/(60*60))] [expr (($BuildElapsedTimeSec/60)%60)] [expr (${BuildElapsedTimeSec}%60)]] "
146146
}
147147

148148

0 commit comments

Comments
 (0)