Coverage for pyVHDLModel/PSLModel.py: 83%

36 statements  

« 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 

36 

37from typing import Optional as Nullable 

38 

39from pyVHDLModel.Base import ModelEntity, NamedEntityMixin, DocumentedEntityMixin 

40from pyVHDLModel.DesignUnit import PrimaryUnit 

41 

42 

43@export 

44class PSLEntity(ModelEntity): 

45 """ 

46 Represents the base-class of all PSL entities. 

47 

48 PSL (Property Specification Language) support is rudimentary: verification units are recognised 

49 and named, but their contents are not modelled. 

50 

51 .. seealso:: 

52 

53 * :class:`Default clock <pyVHDLModel.PSLModel.DefaultClock>` 

54 """ 

55 pass 

56 

57 

58@export 

59class PSLPrimaryUnit(PrimaryUnit): 

60 """ 

61 Represents the base-class of all PSL primary units. 

62 

63 .. seealso:: 

64 

65 * :class:`Verification unit <pyVHDLModel.PSLModel.VerificationUnit>` 

66 * :class:`Verification property <pyVHDLModel.PSLModel.VerificationProperty>` 

67 * :class:`Verification mode <pyVHDLModel.PSLModel.VerificationMode>` 

68 """ 

69 pass 

70 

71 

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``). 

80 

81 :param identifier: The identifier of a model entity. 

82 """ 

83 super().__init__(identifier, parent=None) 

84 

85 def __str__(self) -> str: 

86 """ 

87 Formats the verification unit declaration. 

88 

89 **Format:** ``vunit myUnit`` 

90 

91 :returns: Formatted verification unit declaration. 

92 """ 

93 return f"vunit {self._identifier}" 

94 

95 

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``). 

104 

105 :param identifier: The identifier of a model entity. 

106 """ 

107 super().__init__(identifier, parent=None) 

108 

109 def __str__(self) -> str: 

110 """ 

111 Formats the verification property declaration. 

112 

113 **Format:** ``vprop myUnit`` 

114 

115 :returns: Formatted verification property declaration. 

116 """ 

117 return f"vprop {self._identifier}" 

118 

119 

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``). 

128 

129 :param identifier: The identifier of a model entity. 

130 """ 

131 super().__init__(identifier, parent=None) 

132 

133 def __str__(self) -> str: 

134 """ 

135 Formats the verification mode declaration. 

136 

137 **Format:** ``vmode myUnit`` 

138 

139 :returns: Formatted verification mode declaration. 

140 """ 

141 return f"vmode {self._identifier}" 

142 

143 

144@export 

145class DefaultClock(PSLEntity, NamedEntityMixin, DocumentedEntityMixin): 

146 """ 

147 Represents a PSL default clock declaration. 

148 

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. 

154 

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) 

161 

162 def __str__(self) -> str: 

163 """ 

164 Formats the default clock declaration. 

165 

166 **Format:** ``default clock myClock`` 

167 

168 :returns: Formatted default clock declaration. 

169 """ 

170 return f"default clock {self._identifier}"