-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathOsvvmScriptsSetGetOptions.tcl
More file actions
386 lines (344 loc) · 11.2 KB
/
OsvvmScriptsSetGetOptions.tcl
File metadata and controls
386 lines (344 loc) · 11.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File Name: OsvvmScriptsCore.tcl
# Purpose: Scripts for running simulations
# Revision: OSVVM MODELS STANDARD VERSION
#
# Maintainer: Jim Lewis email: jim@synthworks.com
# Contributor(s):
# Jim Lewis email: jim@synthworks.com
# Markus Ferringer Patterns for error handling and callbacks, ...
#
# Description
# Tcl procedures with the intent of making running
# compiling and simulations tool independent
#
# Developed by:
# SynthWorks Design Inc.
# VHDL Training Classes
# OSVVM Methodology and Model Library
# 11898 SW 128th Ave. Tigard, Or 97223
# http://www.SynthWorks.com
#
# Revision History:
# Version Description
# 2025.06 Factored out from OsvvmScriptsCore.tcl.
#
#
# This file is part of OSVVM.
#
# Copyright (c) 2018 - 2026 by SynthWorks Design Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# -------------------------------------------------
# StartUp
# re-run the startup scripts, this program included
#
namespace eval ::osvvm {
# -------------------------------------------------
# SetVHDLVersion, GetVHDLVersion
#
proc SetVHDLVersion {Version} {
variable VhdlVersion
variable VhdlShortVersion
if {$Version eq "2008" || $Version eq "08"} {
set VhdlVersion 2008
set VhdlShortVersion 08
} elseif {$Version eq "2019" || $Version eq "19" } {
set VhdlVersion 2019
set VhdlShortVersion 19
} elseif {$Version eq "2002" || $Version eq "02" } {
set VhdlVersion 2002
set VhdlShortVersion 02
puts "\nWARNING: VHDL Version set to 2002. OSVVM Requires 2008 or newer\n"
} elseif {$Version eq "1993" || $Version eq "93" } {
set VhdlVersion 93
set VhdlShortVersion 93
puts "\nWARNING: VHDL Version set to 1993. OSVVM Requires 2008 or newer\n"
} else {
set VhdlVersion 2008
set VhdlShortVersion 08
puts "\nWARNING: Input to SetVHDLVersion not recognized. Using 2008.\n"
}
}
proc GetVHDLVersion {} {
variable VhdlVersion
return $VhdlVersion
}
# -------------------------------------------------
# SetTranscriptType, GetTranscriptType
#
proc SetTranscriptType {{TranscriptType "html"}} {
variable TranscriptExtension
set lowerTranscriptType [string tolower $TranscriptType]
set TranscriptExtension $lowerTranscriptType
if {($lowerTranscriptType ne "html") && ($lowerTranscriptType ne "none")} {
set TranscriptExtension "log"
}
}
proc GetTranscriptType {} {
variable TranscriptExtension
return $TranscriptExtension
}
# -------------------------------------------------
# SetVhdlAnalyzeOptions, SetVerilogAnalyzeOptions
#
proc SetVhdlAnalyzeOptions {{Options ""}} {
variable VhdlAnalyzeOptions
set VhdlAnalyzeOptions $Options
}
proc GetVhdlAnalyzeOptions {} {
variable VhdlAnalyzeOptions
return $VhdlAnalyzeOptions
}
proc SetVerilogAnalyzeOptions {{Options ""}} {
variable VerilogAnalyzeOptions
set VerilogAnalyzeOptions $Options
}
proc GetVerilogAnalyzeOptions {} {
variable VerilogAnalyzeOptions
return $VerilogAnalyzeOptions
}
# -------------------------------------------------
# SetExtendedAnalyzeOptions, SetExtendedSimulateOptions
#
proc SetExtendedAnalyzeOptions {{Options ""}} {
variable ExtendedAnalyzeOptions
set ExtendedAnalyzeOptions $Options
}
proc GetExtendedAnalyzeOptions {} {
variable ExtendedAnalyzeOptions
return $ExtendedAnalyzeOptions
}
proc SetExtendedOptimizeOptions {{Options ""}} {
variable ExtendedOptimizeOptions
set ExtendedOptimizeOptions $Options
}
proc GetExtendedOptimizeOptions {} {
variable ExtendedOptimizeOptions
return $ExtendedOptimizeOptions
}
proc SetExtendedSimulateOptions {{Options ""}} {
variable ExtendedSimulateOptions
set ExtendedSimulateOptions $Options
}
proc GetExtendedSimulateOptions {} {
variable ExtendedSimulateOptions
return $ExtendedSimulateOptions
}
# -------------------------------------------------
# SetExtendedElaborateOptions, SetExtendedRunOptions
# Only for simulators that elaborate and run separately - like GHDL
# Currently only implemented for GHDL
#
proc SetExtendedElaborateOptions {{Options ""}} {
variable ExtendedElaborateOptions
set ExtendedElaborateOptions $Options
}
proc GetExtendedElaborateOptions {} {
variable ExtendedElaborateOptions
return $ExtendedElaborateOptions
}
proc SetExtendedRunOptions {{Options ""}} {
variable ExtendedRunOptions
set ExtendedRunOptions $Options
}
proc GetExtendedRunOptions {} {
variable ExtendedRunOptions
return $ExtendedRunOptions
}
# -------------------------------------------------
# SetSaveWaves
# Important for simulators that do everything from the command line
# Currently only implemented for GHDL and NVC
#
proc SetSaveWaves {{Options "true"}} {
variable SaveWaves
set SaveWaves $Options
}
proc GetSaveWaves {} {
variable SaveWaves
return $SaveWaves
}
# -------------------------------------------------
# SetInteractiveMode, SetDebugMode, SetLogSignals
#
proc SetInteractiveMode {{Options "true"}} {
variable SimulateInteractive
variable AnalyzeErrorStopCount
variable SimulateErrorStopCount
variable SavedAnalyzeErrorStopCount
variable SavedSimulateErrorStopCount
set PreviousSimulateInteractive $SimulateInteractive
set SimulateInteractive $Options
if {($SimulateInteractive) && !($PreviousSimulateInteractive)} {
# Only save ErrorStopCounts when options change from FALSE to TRUE
set SavedAnalyzeErrorStopCount $AnalyzeErrorStopCount
set SavedSimulateErrorStopCount $SimulateErrorStopCount
}
if {($SimulateInteractive)} {
# When running interactive, set ErrorStopCounts to 1
set AnalyzeErrorStopCount 1
set SimulateErrorStopCount 1
} else {
set AnalyzeErrorStopCount $SavedAnalyzeErrorStopCount
set SimulateErrorStopCount $SavedSimulateErrorStopCount
}
if {! $::osvvm::DebugIsSet} {
set ::osvvm::Debug $Options
}
if {! $::osvvm::LogSignalsIsSet} {
set ::osvvm::LogSignals $Options
}
}
# SetInteractive is deprecated.
proc SetInteractive {{Options "true"}} {
puts "SetInteractive is deprecated. Use SetInteractiveMode instead"
SetInteractiveMode $Options
}
proc GetInteractiveMode {} {
variable SimulateInteractive
return $SimulateInteractive
}
proc SetDebugMode {{Options "true"}} {
set ::osvvm::DebugIsSet "true"
set ::osvvm::Debug $Options
}
proc GetDebugMode {} {
return $::osvvm::Debug
}
proc SetLogSignals {{Options "true"}} {
set ::osvvm::LogSignalsIsSet "true"
set ::osvvm::LogSignals $Options
}
proc GetLogSignals {} {
variable LogSignals
return $LogSignals
}
# -------------------------------------------------
# SetSecondSimulationTopLevel, GetSecondSimulationTopLevel
#
proc SetSecondSimulationTopLevel {{LibraryDotDesignUnit ""}} { ; # Specify as Libary.DesignUnit
variable SecondSimulationTopLevel
set SecondSimulationTopLevel $LibraryDotDesignUnit
}
proc GetSecondSimulationTopLevel {} {
variable SecondSimulationTopLevel
return $SecondSimulationTopLevel
}
# -------------------------------------------------
# SetCoverageEnable, GetCoverageEnable
#
proc SetCoverageEnable {{Enable "true"}} {
variable CoverageEnable
if {[string tolower $Enable] eq "true"} {
set CoverageEnable "true"
} else {
set CoverageEnable "false"
}
puts "SetCoverageEnable $CoverageEnable"
}
proc GetCoverageEnable {} {
variable CoverageEnable
return $CoverageEnable
}
# -------------------------------------------------
# SetCoverageAnalyzeOptions, SetCoverageAnalyzeEnable
#
proc SetCoverageAnalyzeOptions {{Options ""}} {
set ::osvvm::CoverageAnalyzeOptions $Options
}
proc GetCoverageAnalyzeOptions {} {
return $::osvvm::CoverageAnalyzeOptions
}
proc SetCoverageAnalyzeEnable {{Enable "true"}} {
variable CoverageAnalyzeEnable
if {[string tolower $Enable] eq "true"} {
set CoverageAnalyzeEnable "true"
} else {
set CoverageAnalyzeEnable "false"
}
puts "SetCoverageAnalyzeEnable $CoverageAnalyzeEnable"
}
proc GetCoverageAnalyzeEnable {} {
return $::osvvm::CoverageAnalyzeEnable
}
# -------------------------------------------------
# SetCoverageSimulateOptions, SetCoverageSimulateEnable
#
proc SetCoverageSimulateOptions {{Options ""}} {
set ::osvvm::CoverageSimulateOptions $Options
}
proc GetCoverageSimulateOptions {} {
return $::osvvm::CoverageSimulateOptions
}
proc SetCoverageSimulateEnable {{Enable "true"}} {
variable CoverageSimulateEnable
if {[string tolower $Enable] eq "true"} {
set CoverageSimulateEnable "true" ;
} else {
set CoverageSimulateEnable "false" ;
}
puts "SetCoverageSimulateEnable $CoverageSimulateEnable"
}
proc GetCoverageSimulateEnable {} {
return $::osvvm::CoverageSimulateEnable
}
# -------------------------------------------------
# SetSimulatorResolution, GetSimulatorResolution
#
proc SetSimulatorResolution {SimulatorResolution} {
variable SimulateTimeUnits
set SimulateTimeUnits $SimulatorResolution
}
proc GetSimulatorResolution {} {
variable SimulateTimeUnits
return $SimulateTimeUnits
}
# -------------------------------------------------
# SetLibraryDirectory
#
proc SetLibraryDirectory {{LibraryDirectory "."}} {
variable VhdlLibraryParentDirectory
set VhdlLibraryParentDirectory [file normalize $LibraryDirectory]
}
proc GetLibraryDirectory {} {
variable VhdlLibraryParentDirectory
if {[info exists VhdlLibraryParentDirectory]} {
return "${VhdlLibraryParentDirectory}"
} else {
puts "WARNING: GetLibraryDirectory VhdlLibraryParentDirectory not defined"
return ""
}
}
# Don't export the following due to conflicts with Tcl built-ins
# map
namespace export SetVHDLVersion GetVHDLVersion SetSimulatorResolution GetSimulatorResolution
namespace export SetLibraryDirectory GetLibraryDirectory SetTranscriptType GetTranscriptType
namespace export SetExtendedAnalyzeOptions GetExtendedAnalyzeOptions
namespace export SetExtendedOptimizeOptions GetExtendedOptimizeOptions
namespace export SetExtendedSimulateOptions GetExtendedSimulateOptions
namespace export SetVhdlAnalyzeOptions GetVhdlAnalyzeOptions SetVerilogAnalyzeOptions GetVerilogAnalyzeOptions
namespace export SetCoverageEnable GetCoverageEnable
namespace export SetCoverageAnalyzeOptions GetCoverageAnalyzeOptions
namespace export SetCoverageAnalyzeEnable GetCoverageAnalyzeEnable
namespace export SetCoverageSimulateOptions GetCoverageSimulateOptions
namespace export SetCoverageSimulateEnable GetCoverageSimulateEnable
namespace export SetExtendedElaborateOptions GetExtendedElaborateOptions
namespace export SetExtendedRunOptions GetExtendedRunOptions
namespace export SetSaveWaves GetSaveWaves
namespace export SetInteractiveMode GetInteractiveMode
namespace export SetDebugMode GetDebugMode
namespace export SetLogSignals GetLogSignals
namespace export SetSecondSimulationTopLevel GetSecondSimulationTopLevel
# end namespace ::osvvm
}