forked from chipsalliance/i3c-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnoxfile.py
More file actions
243 lines (205 loc) · 6.68 KB
/
Copy pathnoxfile.py
File metadata and controls
243 lines (205 loc) · 6.68 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
# SPDX-License-Identifier: Apache-2.0
"""i3c_core and I3C Agent Unit Test Suites.
# TODO i3c_core - currently unimplemented.
# TODO Coverage Collection
# tags
# - i3c_vip_uvm_tests
# - i3c_vip_uvm_debug_tests
# - i3c_core_uvm_tests
# - i3c_core_uvm_debug_tests
#
# sessions
# - i3c_verify_uvm*
# - i3c_monitor*
# - i3c_driver*
# - i3c_core_verify_uvm*
"""
import logging
import os
import nox
from nox_utils import nox_config, isUVMSimFailure, create_test_id, sim_repeater_path
nox = nox_config(nox)
# Coverage types to collect
coverageTypes = None
# Test configuration
blockPath = "."
pipRequirementsPath = "../../requirements.txt"
# If there are whitespaces around the simulator name, the execution breaks
SIMULATOR = (os.getenv("SIMULATOR")).strip()
def setup_root_dir():
root_dir = os.getenv("I3C_ROOT_DIR")
if root_dir is None:
root_dir = os.path.realpath("../../")
logging.warning(
f"I3C_ROOT_DIR was not set by the environment, setting it to {root_dir}"
)
return root_dir
def verify_uvm(
session,
tb_files,
uvm_testname="",
uvm_vseq_test="",
simulator="verilator",
extra_make_args=[],
coverage=None,
):
# session.install("-r", pipRequirementsPath)
root_dir = setup_root_dir()
make_targets = ["config", simulator]
args = [sim_repeater_path(), "make", "-C", root_dir, *make_targets, f"UVM_TB_FILES={tb_files}"]
if uvm_testname != "":
args.append(f"UVM_TESTNAME={uvm_testname}")
if uvm_vseq_test != "":
args.append(f"UVM_VSEQ_TEST={uvm_vseq_test}")
args += extra_make_args
test_id = create_test_id(session.name, args)
log_file = f"{test_id}.log"
print(f"Log will be written to \"{log_file}\"")
with open(log_file, "w") as testLog:
session.run(
*args,
external=True,
stdout=testLog,
stderr=testLog,
)
os.rename(f"{root_dir}/dump.vcd", f"{test_id}.vcd")
if isUVMSimFailure(resultsFile=log_file):
raise Exception("SimFailure: UVM failed. See test logs for more information.")
################################################################################
#
# I3C_Agent
#
"""I3C Agent unit test suite.
This suite of tests are used to check the operation of the I3C Agent in dv_i3c/.
UVM_TESTNAME=i3c_sequence_test
UVM_VSEQ_TEST=<param>
"""
@nox.session(tags=["i3c_vip_uvm_tests"])
@nox.parametrize("simulator", [SIMULATOR])
@nox.parametrize(
"uvm_vseq_test",
[
"direct_vseq",
"direct_with_rstart_vseq",
"broadcast_followed_by_data_vseq",
"broadcast_followed_by_data_with_rstart_vseq",
"direct_i2c_vseq",
"direct_i2c_with_rstart_vseq",
"broadcast_followed_by_i2c_data_vseq",
"broadcast_followed_by_i2c_data_with_rstart_vseq",
],
)
@nox.parametrize("coverage", coverageTypes)
def i3c_verify_uvm(session, simulator, uvm_vseq_test, coverage):
tb_files = "${I3C_ROOT_DIR}/verification/uvm_i3c/dv_i3c/i3c_agent_unit_tests/i3c_sim.scr \
${I3C_ROOT_DIR}/verification/uvm_i3c/dv_i3c/i3c_agent_unit_tests/tb_sequencer.sv"
verify_uvm(
session,
tb_files=tb_files,
uvm_testname="i3c_sequence_test",
uvm_vseq_test=uvm_vseq_test,
simulator=simulator,
extra_make_args=[],
coverage=coverage,
)
"""I3C Agent unit test suite which takes bus stimulus from input .csv files.
This suite of tests are used to check the operation of the I3C Agent in dv_i3c/.
UVM_TESTNAME=i3c_sequence_test
UVM_VSEQ_TEST=direct_vseq
"""
@nox.session(tags=["i3c_vip_uvm_debug_tests"])
@nox.parametrize("simulator", [SIMULATOR])
@nox.parametrize(
"extra_make_args",
[
[
"+CSV_FILE_PATH=${I3C_ROOT_DIR}/verification/uvm_i3c/dv_i3c/i3c_agent_unit_tests/digital.csv"
],
[
"+CSV_FILE_PATH=${I3C_ROOT_DIR}/verification/uvm_i3c/dv_i3c/i3c_agent_unit_tests/digital_with_ibi.csv"
],
],
)
@nox.parametrize("coverage", coverageTypes)
def i3c_monitor(session, simulator, extra_make_args, coverage):
tb_files = "${I3C_ROOT_DIR}/verification/uvm_i3c/dv_i3c/i3c_agent_unit_tests/i3c_sim.scr \
${I3C_ROOT_DIR}/verification/uvm_i3c/dv_i3c/i3c_agent_unit_tests/tb_monitor.sv"
verify_uvm(
session,
tb_files=tb_files,
uvm_testname="",
uvm_vseq_test="",
simulator=simulator,
extra_make_args=extra_make_args,
coverage=coverage,
)
"""I3C Agent unit test suite in tb_driver.sv
This suite of tests are used to check the operation of the I3C Agent in dv_i3c/.
UVM_TESTNAME=i3c_sequence_test
UVM_VSEQ_TEST=direct_vseq
"""
@nox.session(tags=["i3c_vip_uvm_debug_tests"])
@nox.parametrize("simulator", [SIMULATOR])
@nox.parametrize("coverage", coverageTypes)
def i3c_driver(session, simulator, coverage):
tb_files = "${I3C_ROOT_DIR}/verification/uvm_i3c/dv_i3c/i3c_agent_unit_tests/i3c_sim.scr \
${I3C_ROOT_DIR}/verification/uvm_i3c/dv_i3c/i3c_agent_unit_tests/tb_driver.sv"
verify_uvm(
session,
tb_files=tb_files,
uvm_testname="",
uvm_vseq_test="",
simulator=simulator,
extra_make_args=[],
coverage=coverage,
)
################################################################################
#
# I3C_core
#
"""I3C_core test suite.
# TODO INCOMPLETE.
UVM_TESTNAME=i3c_core_test
UVM_VSEQ_TEST=<param> (currently fixed to direct_vseq?)
"""
@nox.session(tags=["i3c_core_uvm_tests"])
@nox.parametrize("simulator", [SIMULATOR])
@nox.parametrize(
"uvm_i3c_core_vseq_test",
[
"",
],
)
@nox.parametrize("coverage", coverageTypes)
def i3c_core_verify_uvm(session, simulator, uvm_i3c_core_vseq_test, coverage):
tb_files = "${I3C_ROOT_DIR}/verification/uvm_i3c/i3c_core/i3c_core_sim.scr \
${I3C_ROOT_DIR}/verification/uvm_i3c/i3c_core/tb_i3c_core.sv"
verify_uvm(
session,
tb_files=tb_files,
uvm_testname="i3c_core_test",
uvm_vseq_test=uvm_i3c_core_vseq_test,
simulator=simulator,
extra_make_args=[],
coverage=coverage,
)
"""I3C_core test suite.
# TODO INCOMPLETE.
UVM_TESTNAME=i3c_sequence_test
UVM_VSEQ_TEST=direct_vseq
"""
@nox.session(tags=["i3c_core_uvm_debug_tests"])
@nox.parametrize("simulator", [SIMULATOR])
@nox.parametrize("coverage", coverageTypes)
def i3c_driver(session, simulator, coverage):
tb_files = "${I3C_ROOT_DIR}/verification/uvm_i3c/i3c_core/i3c_core_sim.scr \
${I3C_ROOT_DIR}/verification/uvm_i3c/i3c_core/tb_i3c_core.sv"
verify_uvm(
session,
tb_files=tb_files,
uvm_testname="",
uvm_vseq_test="",
simulator=simulator,
extra_make_args=[],
coverage=coverage,
)