From b5884712a4ce8980831d4b231d123688063ccbf2 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 21 Jun 2022 23:10:26 +0200 Subject: Enable and disable AMS support based on VHDLVersion. (cherry picked from commit 04d141309147a5731ea3461d59cfc8e17ad57c82) --- pyGHDL/dom/NonStandard.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'pyGHDL/dom/NonStandard.py') diff --git a/pyGHDL/dom/NonStandard.py b/pyGHDL/dom/NonStandard.py index db160faaf..13ddec68f 100644 --- a/pyGHDL/dom/NonStandard.py +++ b/pyGHDL/dom/NonStandard.py @@ -42,6 +42,8 @@ from typing import Any from pyTooling.Decorators import export +from pyGHDL.dom.Names import SimpleName +from pyVHDLModel import VHDLVersion from pyVHDLModel.SyntaxModel import ( Design as VHDLModel_Design, Library as VHDLModel_Library, @@ -50,6 +52,7 @@ from pyVHDLModel.SyntaxModel import ( ) from pyGHDL.libghdl import ( + ENCODING, initialize as libghdl_initialize, finalize as libghdl_finalize, set_option as libghdl_set_option, @@ -58,6 +61,7 @@ from pyGHDL.libghdl import ( files_map, errorout_memory, LibGHDLException, + flags, utils, files_map_editor, ENCODING, @@ -102,7 +106,6 @@ class Design(VHDLModel_Design): errorout_memory.Install_Handler() libghdl_set_option("--std=08") - libghdl_set_option("--ams") Flag_Gather_Comments.value = True Flag_Parse_Parenthesis.value = True @@ -131,6 +134,7 @@ class Document(VHDLModel_Document): self, path: Path, sourceCode: str = None, + vhdlVersion: VHDLVersion = VHDLVersion.VHDL2008, dontParse: bool = False, dontTranslate: bool = False, ): @@ -146,8 +150,16 @@ class Document(VHDLModel_Document): if not dontParse: # Parse input file t1 = time.perf_counter() + + if vhdlVersion.IsAMS(): + flags.AMS_Vhdl.value = True + self.__ghdlFile = sem_lib.Load_File(self.__ghdlSourceFileEntry) CheckForErrors() + + if vhdlVersion.IsAMS(): + flags.AMS_Vhdl.value = False + self.__ghdlProcessingTime = time.perf_counter() - t1 if not dontTranslate: -- cgit v1.2.3