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

15 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-04 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 self.tcl_sources.append(THIS_DIR / "tcl" / "example_vivado_message_undriven_pin.tcl") 

34 

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

36 

37 

38class TsfpgaExampleVivadoNetlistProject(VivadoNetlistProject): 

39 """ 

40 Example Vivado project class for netlist builds. 

41 Shows how to override and extend the base behavior. 

42 """ 

43 

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

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

46 ) -> bool: 

47 """ 

48 Override parent method to add custom behavior. 

49 Update TCL sources just before project creation. 

50 """ 

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

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

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

54 

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