Skip to content

Commit e54b026

Browse files
committed
Allow limiting cocotb tests clock frequency via a plusarg, add Makefile targets for testing configs with input FFs enabled
Internal-tag: [#71812] Signed-off-by: Maciej Kurc <[email protected]>
1 parent 6ad2067 commit e54b026

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,18 @@ tests-axi: ## Run all verification/cocotb/* RTL tests for AXI bus configuration
9696
$(MAKE) config CFG_NAME=axi
9797
cd $(COCOTB_VERIF_DIR) && $(PYTHON) -m nox -R -t "axi" --no-venv --forcecolor
9898

99+
tests-axi-ff: ## Run all verification/cocotb/* RTL tests for AXI bus configuration without coverage (input FF enabled)
100+
$(MAKE) config CFG_NAME=axi_ff
101+
cd $(COCOTB_VERIF_DIR) && $(PYTHON) -m nox -R -t "axi" --no-venv --forcecolor -- +MinSystemClockFrequency=200.0
102+
99103
tests-ahb: ## Run all verification/cocotb/* RTL tests for AHB bus configuration without coverage
100104
$(MAKE) config CFG_NAME=ahb
101105
cd $(COCOTB_VERIF_DIR) && $(PYTHON) -m nox -R -t "ahb" --no-venv --forcecolor
102106

107+
tests-ahb-ff: ## Run all verification/cocotb/* RTL tests for AHB bus configuration without coverage (input FF enabled)
108+
$(MAKE) config CFG_NAME=ahb_ff
109+
cd $(COCOTB_VERIF_DIR) && $(PYTHON) -m nox -R -t "ahb" --no-venv --forcecolor -- +MinSystemClockFrequency=200.0
110+
103111
tests: tests-axi tests-ahb ## Run all verification/cocotb/* RTL tests fro AHB and AXI bus configurations without coverage
104112

105113
# TODO: Enable full coverage flow

verification/cocotb/noxfile.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ def _verify(session, test_group, test_type, test_name, coverage=None, simulator=
2525
# session.install("-r", pip_requirements_path)
2626
test = VerificationTest(test_group, test_type, test_name, coverage)
2727

28+
# Translate session options to plusargs
29+
plusargs = list(session.posargs)
30+
2831
# Randomize seed for initialization of undefined signals in the simulation
2932
random.seed(time.time_ns())
3033
seed = random.randint(1, 10000)
@@ -40,21 +43,18 @@ def _verify(session, test_group, test_type, test_name, coverage=None, simulator=
4043
"COCOTB_RESULTS_FILE=" + test.filenames["xml"],
4144
]
4245
if simulator == "verilator":
43-
args.append(
44-
"PLUSARGS="
45-
+ " ".join(
46-
[
47-
"+verilator+rand+reset+2",
48-
f"+verilator+seed+{seed}",
49-
]
50-
)
51-
)
46+
plusargs.extend([
47+
"+verilator+rand+reset+2",
48+
f"+verilator+seed+{seed}",
49+
])
5250
if coverage:
5351
args.append("COVERAGE_TYPE=" + coverage)
5452

5553
if simulator:
5654
args.append("SIM=" + simulator)
5755

56+
args.append("PLUSARGS=" + " ".join(plusargs))
57+
5858
session.run(
5959
*args,
6060
external=True,

verification/cocotb/top/lib_i3c_top/interface.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ def __init__(self, dut: SimHandleBase) -> None:
2626
self.write_csr_field = self.busIf.write_csr_field
2727

2828
async def setup(self, fclk=500.0):
29+
30+
# Limit the requested clock frequency if a limit is set via cocotb
31+
# plusargs
32+
fmin = cocotb.plusargs.get("MinSystemClockFrequency", None)
33+
if fmin is not None:
34+
fmin = float(fmin)
35+
if fclk < fmin:
36+
self.dut._log.warning(f"Enforcing min. system clock frequency of {fmin:.3f} MHz")
37+
fclk = fmin
38+
2939
await self.busIf.register_test_interfaces(fclk)
3040
await ClockCycles(self.clk, 20)
3141
await reset_n(self.clk, self.rst_n, cycles=5)

0 commit comments

Comments
 (0)