Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/dvsim/sim/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ class SimResultsSummary(BaseModel):
top: IPMeta
"""Meta data for the top level config."""

version: str | None
"""The version of DVSim being used, if applicable."""

timestamp: datetime
"""Run time stamp."""

Expand Down
8 changes: 8 additions & 0 deletions src/dvsim/sim/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from collections import OrderedDict, defaultdict
from collections.abc import Mapping, Sequence
from datetime import datetime, timezone
from importlib.metadata import PackageNotFoundError, version
from pathlib import Path
from typing import ClassVar

Expand Down Expand Up @@ -638,6 +639,12 @@ def gen_results(self, results: Sequence[CompletedJobStatus]) -> None:
.isoformat()
)

try:
dvsim_version = version("dvsim").strip()
except PackageNotFoundError as e:
log.debug("DVSim package not found: %s", str(e))
dvsim_version = None

results_summary = SimResultsSummary(
top=IPMeta(
name=self.name,
Expand All @@ -646,6 +653,7 @@ def gen_results(self, results: Sequence[CompletedJobStatus]) -> None:
branch=self.branch,
url=url,
),
version=dvsim_version,
timestamp=timestamp,
flow_results=all_flow_results,
report_path=reports_dir,
Expand Down
7 changes: 4 additions & 3 deletions src/dvsim/sim/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
)


def gen_block_report(results: SimFlowResults, path: Path) -> None:
def gen_block_report(results: SimFlowResults, path: Path, version: str | None = None) -> None:
"""Generate a block report.

Args:
results: flow results for the block
path: output directory path
version: dvsim version used to get results for this block

"""
file_name = (
Expand All @@ -42,7 +43,7 @@ def gen_block_report(results: SimFlowResults, path: Path) -> None:
(path / f"{file_name}.html").write_text(
render_template(
path="reports/block_report.html",
data={"results": results},
data={"results": results, "version": version},
),
)

Expand Down Expand Up @@ -99,4 +100,4 @@ def gen_reports(summary: SimResultsSummary, path: Path) -> None:
gen_summary_report(summary=summary, path=path)

for flow_result in summary.flow_results.values():
gen_block_report(results=flow_result, path=path)
gen_block_report(results=flow_result, path=path, version=summary.version)
6 changes: 6 additions & 0 deletions src/dvsim/templates/reports/block_report.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ <h2>Simulation Results: {{ block.name }}</h2>
<span class="badge text-bg-secondary">
{{ timestamp.strftime("%d/%m/%Y %H:%M:%S") }}
</span>
{% if version %}
<a class="badge text-bg-secondary link-underline link-underline-opacity-0"
href="https://github.com/lowRISC/dvsim/releases/tag/v{{ version }}">
DVSim: v{{ version }}
</a>
{% endif %}
<a class="badge text-bg-secondary link-underline link-underline-opacity-0"
href="{{ block.url }}">
sha: {{ block.commit[:7] }}
Expand Down
7 changes: 7 additions & 0 deletions src/dvsim/templates/reports/summary_report.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
-->
{% set top = summary.top %}
{% set timestamp = summary.timestamp %}
{% set version = summary.version %}
<div class="container-md">
<div class="row">
<div class="col">
Expand Down Expand Up @@ -36,6 +37,12 @@ <h2>Simulation Results: {{ top.name }}</h2>
<span class="badge text-bg-secondary">
{{ timestamp.strftime("%d/%m/%Y %H:%M:%S") }}
</span>
{% if version %}
<a class="badge text-bg-secondary link-underline link-underline-opacity-0"
href="https://github.com/lowRISC/dvsim/releases/tag/v{{ version }}">
DVSim: v{{ version }}
</a>
{% endif %}
<a class="badge text-bg-secondary link-underline link-underline-opacity-0"
href="{{ top.url }}">
sha: {{ top.commit[:7] }}
Expand Down
Loading