Coverage for pyEDAA/ToolSetup/OpenSource/GHDL.py: 66%
51 statements
« prev ^ index » next coverage.py v7.6.5, created at 2024-11-15 01:13 +0000
« prev ^ index » next coverage.py v7.6.5, created at 2024-11-15 01:13 +0000
1from typing import cast
3from pyTooling.Decorators import export
4from pyTooling.Configuration.YAML import Dictionary
5from pyTooling.CLIAbstraction import Executable
6from .. import Tool, ToolInstance
7from ..Interface import HDLSimulator
8from pyEDAA.CLITool.GHDL import GHDL as CLI_GHDL
11@export
12class GHDLInstance(ToolInstance, HDLSimulator):
13 _platform: str
14 _runtime: str
15 _backend: str
16 _ghdl: CLI_GHDL
18 def __init__(self, config: Dictionary, parent: 'GHDL'):
19 super().__init__(config, parent)
21 self._ghdl = None
22 self._platform = config["Platform"]
23 self._runtime = config["Runtime"]
24 self._backend = config["Backend"]
26 @property
27 def Platform(self) -> str:
28 """Platform GHDL runs on: ``win32``, ``win64``, ``lin64``."""
29 return self._platform
31 @property
32 def Runtime(self) -> str:
33 """Runtime used to run GHDL: ``mingw32``, ``mingw64``, ``ucrt64``, ``gnatgpl32``, ``lin64``."""
34 return self._runtime
36 @property
37 def Backend(self) -> str:
38 """GHDL's backend (``mcode``, ``llvm`` or ``gcc``."""
39 return self._backend
41 def _CreateGHDLCLIInstance(self) -> CLI_GHDL:
42 if self._ghdl is None:
43 self._ghdl = CLI_GHDL(binaryDirectoryPath=self.BinaryDirectory)
44 return self._ghdl
46 def GetGHDL(self) -> CLI_GHDL:
47 return self._CreateGHDLCLIInstance()
49 # def GetLibraryCreator(self) -> Executable:
50 # raise NotImplementedError(f"")
51 #
52 # def GetLibraryMapper(self) -> Executable:
53 # raise NotImplementedError(f"")
54 #
55 # def GetLibraryDeleter(self) -> Executable:
56 # raise NotImplementedError(f"")
58 def GetVHDLAnalyzer(self) -> Executable:
59 return self._CreateGHDLCLIInstance().GetGHDLAsAnalyzer()
61 def GetEloborator(self) -> Executable:
62 return self._CreateGHDLCLIInstance().GetGHDLAsElaborator()
64 def GetSimulator(self) -> Executable:
65 return self._CreateGHDLCLIInstance().GetGHDLAsSimulator()
68@export
69class GHDL(Tool, HDLSimulator):
70 _vendorKey = "OpenSource" #: Key of the parent node (vendor) in the configuration structure.
71 _key = "GHDL" #: Key used in the configuration structure.
73 _instanceClass = GHDLInstance
75 @property
76 def Default(self) -> GHDLInstance:
77 return cast(GHDLInstance, super().Default)
79 # def GetLibraryCreator(self) -> Executable:
80 # raise NotImplementedError(f"")
81 #
82 # def GetLibraryMapper(self) -> Executable:
83 # raise NotImplementedError(f"")
84 #
85 # def GetLibraryDeleter(self) -> Executable:
86 # raise NotImplementedError(f"")
88 def GetVHDLAnalyzer(self) -> Executable:
89 raise NotImplementedError(f"")
91 def GetEloborator(self) -> Executable:
92 raise NotImplementedError(f"")
94 def GetSimulator(self) -> Executable:
95 raise NotImplementedError(f"")