Coverage for tsfpga/build_step_tcl_hook.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-04-20 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 Represent a TCL file that shall be used as hook in one of the build steps. 

16 """ 

17 

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

19 """ 

20 Arguments: 

21 tcl_file: Path to a TCL file. 

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

23 See 

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

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

26 """ 

27 self.tcl_file = tcl_file 

28 self.hook_step = hook_step 

29 

30 @property 

31 def step_is_synth(self) -> bool: 

32 """ 

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

34 """ 

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

36 

37 def __str__(self) -> str: 

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

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