Coverage for tsfpga/examples/build_fpga.py: 0%

15 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-08-29 20:51 +0000

1# -------------------------------------------------------------------------------------------------- 

2# Copyright (c) Lukas Vik. All rights reserved. 

3# 

4# This file is part of the tsfpga project, a project platform for modern FPGA development. 

5# https://tsfpga.com 

6# https://github.com/tsfpga/tsfpga 

7# -------------------------------------------------------------------------------------------------- 

8 

9import sys 

10from pathlib import Path 

11 

12# Do PYTHONPATH insert() instead of append() to prefer any local repo checkout over any pip install. 

13REPO_ROOT = Path(__file__).parent.parent.parent.resolve() 

14sys.path.insert(0, str(REPO_ROOT)) 

15 

16# Import before others since it modifies PYTHONPATH. 

17import tsfpga.examples.example_pythonpath # noqa: F401 

18 

19from tsfpga.build_project_list import BuildProjectList 

20from tsfpga.examples.build_fpga_utils import arguments, collect_artifacts, setup_and_run 

21from tsfpga.examples.example_env import TSFPGA_EXAMPLES_TEMP_DIR, get_tsfpga_example_modules 

22 

23 

24def main() -> None: 

25 """ 

26 Main function for building FPGA projects. If you are setting up a new build flow from scratch, 

27 you probably want to copy and modify this function, and reuse the others. 

28 """ 

29 args = arguments(default_temp_dir=TSFPGA_EXAMPLES_TEMP_DIR) 

30 modules = get_tsfpga_example_modules() 

31 projects = BuildProjectList( 

32 modules=modules, 

33 project_filters=args.project_filters, 

34 include_netlist_not_top_builds=args.netlist_builds, 

35 no_color=args.no_color, 

36 ) 

37 

38 sys.exit( 

39 setup_and_run( 

40 modules=modules, 

41 projects=projects, 

42 args=args, 

43 collect_artifacts_function=collect_artifacts, 

44 ) 

45 ) 

46 

47 

48if __name__ == "__main__": 

49 main()