Coverage for pyVHDLModel/PSLModel.py: 83%
36 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-09-11 23:50 +0000
« prev ^ index » next coverage.py v7.16.0, created at 2026-09-11 23:50 +0000
1# ==================================================================================================================== #
2# __ ___ _ ____ _ __ __ _ _ #
3# _ __ _ \ \ / / | | | _ \| | | \/ | ___ __| | ___| | #
4# | '_ \| | | \ \ / /| |_| | | | | | | |\/| |/ _ \ / _` |/ _ \ | #
5# | |_) | |_| |\ V / | _ | |_| | |___| | | | (_) | (_| | __/ | #
6# | .__/ \__, | \_/ |_| |_|____/|_____|_| |_|\___/ \__,_|\___|_| #
7# |_| |___/ #
8# ==================================================================================================================== #
9# Authors: #
10# Patrick Lehmann #
11# #
12# License: #
13# ==================================================================================================================== #
14# Copyright 2017-2026 Patrick Lehmann - Boetzingen, Germany #
15# Copyright 2016-2017 Patrick Lehmann - Dresden, Germany #
16# #
17# Licensed under the Apache License, Version 2.0 (the "License"); #
18# you may not use this file except in compliance with the License. #
19# You may obtain a copy of the License at #
20# #
21# http://www.apache.org/licenses/LICENSE-2.0 #
22# #
23# Unless required by applicable law or agreed to in writing, software #
24# distributed under the License is distributed on an "AS IS" BASIS, #
25# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
26# See the License for the specific language governing permissions and #
27# limitations under the License. #
28# #
29# SPDX-License-Identifier: Apache-2.0 #
30# ==================================================================================================================== #
31#
32"""
33This module contains an abstract document language model for PSL in VHDL.
34"""
35from pyTooling.Decorators import export
37from typing import Optional as Nullable
39from pyVHDLModel.Base import ModelEntity, NamedEntityMixin, DocumentedEntityMixin
40from pyVHDLModel.DesignUnit import PrimaryUnit
43@export
44class PSLEntity(ModelEntity):
45 """
46 Represents the base-class of all PSL entities.
48 PSL (Property Specification Language) support is rudimentary: verification units are recognised
49 and named, but their contents are not modelled.
51 .. seealso::
53 * :class:`Default clock <pyVHDLModel.PSLModel.DefaultClock>`
54 """
55 pass
58@export
59class PSLPrimaryUnit(PrimaryUnit):
60 """
61 Represents the base-class of all PSL primary units.
63 .. seealso::
65 * :class:`Verification unit <pyVHDLModel.PSLModel.VerificationUnit>`
66 * :class:`Verification property <pyVHDLModel.PSLModel.VerificationProperty>`
67 * :class:`Verification mode <pyVHDLModel.PSLModel.VerificationMode>`
68 """
69 pass
72@export
73class VerificationUnit(PSLPrimaryUnit):
74 """
75 Represents a PSL verification unit (``vunit``).
76 """
77 def __init__(self, identifier: str) -> None:
78 """
79 Initializes a PSL verification unit (``vunit``).
81 :param identifier: The identifier of a model entity.
82 """
83 super().__init__(identifier, parent=None)
85 def __str__(self) -> str:
86 """
87 Formats the verification unit declaration.
89 **Format:** ``vunit myUnit``
91 :returns: Formatted verification unit declaration.
92 """
93 return f"vunit {self._identifier}"
96@export
97class VerificationProperty(PSLPrimaryUnit):
98 """
99 Represents a PSL verification property (``vprop``).
100 """
101 def __init__(self, identifier: str) -> None:
102 """
103 Initializes a PSL verification property (``vprop``).
105 :param identifier: The identifier of a model entity.
106 """
107 super().__init__(identifier, parent=None)
109 def __str__(self) -> str:
110 """
111 Formats the verification property declaration.
113 **Format:** ``vprop myUnit``
115 :returns: Formatted verification property declaration.
116 """
117 return f"vprop {self._identifier}"
120@export
121class VerificationMode(PSLPrimaryUnit):
122 """
123 Represents a PSL verification mode (``vmode``).
124 """
125 def __init__(self, identifier: str) -> None:
126 """
127 Initializes a PSL verification mode (``vmode``).
129 :param identifier: The identifier of a model entity.
130 """
131 super().__init__(identifier, parent=None)
133 def __str__(self) -> str:
134 """
135 Formats the verification mode declaration.
137 **Format:** ``vmode myUnit``
139 :returns: Formatted verification mode declaration.
140 """
141 return f"vmode {self._identifier}"
144@export
145class DefaultClock(PSLEntity, NamedEntityMixin, DocumentedEntityMixin):
146 """
147 Represents a PSL default clock declaration.
149 It names the clock expression used by PSL directives that do not state one themselves.
150 """
151 def __init__(self, identifier: str, documentation: Nullable[str] = None) -> None:
152 """
153 Initializes a PSL default clock declaration.
155 :param identifier: The identifier of a model entity.
156 :param documentation: The documentation comment associated with this declaration.
157 """
158 super().__init__()
159 NamedEntityMixin.__init__(self, identifier)
160 DocumentedEntityMixin.__init__(self, documentation)
162 def __str__(self) -> str:
163 """
164 Formats the default clock declaration.
166 **Format:** ``default clock myClock``
168 :returns: Formatted default clock declaration.
169 """
170 return f"default clock {self._identifier}"