Skip to content

Commit 53e405e

Browse files
committed
feat: add report generation from JSON
Signed-off-by: James McCorrie <james.mccorrie@lowrisc.org>
1 parent 7ceaaf1 commit 53e405e

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

src/dvsim/cli/main.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,49 @@
44

55
"""DVSim CLI main entry point."""
66

7+
from pathlib import Path
8+
79
import click
810

11+
from dvsim.report.data import ResultsSummary
12+
from dvsim.report.generate import gen_block_report
13+
914

1015
@click.group(invoke_without_command=True)
1116
@click.pass_context
1217
def main(ctx) -> None:
1318
"""Entry point for DVSim."""
1419
if ctx.invoked_subcommand is None:
15-
from dvsim.cli.run import run # noqa: PLC0415
20+
from dvsim.cli.run import run
1621

1722
run()
1823

1924

25+
@main.group()
26+
def report() -> None:
27+
"""Reporting helper commands."""
28+
29+
30+
@report.command()
31+
@click.argument(
32+
"json_path",
33+
type=click.Path(exists=True, file_okay=True, dir_okay=False, path_type=Path),
34+
)
35+
@click.argument(
36+
"output_dir",
37+
type=click.Path(file_okay=False, dir_okay=True, path_type=Path),
38+
)
39+
def gen(json_path: Path, output_dir: Path) -> None:
40+
"""Generate a report from a existing results JSON."""
41+
from dvsim.report.generate import gen_summary_report
42+
43+
results: ResultsSummary = ResultsSummary.load(path=json_path)
44+
45+
gen_summary_report(summary=results, path=output_dir)
46+
47+
for flow_result in results.flow_results.values():
48+
gen_block_report(flow_result, path=output_dir)
49+
50+
2051
if __name__ == "__main__":
2152
main()

0 commit comments

Comments
 (0)