From 3c48cc2a70085eef63718e622b3d1a7b75a2f36f Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 5 May 2019 07:33:59 +0200 Subject: vhdl: move post_sems package to a vhdl child. --- src/vhdl/post_sems.adb | 82 --------------------------------------------- src/vhdl/post_sems.ads | 25 -------------- src/vhdl/vhdl-post_sems.adb | 82 +++++++++++++++++++++++++++++++++++++++++++++ src/vhdl/vhdl-post_sems.ads | 25 ++++++++++++++ src/vhdl/vhdl-sem_lib.adb | 4 +-- 5 files changed, 109 insertions(+), 109 deletions(-) delete mode 100644 src/vhdl/post_sems.adb delete mode 100644 src/vhdl/post_sems.ads create mode 100644 src/vhdl/vhdl-post_sems.adb create mode 100644 src/vhdl/vhdl-post_sems.ads (limited to 'src') diff --git a/src/vhdl/post_sems.adb b/src/vhdl/post_sems.adb deleted file mode 100644 index d00a808c0..000000000 --- a/src/vhdl/post_sems.adb +++ /dev/null @@ -1,82 +0,0 @@ --- Global checks after analyze pass. --- Copyright (C) 2002 - 2016 Tristan Gingold --- --- GHDL is free software; you can redistribute it and/or modify it under --- the terms of the GNU General Public License as published by the Free --- Software Foundation; either version 2, or (at your option) any later --- version. --- --- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or --- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --- for more details. --- --- You should have received a copy of the GNU General Public License --- along with GHDL; see the file COPYING. If not, write to the Free --- Software Foundation, 59 Temple Place - Suite 330, Boston, MA --- 02111-1307, USA. -with Types; use Types; -with Std_Names; use Std_Names; -with Vhdl.Sem_Specs; -with Ieee.Std_Logic_1164; -with Ieee.Vital_Timing; -with Ieee.Numeric; -with Flags; use Flags; - -package body Post_Sems is - procedure Post_Sem_Checks (Unit : Iir_Design_Unit) - is - Lib_Unit : constant Iir := Get_Library_Unit (Unit); - Lib : Iir_Library_Declaration; - Id : Name_Id; - - Value : Iir_Attribute_Value; - Spec : Iir_Attribute_Specification; - Attr_Decl : Iir_Attribute_Declaration; - begin - -- No checks on package bodies or context declaration - case Get_Kind (Lib_Unit) is - when Iir_Kind_Package_Body - | Iir_Kind_Context_Declaration => - return; - when others => - null; - end case; - - Id := Get_Identifier (Lib_Unit); - Lib := Get_Library (Get_Design_File (Unit)); - - if Get_Identifier (Lib) = Name_Ieee then - -- This is a unit of IEEE. - if Get_Kind (Lib_Unit) = Iir_Kind_Package_Declaration then - case Id is - when Name_Std_Logic_1164 => - Ieee.Std_Logic_1164.Extract_Declarations (Lib_Unit); - when Name_VITAL_Timing => - Ieee.Vital_Timing.Extract_Declarations (Lib_Unit); - when Name_Numeric_Std => - Ieee.Numeric.Extract_Std_Declarations (Lib_Unit); - when others => - null; - end case; - end if; - end if; - - -- Look for VITAL attributes. - if Flag_Vital_Checks then - Value := Get_Attribute_Value_Chain - (Vhdl.Sem_Specs.Get_Attribute_Value_Chain_Parent (Lib_Unit)); - while Value /= Null_Iir loop - Spec := Get_Attribute_Specification (Value); - Attr_Decl := Get_Named_Entity (Get_Attribute_Designator (Spec)); - if Attr_Decl = Ieee.Vital_Timing.Vital_Level0_Attribute then - Ieee.Vital_Timing.Check_Vital_Level0 (Unit); - elsif Attr_Decl = Ieee.Vital_Timing.Vital_Level1_Attribute then - Ieee.Vital_Timing.Check_Vital_Level1 (Unit); - end if; - - Value := Get_Value_Chain (Value); - end loop; - end if; - end Post_Sem_Checks; -end Post_Sems; diff --git a/src/vhdl/post_sems.ads b/src/vhdl/post_sems.ads deleted file mode 100644 index f70bad85a..000000000 --- a/src/vhdl/post_sems.ads +++ /dev/null @@ -1,25 +0,0 @@ --- Global checks after analyze pass. --- Copyright (C) 2002 - 2016 Tristan Gingold --- --- GHDL is free software; you can redistribute it and/or modify it under --- the terms of the GNU General Public License as published by the Free --- Software Foundation; either version 2, or (at your option) any later --- version. --- --- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY --- WARRANTY; without even the implied warranty of MERCHANTABILITY or --- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --- for more details. --- --- You should have received a copy of the GNU General Public License --- along with GHDL; see the file COPYING. If not, write to the Free --- Software Foundation, 59 Temple Place - Suite 330, Boston, MA --- 02111-1307, USA. -with Iirs; use Iirs; - -package Post_Sems is - -- Do post analyze checks, such as VITAL checks. - -- This procedure is also used to extract declarations from ieee - -- packages. - procedure Post_Sem_Checks (Unit : Iir_Design_Unit); -end Post_Sems; diff --git a/src/vhdl/vhdl-post_sems.adb b/src/vhdl/vhdl-post_sems.adb new file mode 100644 index 000000000..6c653e4fc --- /dev/null +++ b/src/vhdl/vhdl-post_sems.adb @@ -0,0 +1,82 @@ +-- Global checks after analyze pass. +-- Copyright (C) 2002 - 2016 Tristan Gingold +-- +-- GHDL is free software; you can redistribute it and/or modify it under +-- the terms of the GNU General Public License as published by the Free +-- Software Foundation; either version 2, or (at your option) any later +-- version. +-- +-- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or +-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +-- for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with GHDL; see the file COPYING. If not, write to the Free +-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA +-- 02111-1307, USA. +with Types; use Types; +with Std_Names; use Std_Names; +with Vhdl.Sem_Specs; +with Ieee.Std_Logic_1164; +with Ieee.Vital_Timing; +with Ieee.Numeric; +with Flags; use Flags; + +package body Vhdl.Post_Sems is + procedure Post_Sem_Checks (Unit : Iir_Design_Unit) + is + Lib_Unit : constant Iir := Get_Library_Unit (Unit); + Lib : Iir_Library_Declaration; + Id : Name_Id; + + Value : Iir_Attribute_Value; + Spec : Iir_Attribute_Specification; + Attr_Decl : Iir_Attribute_Declaration; + begin + -- No checks on package bodies or context declaration + case Get_Kind (Lib_Unit) is + when Iir_Kind_Package_Body + | Iir_Kind_Context_Declaration => + return; + when others => + null; + end case; + + Id := Get_Identifier (Lib_Unit); + Lib := Get_Library (Get_Design_File (Unit)); + + if Get_Identifier (Lib) = Name_Ieee then + -- This is a unit of IEEE. + if Get_Kind (Lib_Unit) = Iir_Kind_Package_Declaration then + case Id is + when Name_Std_Logic_1164 => + Ieee.Std_Logic_1164.Extract_Declarations (Lib_Unit); + when Name_VITAL_Timing => + Ieee.Vital_Timing.Extract_Declarations (Lib_Unit); + when Name_Numeric_Std => + Ieee.Numeric.Extract_Std_Declarations (Lib_Unit); + when others => + null; + end case; + end if; + end if; + + -- Look for VITAL attributes. + if Flag_Vital_Checks then + Value := Get_Attribute_Value_Chain + (Vhdl.Sem_Specs.Get_Attribute_Value_Chain_Parent (Lib_Unit)); + while Value /= Null_Iir loop + Spec := Get_Attribute_Specification (Value); + Attr_Decl := Get_Named_Entity (Get_Attribute_Designator (Spec)); + if Attr_Decl = Ieee.Vital_Timing.Vital_Level0_Attribute then + Ieee.Vital_Timing.Check_Vital_Level0 (Unit); + elsif Attr_Decl = Ieee.Vital_Timing.Vital_Level1_Attribute then + Ieee.Vital_Timing.Check_Vital_Level1 (Unit); + end if; + + Value := Get_Value_Chain (Value); + end loop; + end if; + end Post_Sem_Checks; +end Vhdl.Post_Sems; diff --git a/src/vhdl/vhdl-post_sems.ads b/src/vhdl/vhdl-post_sems.ads new file mode 100644 index 000000000..09effa2c0 --- /dev/null +++ b/src/vhdl/vhdl-post_sems.ads @@ -0,0 +1,25 @@ +-- Global checks after analyze pass. +-- Copyright (C) 2002 - 2016 Tristan Gingold +-- +-- GHDL is free software; you can redistribute it and/or modify it under +-- the terms of the GNU General Public License as published by the Free +-- Software Foundation; either version 2, or (at your option) any later +-- version. +-- +-- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or +-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +-- for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with GHDL; see the file COPYING. If not, write to the Free +-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA +-- 02111-1307, USA. +with Iirs; use Iirs; + +package Vhdl.Post_Sems is + -- Do post analyze checks, such as VITAL checks. + -- This procedure is also used to extract declarations from ieee + -- packages. + procedure Post_Sem_Checks (Unit : Iir_Design_Unit); +end Vhdl.Post_Sems; diff --git a/src/vhdl/vhdl-sem_lib.adb b/src/vhdl/vhdl-sem_lib.adb index 4b2319c09..10f6a60cc 100644 --- a/src/vhdl/vhdl-sem_lib.adb +++ b/src/vhdl/vhdl-sem_lib.adb @@ -26,7 +26,7 @@ with Vhdl.Parse; with Vhdl.Disp_Tree; with Vhdl.Disp_Vhdl; with Vhdl.Sem; -with Post_Sems; +with Vhdl.Post_Sems; with Vhdl.Canon; with Nodes_GC; @@ -113,7 +113,7 @@ package body Vhdl.Sem_Lib is -- Post checks ---------------- - Post_Sems.Post_Sem_Checks (Unit); + Vhdl.Post_Sems.Post_Sem_Checks (Unit); if Errorout.Nbr_Errors > 0 then return; -- cgit v1.2.3