Coverage for apio/commands/apio_report.py: 100%
19 statements
« prev ^ index » next coverage.py v7.17.2, created at 2026-11-07 05:08 +0000
« prev ^ index » next coverage.py v7.17.2, created at 2026-11-07 05:08 +0000
1# This file is part of the Apio project
2# (C) 2016-present FPGAwars
3# Project authors:
4# * Jesús Arroyo (Jesus89) (2016-2019)
5# * Juan Gonzalez (obijuan) (2019-2024)
6# * The Apio Team (2024-present)
7# License: GPLv2
9"""Implementation of 'apio' report' command"""
11import sys
12from pathlib import Path
13import click
14from apio.managers.scons_manager import SConsManager
15from apio.commands import options
16from apio.apio_context import (
17 ApioContext,
18 PackagesPolicy,
19 ProjectPolicy,
20 RemoteConfigPolicy,
21)
22from apio.common.proto.stubs.apio_scons_pb2 import Verbosity
23from apio.utils import cmd_util
25# ---------- apio report
27# -- Text in the rich-text format of the python rich library.
28APIO_REPORT_HELP = """
29The command 'apio report' provides information on the utilization and timing \
30of the design. It is useful for analyzing utilization bottlenecks and \
31verifying that the design can operate at the desired clock speed.
33The '--verbose' option prints additional information such as as unused \
34resources and critical nets.
36Examples:[code]
37 apio report # Print report.
38 apio report --verbose # Print extra information.[/code]
39"""
42@click.command(
43 name="report",
44 cls=cmd_util.ApioCommand,
45 short_help="Report design utilization and timing.",
46 help=APIO_REPORT_HELP,
47)
48@click.pass_context
49@options.env_option_gen()
50@options.project_dir_option
51@options.verbose_option
52def cli(
53 _: click.Context,
54 *,
55 # Options
56 env: str | None,
57 project_dir: Path | None,
58 verbose: bool,
59):
60 """Analyze the design and report timing."""
62 # -- Create the apio context.
63 apio_ctx = ApioContext(
64 project_policy=ProjectPolicy.PROJECT_REQUIRED,
65 remote_config_policy=RemoteConfigPolicy.CACHED_OK,
66 packages_policy=PackagesPolicy.ENSURE_PACKAGES,
67 project_dir_arg=project_dir,
68 env_arg=env,
69 )
71 # -- Create the scons manager.
72 scons = SConsManager(apio_ctx)
74 # Run scons with the report target.
75 exit_code = scons.report(
76 verbosity=Verbosity(pnr=verbose),
77 )
79 # -- Done!
80 sys.exit(exit_code)