aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-12-23 05:49:20 +0100
committerTristan Gingold <tgingold@free.fr>2016-12-23 18:22:47 +0100
commit99e2be751d6e36d4fd8af415c4e417a8b35cd97b (patch)
tree6e18b6e63581b52864e5993a98aaa8b8979c344f /src/vhdl
parente11660d9afe9e19701a963f9c382b17d89e59d4c (diff)
downloadghdl-99e2be751d6e36d4fd8af415c4e417a8b35cd97b.tar.gz
ghdl-99e2be751d6e36d4fd8af415c4e417a8b35cd97b.tar.bz2
ghdl-99e2be751d6e36d4fd8af415c4e417a8b35cd97b.zip
vhdl08: add port association rules.
Fix #233
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/sem_assocs.adb88
1 files changed, 60 insertions, 28 deletions
diff --git a/src/vhdl/sem_assocs.adb b/src/vhdl/sem_assocs.adb
index f113db244..2d050e9e2 100644
--- a/src/vhdl/sem_assocs.adb
+++ b/src/vhdl/sem_assocs.adb
@@ -411,27 +411,54 @@ package body Sem_Assocs is
subtype Iir_Known_Mode is Iir_Mode range Iir_Linkage_Mode .. Iir_In_Mode;
type Assocs_Right_Map is array (Iir_Known_Mode, Iir_Known_Mode) of Boolean;
+ -- LRM93 1.1.1.2 Ports
Vhdl93_Assocs_Map : constant Assocs_Right_Map :=
- (Iir_Linkage_Mode => (others => True),
- Iir_Buffer_Mode => (Iir_Buffer_Mode => True, others => False),
- Iir_Out_Mode => (Iir_Out_Mode | Iir_Inout_Mode => True,
- others => False),
- Iir_Inout_Mode => (Iir_Inout_Mode => True,
- others => False),
- Iir_In_Mode => (Iir_In_Mode | Iir_Inout_Mode | Iir_Buffer_Mode => True,
- others => False));
-
+ (Iir_In_Mode =>
+ (Iir_In_Mode | Iir_Inout_Mode | Iir_Buffer_Mode => True,
+ others => False),
+ Iir_Out_Mode =>
+ (Iir_Out_Mode | Iir_Inout_Mode => True,
+ others => False),
+ Iir_Inout_Mode =>
+ (Iir_Inout_Mode => True,
+ others => False),
+ Iir_Buffer_Mode =>
+ (Iir_Buffer_Mode => True, others => False),
+ Iir_Linkage_Mode =>
+ (others => True));
+
+ -- LRM02 1.1.1.2 Ports
Vhdl02_Assocs_Map : constant Assocs_Right_Map :=
- (Iir_Linkage_Mode => (others => True),
- Iir_Buffer_Mode => (Iir_Out_Mode | Iir_Inout_Mode
- | Iir_Buffer_Mode => True,
- others => False),
- Iir_Out_Mode => (Iir_Out_Mode | Iir_Inout_Mode | Iir_Buffer_Mode => True,
- others => False),
- Iir_Inout_Mode => (Iir_Inout_Mode | Iir_Buffer_Mode => True,
- others => False),
- Iir_In_Mode => (Iir_In_Mode | Iir_Inout_Mode | Iir_Buffer_Mode => True,
- others => False));
+ (Iir_In_Mode =>
+ (Iir_In_Mode | Iir_Inout_Mode | Iir_Buffer_Mode => True,
+ others => False),
+ Iir_Out_Mode =>
+ (Iir_Out_Mode | Iir_Inout_Mode | Iir_Buffer_Mode => True,
+ others => False),
+ Iir_Inout_Mode =>
+ (Iir_Inout_Mode | Iir_Buffer_Mode => True,
+ others => False),
+ Iir_Buffer_Mode =>
+ (Iir_Out_Mode | Iir_Inout_Mode | Iir_Buffer_Mode => True,
+ others => False),
+ Iir_Linkage_Mode =>
+ (others => True));
+
+ -- LRM08 6.5.6.3 Port clauses
+ Vhdl08_Assocs_Map : constant Assocs_Right_Map :=
+ (Iir_In_Mode =>
+ (Iir_In_Mode | Iir_Out_Mode | Iir_Inout_Mode | Iir_Buffer_Mode => True,
+ others => False),
+ Iir_Out_Mode =>
+ (Iir_Out_Mode | Iir_Inout_Mode | Iir_Buffer_Mode => True,
+ others => False),
+ Iir_Inout_Mode =>
+ (Iir_Out_Mode | Iir_Inout_Mode | Iir_Buffer_Mode => True,
+ others => False),
+ Iir_Buffer_Mode =>
+ (Iir_Out_Mode | Iir_Inout_Mode | Iir_Buffer_Mode => True,
+ others => False),
+ Iir_Linkage_Mode => (others => True));
-- Check for restrictions in LRM 1.1.1.2
-- Return FALSE in case of error.
@@ -447,15 +474,20 @@ package body Sem_Assocs is
pragma Assert (Fmode /= Iir_Unknown_Mode);
pragma Assert (Amode /= Iir_Unknown_Mode);
- if Flags.Vhdl_Std < Vhdl_02 then
- if Vhdl93_Assocs_Map (Fmode, Amode) then
- return True;
- end if;
- else
- if Vhdl02_Assocs_Map (Fmode, Amode) then
- return True;
- end if;
- end if;
+ case Flags.Vhdl_Std is
+ when Vhdl_87 | Vhdl_93c | Vhdl_93 | Vhdl_00 =>
+ if Vhdl93_Assocs_Map (Fmode, Amode) then
+ return True;
+ end if;
+ when Vhdl_02 =>
+ if Vhdl02_Assocs_Map (Fmode, Amode) then
+ return True;
+ end if;
+ when Vhdl_08 =>
+ if Vhdl08_Assocs_Map (Fmode, Amode) then
+ return True;
+ end if;
+ end case;
if Assoc /= Null_Iir then
Error_Msg_Sem