diff options
author | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2021-06-22 19:20:16 +0200 |
---|---|---|
committer | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2021-06-22 19:24:01 +0200 |
commit | ea328fa671fc42569a688c8dfb308d87f42771c3 (patch) | |
tree | 7c7e53389378fd84414bc3d91d178f636d6498e6 /pyGHDL/dom | |
parent | 469a8d28a1efae99ea1dc1e3f3c84c4889ba2421 (diff) | |
download | ghdl-ea328fa671fc42569a688c8dfb308d87f42771c3.tar.gz ghdl-ea328fa671fc42569a688c8dfb308d87f42771c3.tar.bz2 ghdl-ea328fa671fc42569a688c8dfb308d87f42771c3.zip |
Prepared for DeferredConstant.
Diffstat (limited to 'pyGHDL/dom')
-rw-r--r-- | pyGHDL/dom/DesignUnit.py | 4 | ||||
-rw-r--r-- | pyGHDL/dom/Object.py | 19 | ||||
-rw-r--r-- | pyGHDL/dom/formatting/prettyprint.py | 18 |
3 files changed, 31 insertions, 10 deletions
diff --git a/pyGHDL/dom/DesignUnit.py b/pyGHDL/dom/DesignUnit.py index 7eb15aebe..bf16b5c4b 100644 --- a/pyGHDL/dom/DesignUnit.py +++ b/pyGHDL/dom/DesignUnit.py @@ -115,7 +115,9 @@ class Package(VHDLModel_Package): @classmethod def parse(cls, packageNode: Iir): name = GetNameOfNode(packageNode) - generics = None # GetGenericsFromChainedNodes(nodes.Get_Generic_Chain(packageNode)) + generics = ( + None # GetGenericsFromChainedNodes(nodes.Get_Generic_Chain(packageNode)) + ) declaredItems = GetDeclaredItemsFromChainedNodes( nodes.Get_Declaration_Chain(packageNode), "package", name ) diff --git a/pyGHDL/dom/Object.py b/pyGHDL/dom/Object.py index 746971bac..953fddc41 100644 --- a/pyGHDL/dom/Object.py +++ b/pyGHDL/dom/Object.py @@ -37,6 +37,7 @@ from pyGHDL.dom._Translate import GetSubtypeIndicationFromNode, GetExpressionFro from pyGHDL.dom._Utils import GetNameOfNode from pyVHDLModel.VHDLModel import ( Constant as VHDLModel_Constant, + DeferredConstant as VHDLModel_DeferredConstant, Variable as VHDLModel_Variable, Signal as VHDLModel_Signal, Expression, @@ -67,6 +68,24 @@ class Constant(VHDLModel_Constant): @export +class DeferredConstant(VHDLModel_DeferredConstant): + def __init__(self, name: str, subType: SubTypeOrSymbol): + super().__init__(name) + + self._name = name + self._subType = subType + + @classmethod + def parse(cls, node): + name = GetNameOfNode(node) + subTypeIndication = GetSubtypeIndicationFromNode( + node, "deferred constant", name + ) + + return cls(name, subTypeIndication) + + +@export class Variable(VHDLModel_Variable): def __init__( self, name: str, subType: SubTypeOrSymbol, defaultExpression: Expression diff --git a/pyGHDL/dom/formatting/prettyprint.py b/pyGHDL/dom/formatting/prettyprint.py index f19125811..0509b826d 100644 --- a/pyGHDL/dom/formatting/prettyprint.py +++ b/pyGHDL/dom/formatting/prettyprint.py @@ -54,7 +54,7 @@ class PrettyPrint: buffer = [] prefix = " " * level buffer.append("{prefix}Libraries:".format(prefix=prefix)) - for library in design.Libraries: + for library in design.Libraries.values(): for line in self.formatLibrary(library, level + 1): buffer.append(line) buffer.append("{prefix}Documents:".format(prefix=prefix)) @@ -74,18 +74,18 @@ class PrettyPrint: for entity in library.Entities: for line in self.formatEntity(entity, level + 1): buffer.append(line) - buffer.append("{prefix}Architectures:".format(prefix=prefix)) - for architecture in library.Architectures: - for line in self.formatArchitecture(architecture, level + 1): - buffer.append(line) + # buffer.append("{prefix}Architectures:".format(prefix=prefix)) + # for architecture in library.Architectures: + # for line in self.formatArchitecture(architecture, level + 1): + # buffer.append(line) buffer.append("{prefix}Packages:".format(prefix=prefix)) for package in library.Packages: for line in self.formatPackage(package, level + 1): buffer.append(line) - buffer.append("{prefix}PackageBodies:".format(prefix=prefix)) - for packageBodies in library.PackageBodies: - for line in self.formatPackageBody(packageBodies, level + 1): - buffer.append(line) + # buffer.append("{prefix}PackageBodies:".format(prefix=prefix)) + # for packageBodies in library.PackageBodies: + # for line in self.formatPackageBody(packageBodies, level + 1): + # buffer.append(line) buffer.append("{prefix}Configurations:".format(prefix=prefix)) for configuration in library.Configurations: for line in self.formatConfiguration(configuration, level + 1): |