Skip to content

Commit 73492ba

Browse files
committed
Added Physical...Literals.
1 parent 17597bf commit 73492ba

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

pyVHDLModel/VHDLModel.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,45 @@ def __str__(self) -> str:
842842

843843
@export
844844
class PhysicalLiteral(NumericLiteral):
845-
pass
845+
_unitName: str
846+
847+
def __init__(self, unitName: str):
848+
super().__init__()
849+
self._unitName = unitName
850+
851+
@property
852+
def UnitName(self) -> str:
853+
return self._unitName
854+
855+
def __str__(self) -> str:
856+
return "{value} {unit}".format(value=self._value, unit=self._unitName)
857+
858+
859+
@export
860+
class PhysicalIntegerLiteral(PhysicalLiteral):
861+
_value: int
862+
_unitName: str
863+
864+
def __init__(self, value: int, unitName: str):
865+
super().__init__(unitName)
866+
self._value = value
867+
868+
@property
869+
def Value(self) -> int:
870+
return self._value
871+
872+
873+
@export
874+
class PhysicalFloatingLiteral(PhysicalLiteral):
875+
_value: float
876+
877+
def __init__(self, value: float, unitName: str):
878+
super().__init__(unitName)
879+
self._value = value
880+
881+
@property
882+
def Value(self) -> float:
883+
return self._value
846884

847885

848886
@export

0 commit comments

Comments
 (0)