forked from OSVVM/OSVVM-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VendorScripts_Xsim.tcl
226 lines (197 loc) · 7.49 KB
/
VendorScripts_Xsim.tcl
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
# File Name: VendorScripts_Xsim.tcl
# Purpose: Scripts for running simulations
# Revision: OSVVM MODELS STANDARD VERSION
#
# Maintainer: Jim Lewis email: [email protected]
# Contributor(s):
# Jim Lewis email: [email protected]
#
# 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:
# Date Version Description
# 5/2024 2024.05 Added ToolVersion variable
# 12/2023 2024.01 Updated as 2023.02's OSVVM support is looking good.
# 05/2022 2022.05 Updated variable naming
# 2/2022 2022.02 Added template of procedures needed for coverage support
# 9/2021 2021.09 Created from VendorScripts_xxx.tcl
#
#
# This file is part of OSVVM.
#
# Copyright (c) 2018 - 2023 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.
#
# -------------------------------------------------
# Tool Settings
#
variable ToolType "simulator"
variable ToolVendor "Xilinx"
variable ToolName "XSIM"
variable ToolVersion [version -short]
variable ToolNameVersion ${ToolName}-${ToolVersion}
# puts $ToolNameVersion
# Make this version dependent when Xilinx starts supporting it
variable ToolSupportsDeferredConstants "false"
variable simulator $ToolName ; # Variable simulator is deprecated. Use ToolName instead
# -------------------------------------------------
# StartTranscript / StopTranscript
#
#
# Uses DefaultVendor_StartTranscript and DefaultVendor_StopTranscript
#
# With this commented out, it will run the DefaultVendor_StartTranscript
proc vendor_StartTranscript {FileName} {
# Do nothing - for now
}
#
proc vendor_StopTranscript {FileName} {
# This will have everything from a session rather than just the current build.
# OK for bring up
file copy -force vivado.log ${FileName}
}
# -------------------------------------------------
# IsVendorCommand
#
proc IsVendorCommand {LineOfText} {
return [regexp {^xvhdl|^xelab|^xsim} $LineOfText]
}
# -------------------------------------------------
# SetCoverageAnalyzeOptions
# SetCoverageCoverageOptions
#
proc vendor_SetCoverageAnalyzeDefaults {} {
variable CoverageAnalyzeOptions
# set defaults here
}
proc vendor_SetCoverageSimulateDefaults {} {
variable CoverageSimulateOptions
# set defaults here
}
# -------------------------------------------------
# Library
#
proc vendor_library {LibraryName PathToLib} {
# set PathAndLib ${PathToLib}/${LibraryName}
#
# if {![file exists ${PathAndLib}]} {
# puts "file mkdir ${PathAndLib}"
# puts "" > ${PathAndLib}
# eval file mkdir ${PathAndLib}
# }
# if {![file exists ./compile/${LibraryName}.epr]} {
# puts vmap $LibraryName ${PathAndLib}
# eval vmap $LibraryName ${PathAndLib}
# }
}
proc vendor_LinkLibrary {LibraryName PathToLib} {}
proc vendor_UnlinkLibrary {LibraryName PathToLib} {}
# -------------------------------------------------
# analyze
#
proc vendor_analyze_vhdl {LibraryName FileName args} {
variable VhdlVersion
variable VhdlLibraryFullPath
set DebugOptions ""
set AnalyzeOptions [concat -${VhdlVersion} {*}${DebugOptions} -work ${LibraryName} {*}${args} ${FileName}]
puts "xvhdl {*}$AnalyzeOptions"
# exec xvhdl {*}$AnalyzeOptions
if {[catch {exec xvhdl {*}$AnalyzeOptions 2>@1} AnalyzeMessage]} {
PrintWithPrefix "Error:" $AnalyzeMessage
error "Failed: analyze $FileName"
} else {
puts $AnalyzeMessage
}
}
proc vendor_analyze_verilog {LibraryName FileName args} {
# Untested branch for Verilog - will need adjustment
puts "Verilog is not supported for now"
# eval vlog -work ${LibraryName} ${FileName}
}
# -------------------------------------------------
# End Previous Simulation
#
proc vendor_end_previous_simulation {} {
# quit -sim
# framework.documents.closeall -vhdl
}
# -------------------------------------------------
# Simulate
#
proc vendor_simulate {LibraryName LibraryUnit args} {
variable OsvvmScriptDirectory
variable SimulateTimeUnits
variable ToolVendor
set ElaborateOptions [concat -timeprecision_vhdl 1${SimulateTimeUnits} -mt auto ${LibraryName}.${LibraryUnit} ${::osvvm::SecondSimulationTopLevel} {*}${args} {*}$::osvvm::GenericOptions -runall]
puts "xelab {*}$ElaborateOptions"
if {[catch {exec xelab {*}$ElaborateOptions 2>@1} ElaborateMessage]} {
PrintWithPrefix "Elaborate Error:" $ElaborateMessage
error "Failed: simulate $LibraryUnit"
} else {
puts $ElaborateMessage
}
## This Works## # Patrick suggests that we do this one rather than the above 12/9/2022
## This Works## # set ElaborateOptions "-timeprecision_vhdl 1${SimulateTimeUnits} -mt off ${LibraryName}.${LibraryUnit} -snapshot ${LibraryName}_${LibraryUnit}"
## This Works## set ElaborateOptions "-timeprecision_vhdl 1${SimulateTimeUnits} -mt auto ${LibraryName}.${LibraryUnit} -snapshot ${LibraryName}_${LibraryUnit}"
## This Works## puts "xelab {*}$ElaborateOptions"
## This Works## # exec xelab {*}$ElaborateOptions
## This Works## if {[catch {exec xelab {*}$ElaborateOptions 2>@1} ElaborateMessage]} {
## This Works## PrintWithPrefix "Elaborate Error:" $ElaborateMessage
## This Works## error "Failed: simulate $LibraryUnit"
## This Works## } else {
## This Works## puts $ElaborateMessage
## This Works## }
## This Works##
## This Works## set SimulateOptions "-runall ${LibraryName}_${LibraryUnit}"
## This Works## puts "xsim {*}$SimulateOptions"
## This Works## # exec xsim {*}$SimulateOptions
## This Works## if { [catch {exec xsim {*}$SimulateOptions 2>@1} SimulateMessage]} {
## This Works## # error "Failed: simulate $LibraryUnit"
## This Works## PrintWithPrefix "Error:" $SimulateMessage
## This Works## error "Failed: simulate $LibraryUnit"
## This Works## } else {
## This Works## puts $SimulateMessage
## This Works## }
}
# -------------------------------------------------
proc vendor_generic {Name Value} {
# return "-generic_top \"${Name}=${Value}\""
return "-generic_top ${Name}=${Value}"
}
# -------------------------------------------------
# Merge Coverage
#
proc vendor_MergeCodeCoverage {TestSuiteName CoverageDirectory BuildName} {
# set CoverageFileBaseName [file join ${CoverageDirectory} ${BuildName} ${TestSuiteName}]
# set CovFiles [glob -nocomplain ${CoverageDirectory}/${TestSuiteName}/*.acdb]
# if {$CovFiles ne ""} {
# acdb merge -o ${CoverageFileBaseName}.acdb -i {*}[join $CovFiles " -i "]
# }
}
proc vendor_ReportCodeCoverage {TestSuiteName ResultsDirectory} {
# acdb report -html -i ${ResultsDirectory}/${TestSuiteName}.acdb -o ${ResultsDirectory}/${TestSuiteName}_code_cov.html
}
proc vendor_GetCoverageFileName {TestName} {
set CoverageFileName ${TestName}_code_cov.html
return $CoverageFileName
}