Coverage for tsfpga/build_step_tcl_hook.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.3.2, created at 2023-12-10 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 

11 

12 

13class BuildStepTclHook: 

14 

15 """ 

16 Represent a TCL file that shall be used as hook in one of the build steps. 

17 """ 

18 

19 def __init__(self, tcl_file: Path, hook_step: str) -> None: 

20 """ 

21 Arguments: 

22 tcl_file: Path to a TCL file. 

23 hook_step: Name of a build step, e.g. ``STEPS.ROUTE_DESIGN.TCL.PRE``. 

24 See 

25 https://docs.xilinx.com/r/en-US/ug894-vivado-tcl-scripting/Defining-Tcl-Hook-Scripts 

26 for a list of the available build steps in AMD Vivado. 

27 """ 

28 self.tcl_file = tcl_file 

29 self.hook_step = hook_step 

30 

31 @property 

32 def step_is_synth(self) -> bool: 

33 """ 

34 True if the build step is in synthesis. False otherwise. 

35 """ 

36 return "synth" in self.hook_step.lower() 

37 

38 def __str__(self) -> str: 

39 result = str(self.__class__.__name__) + ":" 

40 return result + f"{self.hook_step}:{self.tcl_file}"