From d9241cf7156ff2e8b1ce8258e780eb9c8bf1e38f Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 20 Jun 2021 16:52:45 +0200 Subject: Added concatenation and string literal. --- pyGHDL/dom/Literal.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'pyGHDL/dom/Literal.py') diff --git a/pyGHDL/dom/Literal.py b/pyGHDL/dom/Literal.py index 7c722583b..334355b35 100644 --- a/pyGHDL/dom/Literal.py +++ b/pyGHDL/dom/Literal.py @@ -39,6 +39,7 @@ from pyVHDLModel.VHDLModel import ( IntegerLiteral as VHDLModel_IntegerLiteral, FloatingPointLiteral as VHDLModel_FloatingPointLiteral, CharacterLiteral as VHDLModel_CharacterLiteral, + StringLiteral as VHDLModel_StringLiteral, ) __all__ = [] @@ -67,3 +68,12 @@ class CharacterLiteral(VHDLModel_CharacterLiteral): identifier = nodes.Get_Identifier(node) value = name_table.Get_Character(identifier) return cls(value) + + +@export +class StringLiteral(VHDLModel_StringLiteral): + @classmethod + def parse(cls, node): + stringID = nodes.Get_String8_Id(node) + value = name_table.Get_Name_Ptr(stringID) + return cls(value) -- cgit v1.2.3 From ba097bd3118db3135e75b913cae81973995777cd Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Mon, 21 Jun 2021 19:19:11 +0200 Subject: Handle component declarations. --- pyGHDL/dom/Literal.py | 1 + 1 file changed, 1 insertion(+) (limited to 'pyGHDL/dom/Literal.py') diff --git a/pyGHDL/dom/Literal.py b/pyGHDL/dom/Literal.py index 334355b35..78f3f279a 100644 --- a/pyGHDL/dom/Literal.py +++ b/pyGHDL/dom/Literal.py @@ -30,6 +30,7 @@ # # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ +from pyGHDL.dom._Utils import GetIirKindOfNode from pyGHDL.libghdl import name_table from pyGHDL.libghdl.vhdl import nodes -- cgit v1.2.3 From f0517014231ee735c180a3150b55b878f6af763d Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Mon, 21 Jun 2021 19:19:50 +0200 Subject: Handle Physical...Literals --- pyGHDL/dom/Literal.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'pyGHDL/dom/Literal.py') diff --git a/pyGHDL/dom/Literal.py b/pyGHDL/dom/Literal.py index 78f3f279a..4fe3a843c 100644 --- a/pyGHDL/dom/Literal.py +++ b/pyGHDL/dom/Literal.py @@ -39,6 +39,8 @@ from pydecor import export from pyVHDLModel.VHDLModel import ( IntegerLiteral as VHDLModel_IntegerLiteral, FloatingPointLiteral as VHDLModel_FloatingPointLiteral, + PhysicalIntegerLiteral as VHDLModel_PhysicalIntegerLiteral, + PhysicalFloatingLiteral as VHDLModel_PhysicalFloatingLiteral, CharacterLiteral as VHDLModel_CharacterLiteral, StringLiteral as VHDLModel_StringLiteral, ) @@ -62,6 +64,28 @@ class FloatingPointLiteral(VHDLModel_FloatingPointLiteral): return cls(value) +@export +class PhysicalIntegerLiteral(VHDLModel_PhysicalIntegerLiteral): + @classmethod + def parse(cls, node): + value = nodes.Get_Value(node) + unit = nodes.Get_Unit_Name(node) + unitName = name_table.Get_Name_Ptr(unit) + + return cls(value, unitName) + + +@export +class PhysicalFloatingLiteral(VHDLModel_PhysicalFloatingLiteral): + @classmethod + def parse(cls, node): + value = nodes.Get_Fp_Value(node) + unit = nodes.Get_Unit_Name(node) + unitName = name_table.Get_Name_Ptr(unit) + + return cls(value, unitName) + + @export class CharacterLiteral(VHDLModel_CharacterLiteral): @classmethod -- cgit v1.2.3 From ad34fac3f4e30f0ff13e1630b42373f31b2918a4 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Mon, 21 Jun 2021 21:44:31 +0200 Subject: Fixed function call parameters. Fixed physical literal units. Added basic Procedure detection. --- pyGHDL/dom/Literal.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pyGHDL/dom/Literal.py') diff --git a/pyGHDL/dom/Literal.py b/pyGHDL/dom/Literal.py index 4fe3a843c..44c002955 100644 --- a/pyGHDL/dom/Literal.py +++ b/pyGHDL/dom/Literal.py @@ -30,7 +30,7 @@ # # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ -from pyGHDL.dom._Utils import GetIirKindOfNode +from pyGHDL.dom._Utils import GetIirKindOfNode, GetNameOfNode from pyGHDL.libghdl import name_table from pyGHDL.libghdl.vhdl import nodes @@ -70,7 +70,7 @@ class PhysicalIntegerLiteral(VHDLModel_PhysicalIntegerLiteral): def parse(cls, node): value = nodes.Get_Value(node) unit = nodes.Get_Unit_Name(node) - unitName = name_table.Get_Name_Ptr(unit) + unitName = GetNameOfNode(unit) return cls(value, unitName) @@ -81,7 +81,7 @@ class PhysicalFloatingLiteral(VHDLModel_PhysicalFloatingLiteral): def parse(cls, node): value = nodes.Get_Fp_Value(node) unit = nodes.Get_Unit_Name(node) - unitName = name_table.Get_Name_Ptr(unit) + unitName = GetNameOfNode(unit) return cls(value, unitName) -- cgit v1.2.3 From 0a69901be945dfb6c5372e657332d5e5ddfa10c7 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 22 Jun 2021 11:59:09 +0200 Subject: Fixed issues reported by Codacy. --- pyGHDL/dom/Literal.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'pyGHDL/dom/Literal.py') diff --git a/pyGHDL/dom/Literal.py b/pyGHDL/dom/Literal.py index 44c002955..209712ba3 100644 --- a/pyGHDL/dom/Literal.py +++ b/pyGHDL/dom/Literal.py @@ -30,10 +30,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ -from pyGHDL.dom._Utils import GetIirKindOfNode, GetNameOfNode -from pyGHDL.libghdl import name_table - -from pyGHDL.libghdl.vhdl import nodes from pydecor import export from pyVHDLModel.VHDLModel import ( @@ -44,6 +40,9 @@ from pyVHDLModel.VHDLModel import ( CharacterLiteral as VHDLModel_CharacterLiteral, StringLiteral as VHDLModel_StringLiteral, ) +from pyGHDL.libghdl import name_table +from pyGHDL.libghdl.vhdl import nodes +from pyGHDL.dom._Utils import GetNameOfNode __all__ = [] -- cgit v1.2.3