diff --git a/tapa/__main__.py b/tapa/__main__.py index 18f6b479..b78f5421 100644 --- a/tapa/__main__.py +++ b/tapa/__main__.py @@ -20,7 +20,7 @@ from tapa.steps.pack import pack from tapa.steps.synth import synth from tapa.steps.version import version -from tapa.util import setup_logging +from tapa.util import Options, setup_logging _logger = logging.getLogger().getChild(__name__) @@ -54,17 +54,26 @@ metavar="limit", help="Override Python recursion limit.", ) +@click.option( + "--enable-pyslang / --disable-pyslang", + type=bool, + default=False, + help="Enable or disable pyslang (experimental).", +) @click.pass_context -def entry_point( +def entry_point( # noqa: PLR0913,PLR0917 ctx: click.Context, verbose: bool, quiet: bool, work_dir: str, recursion_limit: int, + enable_pyslang: bool, ) -> None: """The TAPA compiler.""" setup_logging(verbose, quiet, work_dir) + Options.enable_pyslang = enable_pyslang + # Setup execution context ctx.ensure_object(dict) switch_work_dir(work_dir) diff --git a/tapa/util.py b/tapa/util.py index 1edbc2b7..df6161a2 100644 --- a/tapa/util.py +++ b/tapa/util.py @@ -39,6 +39,12 @@ AST_IOPort = Input | Output | Inout +class Options: + """Global configuration options.""" + + enable_pyslang: bool = False + + class PortInfo: """Port information extracted from a Verilog module definition."""