From e3921be1157d819a8c74bf17692f02d8d12a325c Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 14 May 2015 06:53:26 +0200 Subject: vhdl 2008: allow to read out ports. --- src/grt/grt-signals.adb | 12 ++++++------ src/vhdl/sem_expr.adb | 26 ++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/grt/grt-signals.adb b/src/grt/grt-signals.adb index 7f8d3a0..38d33c8 100644 --- a/src/grt/grt-signals.adb +++ b/src/grt/grt-signals.adb @@ -1954,10 +1954,10 @@ package body Grt.Signals is begin case Sig.S.Mode_Sig is when Mode_Signal - | Mode_Buffer => - return True; - when Mode_Linkage + | Mode_Buffer | Mode_Out => + return True; + when Mode_Linkage => -- No effective value. return False; when Mode_Inout @@ -2150,11 +2150,11 @@ package body Grt.Signals is case Sig.S.Mode_Sig is when Mode_Signal - | Mode_Buffer => + | Mode_Buffer + | Mode_Out => -- Effective value is driving value. Sig.Flags.Propag := Propag_Done; - when Mode_Linkage - | Mode_Out => + when Mode_Linkage => -- No effective value. Sig.Flags.Propag := Propag_Done; when Mode_Inout diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb index 703c554..46e75f3 100644 --- a/src/vhdl/sem_expr.adb +++ b/src/vhdl/sem_expr.adb @@ -3697,9 +3697,31 @@ package body Sem_Expr is when Iir_In_Mode | Iir_Inout_Mode | Iir_Buffer_Mode => + -- LRM08 6.5.3 Interface object declarations + -- - in. The value of the interface object is allowed + -- to be read, [...] + -- - inout or buffer. Reading and updating the value of + -- the interface object is allowed. [...] null; - when Iir_Out_Mode - | Iir_Linkage_Mode => + when Iir_Out_Mode => + -- LRM08 6.5.3 Interface object declarations + -- - out. The value of the interface object is allowed + -- [to be updated and,] provided it is not a signal + -- parameter, read. + if Vhdl_Std < Vhdl_08 + or else (Get_Kind (Get_Parent (Obj)) in + Iir_Kinds_Subprogram_Declaration) + then + Error_Msg_Sem + (Disp_Node (Obj) & " cannot be read", Expr); + end if; + when Iir_Linkage_Mode => + -- LRM08 6.5.3 Interface object declarations + -- - linkage. Reading and updating the value of the + -- interface object is allowed, but only by appearing + -- as an actual corresponding to an interface object + -- of mode LINKAGE. No other reading or updating is + -- permitted. Error_Msg_Sem (Disp_Node (Obj) & " cannot be read", Expr); when Iir_Unknown_Mode => raise Internal_Error; -- cgit