Skip to content

Commit bcd3be1

Browse files
committed
feat: add build seed to the sim result reports
The build seed was surfaced in the original DVSim CLI reports, and so should probably be surfaced in the HTML reports as well. Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
1 parent 3654332 commit bcd3be1

4 files changed

Lines changed: 23 additions & 0 deletions

File tree

src/dvsim/sim/data.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ class SimFlowResults(BaseModel):
210210
timestamp: datetime
211211
"""Timestamp for when the test ran."""
212212

213+
build_seed: int | None
214+
"""Build seed."""
215+
213216
stages: Mapping[str, TestStage]
214217
"""Results per test stage."""
215218
coverage: CoverageMetrics | None
@@ -253,6 +256,9 @@ class SimResultsSummary(BaseModel):
253256
timestamp: datetime
254257
"""Run time stamp."""
255258

259+
build_seed: int | None
260+
"""Build seed."""
261+
256262
flow_results: Mapping[str, SimFlowResults]
257263
"""Flow results."""
258264

src/dvsim/sim/flow.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ def gen_results(self, results: Sequence[CompletedJobStatus]) -> None:
604604
reports_dir = Path(self.scratch_base_path) / "reports"
605605
commit = git_commit_hash(path=Path(self.proj_root))
606606
url = f"https://github.com/lowrisc/opentitan/tree/{commit}"
607+
build_seed = self.build_seed if not self.run_only else None
607608

608609
try:
609610
dvsim_version = version("dvsim").strip()
@@ -665,6 +666,7 @@ def gen_results(self, results: Sequence[CompletedJobStatus]) -> None:
665666
top=IPMeta(**summary_top_args),
666667
version=dvsim_version,
667668
timestamp=timestamp,
669+
build_seed=build_seed,
668670
flow_results=all_flow_results,
669671
report_path=reports_dir,
670672
primary_cfg=self.is_primary_cfg,
@@ -709,6 +711,8 @@ def _gen_json_results(
709711
)
710712
tool = ToolMeta(name=self.tool.lower(), version="unknown")
711713

714+
build_seed = self.build_seed if not self.run_only else None
715+
712716
# --- Build stages only from testpoints that have at least one executed test ---
713717
stage_to_tps: defaultdict[str, dict[str, Testpoint]] = defaultdict(dict)
714718

@@ -806,6 +810,7 @@ def make_test_result(tr) -> TestResult | None:
806810
block=block,
807811
tool=tool,
808812
timestamp=timestamp,
813+
build_seed=build_seed,
809814
stages=stages,
810815
coverage=coverage_model,
811816
failed_jobs=failures,

src/dvsim/templates/reports/block_report.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
{% extends "reports/wrapper.html" %}
88
{% set block = results.block %}
99
{% set tool = results.tool %}
10+
{% set build_seed = results.build_seed %}
1011
{% set timestamp = results.timestamp %}
1112
{% set stages = results.stages %}
1213
{% set coverage = results.coverage %}
@@ -58,6 +59,11 @@ <h2>Simulation Results: {{ block.variant_name(sep='/') }}</h2>
5859
<span class="badge text-bg-secondary">
5960
Tool: {{ tool.name }} [{{ tool.version }}]
6061
</span>
62+
{% if build_seed %}
63+
<span class="badge text-bg-secondary">
64+
Build seed: {{ build_seed }}
65+
</span>
66+
{% endif %}
6167
</div>
6268

6369
{% macro coverage_stat(cov, kind, label) %}

src/dvsim/templates/reports/summary_report.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
{% set top = summary.top %}
99
{% set timestamp = summary.timestamp %}
1010
{% set version = summary.version %}
11+
{% set build_seed = summary.build_seed %}
1112
{% set title = "Simulation Results: %s"|format(top.name) if summary.primary_cfg else "Simulation Results (Summary)" %}
1213
{% block content %}
1314
<div class="container-md">
@@ -55,6 +56,11 @@ <h2>{{ title }}</h2>
5556
<span class="badge text-bg-secondary">
5657
Branch: {{ top.branch }}
5758
</span>
59+
{% if build_seed %}
60+
<span class="badge text-bg-secondary">
61+
Build seed: {{ build_seed }}
62+
</span>
63+
{% endif %}
5864
</div>
5965
</div>
6066

0 commit comments

Comments
 (0)