import typer import synth as syn import build_env from typing_extensions import Annotated app = typer.Typer() @app.command() def init(): print("Initializing GHDL project in current directory...") build_env.createBuildEnv() def complete_vhdl_ver(): return ["87", "93", "93c", "00", "02", "08"] @app.command() def synth( topdef: Annotated[str, typer.Argument(help="Top Definition entity to synthesize")] = "", arch: Annotated[str, typer.Argument(help="Architecture to synthesize within the top definition provided")] = "", library: Annotated[str, typer.Option("--library", "-l", help="Library to compile from")] = "work", std: Annotated[str, typer.Option(help="Which VHDL standard to use. 87, 93, 93c, 00, 02 or 08", autocompletion=complete_vhdl_ver)] = "93c" ): print(f"Synthesizing {topdef} with arch {arch} in library {library}. VHDL {std}") syn.synthDesign(topdef, arch, library, std) @app.command() def run( topdef: Annotated[str, typer.Argument(help="Top Definition entity to synthesize")] = "", arch: Annotated[str, typer.Argument(help="Architecture to synthesize within the top definition provided")] = "", library: Annotated[str, typer.Option("--library", "-l", help="Library to compile from")] = "work", std: Annotated[str, typer.Option(help="Which VHDL standard to use. 87, 93, 93c, 00, 02 or 08", autocompletion=complete_vhdl_ver)] = "93c" ): print(f"Running (and synthesizing if needed) {topdef} with arch {arch} in library {library}. VHDL {std}") syn.runDesign(topdef, arch, library, std) @app.command() def build(): print("Build!") if __name__ == "__main__": app()