Coverage for tsfpga/examples/vivado/project.py: 0%

13 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-02-21 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 

9from pathlib import Path 

10from typing import Any 

11 

12from tsfpga.vivado.project import VivadoNetlistProject, VivadoProject 

13 

14THIS_DIR = Path(__file__).parent 

15 

16 

17class TsfpgaExampleVivadoProject(VivadoProject): 

18 """ 

19 Example Vivado project class. 

20 Shows how to override and extend the base behavior. 

21 """ 

22 

23 def pre_create( 

24 self, 

25 generics: dict[str, Any], 

26 **kwargs: Any, # noqa: ANN401 

27 ) -> bool: 

28 """ 

29 Override parent method to add custom behavior. 

30 Update TCL sources just before project creation. 

31 """ 

32 self.tcl_sources.append(THIS_DIR / "tcl" / "example_vivado_messages.tcl") 

33 

34 return super().pre_create(generics=generics, kwargs=kwargs) 

35 

36 

37class TsfpgaExampleVivadoNetlistProject(VivadoNetlistProject): 

38 """ 

39 Example Vivado project class for netlist builds. 

40 Shows how to override and extend the base behavior. 

41 """ 

42 

43 def pre_create( 

44 self, 

45 generics: dict[str, Any], 

46 **kwargs: Any, # noqa: ANN401 

47 ) -> bool: 

48 """ 

49 Override parent method to add custom behavior. 

50 Update TCL sources just before project creation. 

51 """ 

52 self.tcl_sources.append(THIS_DIR / "tcl" / "example_vivado_messages.tcl") 

53 self.tcl_sources.append(THIS_DIR / "tcl" / "example_vivado_netlist_messages.tcl") 

54 

55 return super().pre_create(generics=generics, kwargs=kwargs)