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

13 statements  

« prev     ^ index     » next       coverage.py v7.5.1, created at 2024-05-07 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 

9# Standard libraries 

10from pathlib import Path 

11from typing import Any 

12 

13# First party libraries 

14from tsfpga.vivado.project import VivadoNetlistProject, VivadoProject 

15 

16THIS_DIR = Path(__file__).parent 

17 

18 

19class TsfpgaExampleVivadoProject(VivadoProject): 

20 """ 

21 Example Vivado project class. 

22 Shows how to override and extend the base behavior. 

23 """ 

24 

25 def pre_create( # type: ignore[override] # pylint: disable=arguments-differ 

26 self, generics: dict[str, Any], **kwargs: Any 

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( # type: ignore[override] # pylint: disable=arguments-differ 

44 self, generics: dict[str, Any], **kwargs: Any 

45 ) -> bool: 

46 """ 

47 Override parent method to add custom behavior. 

48 Update TCL sources just before project creation. 

49 """ 

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

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

52 

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