-
Notifications
You must be signed in to change notification settings - Fork 15
/
VendorScripts_Vivado.tcl
174 lines (149 loc) · 5.53 KB
/
VendorScripts_Vivado.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
# File Name: VendorScripts_Vivado.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
# Rob Gaddi email: rgaddi@highlandtechnology.com
#
# Description
# Tcl procedures for Xilinx Vivado with the intent of making running
# compiling and simulations tool independent
#
# Revision History:
# Date Version Description
# 5/2024 2024.05 Added ToolVersion variable
# 2/2022 2022.02 Added template of procedures needed for coverage support
# 4/2021 2021.02 Initial revision, tested under Vivado 2020.1
#
#
# This file is part of OSVVM.
#
# Copyright (c) 2021-2022 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 "synthesis"
variable ToolVendor "Xilinx"
variable ToolName "Vivado"
variable simulator $ToolName ; # Variable simulator is deprecated. Use ToolName instead
variable ToolVersion [version -short]
variable ToolNameVersion ${ToolName}-${ToolVersion}
# puts $ToolNameVersion
# Quite unfortunately, much of Vivado doesn't support VHDL-2008 properly.
# Therefore the default assumption has to be for VHDL-2002
variable DefaultVHDLVersion 2002
# Try to get the default library name from the open project, but we can
# fall back to a hard-coded default if necessary.
#if {[catch set XILINX_LIB [get_property DEFAULT_LIB [current_project]]} {
# set XILINX_LIB xil_defaultlib
#}
# -------------------------------------------------
# StartTranscript / StopTranscxript
#
# Haven't been able to find any way to get Vivado to support transcript control
# However, it is a convenient hook to use to suppress some warning messages
# that are otherwise tacky.
proc vendor_StartTranscript {FileName} {
# WARNING: [filemgmt 56-12] File ... cannot be added to the project because
# it already exists in the project, skipping this file
set_msg_config -id {filemgmt 56-12} -suppress -quiet
}
proc vendor_StopTranscript {FileName} {
reset_msg_config -id {filemgmt 56-12} -default_severity -quiet
}
# -------------------------------------------------
# IsVendorCommand
#
proc IsVendorCommand {LineOfText} {
return 0
# 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
#
# Vivado doesn't maintain library files per se, so there's nothing to do.
proc vendor_library {LibraryName PathToLib} {}
proc vendor_LinkLibrary {LibraryName PathToLib} {}
proc vendor_UnlinkLibrary {LibraryName PathToLib} {}
# -------------------------------------------------
# analyze
#
proc vendor_analyze_vhdl {LibraryName FileName args} {
variable VhdlVersion
if {$VhdlVersion eq "2008"} {
set f [read_vhdl -library $LibraryName -vhdl2008 $FileName]
} else {
set f [read_vhdl -library $LibraryName $FileName]
}
if {$f eq {}} {
# The file was already present in the project, so update the parameters
set f [get_files $FileName]
set_property LIBRARY $LibraryName $f
if {$VhdlVersion eq "2008"} {
set_property FILE_TYPE {VHDL 2008} $f
} else {
set_property FILE_TYPE {VHDL} $f
}
}
}
proc vendor_analyze_verilog {LibraryName FileName args} {
set f [read_verilog -library $LibraryName {*}${args} $FileName]
if {$f eq {}} {
# The file was already present in the project, so update the parameters
set f [get_files $FileName]
set_property LIBRARY $LibraryName $f
}
}
# -------------------------------------------------
# End Previous Simulation
#
# -------------------------------------------------
# Simulate
# Since Vivado simulator doesn't support OSVVM, don't even attempt to do
# any simulation stuff; just stub it.
proc vendor_end_previous_simulation {} {}
proc vendor_simulate {LibraryName LibraryUnit args} {}
# -------------------------------------------------
# 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
}