Coverage for pyEDAA/ToolSetup/OpenSource/GHDL.py: 63%
47 statements
« prev ^ index » next coverage.py v7.15.1, created at 2026-07-13 18:11 +0000
« prev ^ index » next coverage.py v7.15.1, created at 2026-07-13 18:11 +0000
1# ==================================================================================================================== #
2# _____ ____ _ _ _____ _ ____ _ #
3# _ __ _ _| ____| _ \ / \ / \ |_ _|__ ___ | / ___| ___| |_ _ _ _ __ #
4# | '_ \| | | | _| | | | |/ _ \ / _ \ | |/ _ \ / _ \| \___ \ / _ \ __| | | | '_ \ #
5# | |_) | |_| | |___| |_| / ___ \ / ___ \ _| | (_) | (_) | |___) | __/ |_| |_| | |_) | #
6# | .__/ \__, |_____|____/_/ \_\/_/ \_(_)_|\___/ \___/|_|____/ \___|\__|\__,_| .__/ #
7# |_| |___/ |_| #
8# ==================================================================================================================== #
9# Authors: #
10# Patrick Lehmann #
11# #
12# License: #
13# ==================================================================================================================== #
14# Copyright 2021-2026 Patrick Lehmann - Bötzingen, Germany #
15# #
16# Licensed under the Apache License, Version 2.0 (the "License"); #
17# you may not use this file except in compliance with the License. #
18# You may obtain a copy of the License at #
19# #
20# http://www.apache.org/licenses/LICENSE-2.0 #
21# #
22# Unless required by applicable law or agreed to in writing, software #
23# distributed under the License is distributed on an "AS IS" BASIS, #
24# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
25# See the License for the specific language governing permissions and #
26# limitations under the License. #
27# #
28# SPDX-License-Identifier: Apache-2.0 #
29# ==================================================================================================================== #
30#
31from typing import cast
33from pyTooling.Decorators import export
34from pyTooling.Configuration.YAML import Dictionary
35from pyTooling.CLIAbstraction import Executable
36from .. import Tool, ToolInstance
37from ..Interface import HDLSimulator
38from pyEDAA.CLITool.GHDL import GHDL as CLI_GHDL
41@export
42class GHDLInstance(ToolInstance, HDLSimulator):
43 _platform: str
44 _runtime: str
45 _backend: str
46 _ghdl: CLI_GHDL
48 def __init__(self, config: Dictionary, parent: 'GHDL') -> None:
49 super().__init__(config, parent)
51 self._ghdl = None
52 self._platform = config["Platform"]
53 self._runtime = config["Runtime"]
54 self._backend = config["Backend"]
56 @property
57 def Platform(self) -> str:
58 """Platform GHDL runs on: ``win64``, ``lin64``."""
59 return self._platform
61 @property
62 def Runtime(self) -> str:
63 """Runtime used to run GHDL: ``mingw64``, ``ucrt64``, ``lin64``."""
64 return self._runtime
66 @property
67 def Backend(self) -> str:
68 """GHDL's backend: ``mcode``, ``llvm`` or ``gcc``."""
69 return self._backend
71 def _CreateGHDLCLIInstance(self) -> CLI_GHDL:
72 if self._ghdl is None:
73 self._ghdl = CLI_GHDL(binaryDirectoryPath=self.BinaryDirectory)
74 return self._ghdl
76 def GetGHDL(self) -> CLI_GHDL:
77 return self._CreateGHDLCLIInstance()
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 return self._CreateGHDLCLIInstance().GetGHDLAsAnalyzer()
91 def GetEloborator(self) -> Executable:
92 return self._CreateGHDLCLIInstance().GetGHDLAsElaborator()
94 def GetSimulator(self) -> Executable:
95 return self._CreateGHDLCLIInstance().GetGHDLAsSimulator()
98@export
99class GHDL(Tool, HDLSimulator):
100 _vendorKey = "OpenSource" #: Key of the parent node (vendor) in the configuration structure.
101 _key = "GHDL" #: Key used in the configuration structure.
103 _instanceClass = GHDLInstance
105 @property
106 def Default(self) -> GHDLInstance:
107 return cast(GHDLInstance, super().Default)
109 # def GetLibraryCreator(self) -> Executable:
110 # raise NotImplementedError(f"")
111 #
112 # def GetLibraryMapper(self) -> Executable:
113 # raise NotImplementedError(f"")
114 #
115 # def GetLibraryDeleter(self) -> Executable:
116 # raise NotImplementedError(f"")
118 def GetVHDLAnalyzer(self) -> Executable:
119 raise NotImplementedError(f"")
121 def GetEloborator(self) -> Executable:
122 raise NotImplementedError(f"")
124 def GetSimulator(self) -> Executable:
125 raise NotImplementedError(f"")