From 4be73be561379cff6b0e5966e020d90387085034 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 10 May 2019 07:48:39 +0200 Subject: psl: add psl-types, psl-nodes_priv. --- src/errorout.adb | 3 ++- src/errorout.ads | 3 ++- src/psl/psl-build.adb | 1 + src/psl/psl-cse.adb | 1 + src/psl/psl-dump_tree.adb | 1 + src/psl/psl-errors.ads | 1 + src/psl/psl-hash.adb | 1 + src/psl/psl-nfas-utils.adb | 4 +++- src/psl/psl-nfas.adb | 1 + src/psl/psl-nodes.ads | 3 ++- src/psl/psl-nodes_priv.ads | 26 +++++++++++++++++++++++++ src/psl/psl-optimize.adb | 1 + src/psl/psl-prints.adb | 1 + src/psl/psl-qm.adb | 1 + src/psl/psl-rewrites.adb | 1 + src/psl/psl-subsets.adb | 2 +- src/psl/psl-types.ads | 30 +++++++++++++++++++++++++++++ src/types.ads | 6 ------ src/vhdl/simulate/simul-simulation-main.adb | 1 + src/vhdl/translate/trans-chap9.adb | 1 + src/vhdl/vhdl-canon.adb | 1 + src/vhdl/vhdl-canon_psl.ads | 2 +- src/vhdl/vhdl-disp_tree.adb | 1 + src/vhdl/vhdl-disp_vhdl.ads | 1 + src/vhdl/vhdl-nodes.ads | 1 + src/vhdl/vhdl-nodes_gc.adb | 1 + src/vhdl/vhdl-nodes_meta.ads | 1 + src/vhdl/vhdl-nodes_meta.ads.in | 1 + src/vhdl/vhdl-parse.adb | 1 + src/vhdl/vhdl-parse_psl.adb | 1 + src/vhdl/vhdl-parse_psl.ads | 2 +- src/vhdl/vhdl-sem_psl.adb | 1 + src/vhdl/vhdl-utils.ads | 1 + 33 files changed, 91 insertions(+), 13 deletions(-) create mode 100644 src/psl/psl-nodes_priv.ads create mode 100644 src/psl/psl-types.ads (limited to 'src') diff --git a/src/errorout.adb b/src/errorout.adb index d921a9040..ac42a3d51 100644 --- a/src/errorout.adb +++ b/src/errorout.adb @@ -127,8 +127,9 @@ package body Errorout is return (Kind => Earg_String8, Val_Str8 => V); end "+"; - function "+" (L : PSL_Node) return Location_Type + function "+" (L : PSL.Types.PSL_Node) return Location_Type is + use PSL.Types; use PSL.Nodes; begin if L = Null_Node then diff --git a/src/errorout.ads b/src/errorout.ads index 66c2469ca..5c32c315a 100644 --- a/src/errorout.ads +++ b/src/errorout.ads @@ -18,6 +18,7 @@ with Types; use Types; with Vhdl.Nodes; use Vhdl.Nodes; with Vhdl.Tokens; +with PSL.Types; package Errorout is Option_Error: exception; @@ -163,7 +164,7 @@ package Errorout is function "+" (V : String8_Len_Type) return Earg_Type; -- Convert location. - function "+" (L : PSL_Node) return Location_Type; + function "+" (L : PSL.Types.PSL_Node) return Location_Type; -- Pass that detected the error. type Report_Origin is diff --git a/src/psl/psl-build.adb b/src/psl/psl-build.adb index 7a047b6de..5c317d711 100644 --- a/src/psl/psl-build.adb +++ b/src/psl/psl-build.adb @@ -19,6 +19,7 @@ with Tables; with Ada.Text_IO; use Ada.Text_IO; with Types; use Types; +with PSL.Types; use PSL.Types; with PSL.Errors; use PSL.Errors; with PSL.CSE; use PSL.CSE; with PSL.QM; diff --git a/src/psl/psl-cse.adb b/src/psl/psl-cse.adb index ed4fc7282..93cd85452 100644 --- a/src/psl/psl-cse.adb +++ b/src/psl/psl-cse.adb @@ -17,6 +17,7 @@ -- 02111-1307, USA. with Ada.Text_IO; +with PSL.Types; use PSL.Types; with PSL.Prints; with Types; use Types; diff --git a/src/psl/psl-dump_tree.adb b/src/psl/psl-dump_tree.adb index 700c120d3..f04333b51 100644 --- a/src/psl/psl-dump_tree.adb +++ b/src/psl/psl-dump_tree.adb @@ -19,6 +19,7 @@ with Ada.Text_IO; use Ada.Text_IO; with Types; use Types; with Name_Table; +with PSL.Types; use PSL.Types; with PSL.Errors; with PSL.Nodes_Meta; diff --git a/src/psl/psl-errors.ads b/src/psl/psl-errors.ads index b4b88d1da..bbc571624 100644 --- a/src/psl/psl-errors.ads +++ b/src/psl/psl-errors.ads @@ -17,6 +17,7 @@ -- 02111-1307, USA. with Types; use Types; with Files_Map; +with PSL.Types; use PSL.Types; package PSL.Errors is function Image (Loc : Location_Type; Filename : Boolean := True) diff --git a/src/psl/psl-hash.adb b/src/psl/psl-hash.adb index 3333066bb..b2bdccc79 100644 --- a/src/psl/psl-hash.adb +++ b/src/psl/psl-hash.adb @@ -17,6 +17,7 @@ -- 02111-1307, USA. with Tables; +with PSL.Types; use PSL.Types; package body PSL.Hash is diff --git a/src/psl/psl-nfas-utils.adb b/src/psl/psl-nfas-utils.adb index 152cd752e..16c0ac6d5 100644 --- a/src/psl/psl-nfas-utils.adb +++ b/src/psl/psl-nfas-utils.adb @@ -16,6 +16,8 @@ -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. +with PSL.Types; use PSL.Types; +with PSL.Nodes_Priv; with PSL.Errors; use PSL.Errors; package body PSL.NFAs.Utils is @@ -45,7 +47,7 @@ package body PSL.NFAs.Utils is L_Expr : constant Node := Get_Edge_Expr (L); R_Expr : constant Node := Get_Edge_Expr (R); begin - return L_Expr < R_Expr + return PSL.Nodes_Priv."<" (L_Expr, R_Expr) or else (L_Expr = R_Expr and then Get_Edge_State (L) < Get_Edge_State (R)); end Lt; diff --git a/src/psl/psl-nfas.adb b/src/psl/psl-nfas.adb index 0a4348901..1e3f55ba7 100644 --- a/src/psl/psl-nfas.adb +++ b/src/psl/psl-nfas.adb @@ -17,6 +17,7 @@ -- 02111-1307, USA. with Tables; +with PSL.Types; use PSL.Types; package body PSL.NFAs is -- Record that describes an NFA. diff --git a/src/psl/psl-nodes.ads b/src/psl/psl-nodes.ads index b3887a075..ec3022c35 100644 --- a/src/psl/psl-nodes.ads +++ b/src/psl/psl-nodes.ads @@ -17,6 +17,7 @@ -- 02111-1307, USA. with Types; use Types; +with PSL.Types; use PSL.Types; package PSL.Nodes is type Nkind is @@ -425,7 +426,7 @@ package PSL.Nodes is subtype NFA is Types.PSL_NFA; - subtype HDL_Node is Types.Int32; + subtype HDL_Node is Int32; HDL_Null : constant HDL_Node := 0; -- General methods. diff --git a/src/psl/psl-nodes_priv.ads b/src/psl/psl-nodes_priv.ads new file mode 100644 index 000000000..5c0bf51d0 --- /dev/null +++ b/src/psl/psl-nodes_priv.ads @@ -0,0 +1,26 @@ +-- Base types for PSL. +-- Copyright (C) 2019 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; + +package PSL.Nodes_Priv is + -- PSL Node. + type PSL_Node is new Int32; + + -- PSL NFA + type PSL_NFA is new Int32; +end PSL.Nodes_Priv; diff --git a/src/psl/psl-optimize.adb b/src/psl/psl-optimize.adb index 9ff9b1af7..a9391d5ae 100644 --- a/src/psl/psl-optimize.adb +++ b/src/psl/psl-optimize.adb @@ -17,6 +17,7 @@ -- 02111-1307, USA. with Types; use Types; +with PSL.Types; use PSL.Types; with PSL.NFAs.Utils; use PSL.NFAs.Utils; with PSL.CSE; diff --git a/src/psl/psl-prints.adb b/src/psl/psl-prints.adb index dd0755570..9bc05d940 100644 --- a/src/psl/psl-prints.adb +++ b/src/psl/psl-prints.adb @@ -17,6 +17,7 @@ -- 02111-1307, USA. with Types; use Types; +with PSL.Types; use PSL.Types; with PSL.Errors; use PSL.Errors; with Name_Table; use Name_Table; with Ada.Text_IO; use Ada.Text_IO; diff --git a/src/psl/psl-qm.adb b/src/psl/psl-qm.adb index 719329b8f..41f8e1001 100644 --- a/src/psl/psl-qm.adb +++ b/src/psl/psl-qm.adb @@ -18,6 +18,7 @@ with Ada.Text_IO; with Types; use Types; +with PSL.Types; use PSL.Types; with PSL.Errors; use PSL.Errors; with PSL.Prints; with PSL.CSE; diff --git a/src/psl/psl-rewrites.adb b/src/psl/psl-rewrites.adb index b575b3015..e06ddd323 100644 --- a/src/psl/psl-rewrites.adb +++ b/src/psl/psl-rewrites.adb @@ -1,4 +1,5 @@ with Types; use Types; +with PSL.Types; use PSL.Types; with PSL.Errors; use PSL.Errors; with PSL.CSE; use PSL.CSE; diff --git a/src/psl/psl-subsets.adb b/src/psl/psl-subsets.adb index 520cc32ff..8aaf2b063 100644 --- a/src/psl/psl-subsets.adb +++ b/src/psl/psl-subsets.adb @@ -16,8 +16,8 @@ -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. +with PSL.Types; use PSL.Types; with PSL.Errors; use PSL.Errors; -with Types; use Types; package body PSL.Subsets is procedure Check_Simple (N : Node) diff --git a/src/psl/psl-types.ads b/src/psl/psl-types.ads new file mode 100644 index 000000000..e6e3c700a --- /dev/null +++ b/src/psl/psl-types.ads @@ -0,0 +1,30 @@ +-- Base types for PSL. +-- Copyright (C) 2019 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 PSL.Nodes_Priv; + +package PSL.Types is + -- PSL Node. + subtype PSL_Node is PSL.Nodes_Priv.PSL_Node; + function "=" (L, R : PSL_Node) return Boolean + renames PSL.Nodes_Priv."="; + + -- PSL NFA + subtype PSL_NFA is PSL.Nodes_Priv.PSL_NFA; + function "=" (L, R : PSL_NFA) return Boolean + renames PSL.Nodes_Priv."="; +end PSL.Types; diff --git a/src/types.ads b/src/types.ads index 49eafa9a0..1f650ce81 100644 --- a/src/types.ads +++ b/src/types.ads @@ -130,12 +130,6 @@ package Types is Offset : Natural; end record; - -- PSL Node. - type PSL_Node is new Int32; - - -- PSL NFA - type PSL_NFA is new Int32; - -- Indentation. -- This is used by all packages that display vhdl code or informations. Indentation : constant := 2; diff --git a/src/vhdl/simulate/simul-simulation-main.adb b/src/vhdl/simulate/simul-simulation-main.adb index 3a9f5d5ce..41441ba06 100644 --- a/src/vhdl/simulate/simul-simulation-main.adb +++ b/src/vhdl/simulate/simul-simulation-main.adb @@ -21,6 +21,7 @@ with Ada.Text_IO; use Ada.Text_IO; with Types; use Types; with Vhdl.Utils; use Vhdl.Utils; with Vhdl.Errors; use Vhdl.Errors; +with PSL.Types; use PSL.Types; with PSL.Nodes; with PSL.NFAs; with PSL.NFAs.Utils; diff --git a/src/vhdl/translate/trans-chap9.adb b/src/vhdl/translate/trans-chap9.adb index 92ed100d5..1e179c122 100644 --- a/src/vhdl/translate/trans-chap9.adb +++ b/src/vhdl/translate/trans-chap9.adb @@ -24,6 +24,7 @@ with Libraries; with Vhdl.Canon; with Trans_Analyzes; with Vhdl.Nodes_Meta; +with PSL.Types; use PSL.Types; with PSL.Nodes; with PSL.NFAs; with PSL.NFAs.Utils; diff --git a/src/vhdl/vhdl-canon.adb b/src/vhdl/vhdl-canon.adb index b4f46769b..f0037d298 100644 --- a/src/vhdl/vhdl-canon.adb +++ b/src/vhdl/vhdl-canon.adb @@ -25,6 +25,7 @@ with Vhdl.Sem; with Vhdl.Sem_Inst; with Vhdl.Sem_Specs; with Vhdl.Nodes_Utils; use Vhdl.Nodes_Utils; +with PSL.Types; use PSL.Types; with PSL.Nodes; with PSL.Rewrites; with PSL.Build; diff --git a/src/vhdl/vhdl-canon_psl.ads b/src/vhdl/vhdl-canon_psl.ads index d5805d480..7fe9820c9 100644 --- a/src/vhdl/vhdl-canon_psl.ads +++ b/src/vhdl/vhdl-canon_psl.ads @@ -16,8 +16,8 @@ -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. -with Types; use Types; with Vhdl.Nodes; use Vhdl.Nodes; +with PSL.Types; use PSL.Types; package Vhdl.Canon_PSL is -- Version of Canon.Canon_Extract_Sensitivity for PSL nodes. diff --git a/src/vhdl/vhdl-disp_tree.adb b/src/vhdl/vhdl-disp_tree.adb index c4953035d..cbf9c324a 100644 --- a/src/vhdl/vhdl-disp_tree.adb +++ b/src/vhdl/vhdl-disp_tree.adb @@ -22,6 +22,7 @@ with Logging; use Logging; with Name_Table; with Str_Table; with Files_Map; +with PSL.Types; use PSL.Types; with PSL.Dump_Tree; with Vhdl.Nodes_Meta; diff --git a/src/vhdl/vhdl-disp_vhdl.ads b/src/vhdl/vhdl-disp_vhdl.ads index e69ab29f2..2a8531848 100644 --- a/src/vhdl/vhdl-disp_vhdl.ads +++ b/src/vhdl/vhdl-disp_vhdl.ads @@ -17,6 +17,7 @@ -- 02111-1307, USA. with Types; use Types; with Vhdl.Nodes; use Vhdl.Nodes; +with PSL.Types; use PSL.Types; package Vhdl.Disp_Vhdl is -- General procedure to display a node. diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads index 4fc779c6b..11917f8e8 100644 --- a/src/vhdl/vhdl-nodes.ads +++ b/src/vhdl/vhdl-nodes.ads @@ -21,6 +21,7 @@ with Vhdl.Tokens; use Vhdl.Tokens; with Vhdl.Nodes_Priv; with Vhdl.Lists; with Vhdl.Flists; +with PSL.Types; use PSL.Types; package Vhdl.Nodes is -- This package defines the semantic tree and functions to handle it. diff --git a/src/vhdl/vhdl-nodes_gc.adb b/src/vhdl/vhdl-nodes_gc.adb index 7900355ec..250621cd9 100644 --- a/src/vhdl/vhdl-nodes_gc.adb +++ b/src/vhdl/vhdl-nodes_gc.adb @@ -24,6 +24,7 @@ with Vhdl.Errors; use Vhdl.Errors; with Libraries; with Vhdl.Disp_Tree; with Vhdl.Std_Package; +with PSL.Types; use PSL.Types; package body Vhdl.Nodes_GC is diff --git a/src/vhdl/vhdl-nodes_meta.ads b/src/vhdl/vhdl-nodes_meta.ads index 02f86439e..ee64fc92d 100644 --- a/src/vhdl/vhdl-nodes_meta.ads +++ b/src/vhdl/vhdl-nodes_meta.ads @@ -19,6 +19,7 @@ with Types; use Types; with Vhdl.Nodes; use Vhdl.Nodes; with Vhdl.Tokens; use Vhdl.Tokens; +with PSL.Types; use PSL.Types; package Vhdl.Nodes_Meta is -- The enumeration of all possible types in the nodes. diff --git a/src/vhdl/vhdl-nodes_meta.ads.in b/src/vhdl/vhdl-nodes_meta.ads.in index fe345df78..234b8631e 100644 --- a/src/vhdl/vhdl-nodes_meta.ads.in +++ b/src/vhdl/vhdl-nodes_meta.ads.in @@ -19,6 +19,7 @@ with Types; use Types; with Vhdl.Nodes; use Vhdl.Nodes; with Vhdl.Tokens; use Vhdl.Tokens; +with PSL.Types; use PSL.Types; package Vhdl.Nodes_Meta is -- The enumeration of all possible types in the nodes. diff --git a/src/vhdl/vhdl-parse.adb b/src/vhdl/vhdl-parse.adb index d21fd97ff..4050a4b25 100644 --- a/src/vhdl/vhdl-parse.adb +++ b/src/vhdl/vhdl-parse.adb @@ -27,6 +27,7 @@ with Vhdl.Parse_Psl; with Str_Table; with Vhdl.Xrefs; with Vhdl.Elocations; use Vhdl.Elocations; +with PSL.Types; use PSL.Types; -- Recursive descendant parser. -- Each subprogram (should) parse one production rules. diff --git a/src/vhdl/vhdl-parse_psl.adb b/src/vhdl/vhdl-parse_psl.adb index 3c44b7213..aff5967c2 100644 --- a/src/vhdl/vhdl-parse_psl.adb +++ b/src/vhdl/vhdl-parse_psl.adb @@ -16,6 +16,7 @@ -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. +with Types; use Types; with Errorout; use Errorout; with PSL.Nodes; use PSL.Nodes; with Vhdl.Nodes; diff --git a/src/vhdl/vhdl-parse_psl.ads b/src/vhdl/vhdl-parse_psl.ads index 717663ecc..f7128ac40 100644 --- a/src/vhdl/vhdl-parse_psl.ads +++ b/src/vhdl/vhdl-parse_psl.ads @@ -16,7 +16,7 @@ -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. -with Types; use Types; +with PSL.Types; use PSL.Types; with Vhdl.Tokens; use Vhdl.Tokens; package Vhdl.Parse_Psl is diff --git a/src/vhdl/vhdl-sem_psl.adb b/src/vhdl/vhdl-sem_psl.adb index 6bb25e347..d6ead5002 100644 --- a/src/vhdl/vhdl-sem_psl.adb +++ b/src/vhdl/vhdl-sem_psl.adb @@ -17,6 +17,7 @@ -- 02111-1307, USA. with Types; use Types; +with PSL.Types; use PSL.Types; with PSL.Nodes; use PSL.Nodes; with PSL.Subsets; with PSL.Hash; diff --git a/src/vhdl/vhdl-utils.ads b/src/vhdl/vhdl-utils.ads index 478b54c62..f94d5996e 100644 --- a/src/vhdl/vhdl-utils.ads +++ b/src/vhdl/vhdl-utils.ads @@ -17,6 +17,7 @@ -- 02111-1307, USA. with Types; use Types; with Vhdl.Nodes; use Vhdl.Nodes; +with PSL.Types; use PSL.Types; package Vhdl.Utils is -- Transform the current token into an iir literal. -- cgit v1.2.3