From 559c6166f3c639330502f714babddb0bd6d986b4 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 13 Nov 2019 20:03:24 +0100 Subject: synth: add some support for access types. --- src/synth/synth-expr.adb | 5 ++++- src/synth/synth-static_oper.adb | 7 +++++++ src/synth/synth-stmts.adb | 16 +++++++++++----- src/synth/synth-values.adb | 4 ++-- 4 files changed, 24 insertions(+), 8 deletions(-) (limited to 'src/synth') diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index e6a0566ac..54625936d 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -877,7 +877,8 @@ package body Synth.Expr is | Iir_Kind_Constant_Declaration | Iir_Kind_Iterator_Declaration | Iir_Kind_Object_Alias_Declaration - | Iir_Kind_File_Declaration => + | Iir_Kind_File_Declaration + | Iir_Kind_Interface_File_Declaration => return Get_Value (Syn_Inst, Name); when Iir_Kind_Enumeration_Literal => return Create_Value_Discrete @@ -1778,6 +1779,8 @@ package body Synth.Expr is B := Synth_Array_Attribute (Syn_Inst, Expr); return Create_Value_Discrete (Int64 (B.Len), Expr_Type); end; + when Iir_Kind_Null_Literal => + return Create_Value_Access (Expr_Type, Null_Heap_Index); when Iir_Kind_Overflow_Literal => declare N : Net; diff --git a/src/synth/synth-static_oper.adb b/src/synth/synth-static_oper.adb index 4b301b128..c25775bae 100644 --- a/src/synth/synth-static_oper.adb +++ b/src/synth/synth-static_oper.adb @@ -188,6 +188,13 @@ package body Synth.Static_Oper is return Create_Value_Discrete (Boolean'Pos (not Is_Equal (Left, Right)), Boolean_Type); + when Iir_Predefined_Access_Equality => + return Create_Value_Discrete + (Boolean'Pos (Left.Acc = Right.Acc), Boolean_Type); + when Iir_Predefined_Access_Inequality => + return Create_Value_Discrete + (Boolean'Pos (Left.Acc /= Right.Acc), Boolean_Type); + when Iir_Predefined_Ieee_1164_Vector_And | Iir_Predefined_Ieee_Numeric_Std_And_Uns_Uns | Iir_Predefined_Ieee_Numeric_Std_And_Sgn_Sgn => diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb index a510d1765..e969cf11a 100644 --- a/src/synth/synth-stmts.adb +++ b/src/synth/synth-stmts.adb @@ -1339,16 +1339,22 @@ package body Synth.Stmts is raise Internal_Error; when Iir_Kind_Interface_Variable_Declaration => -- Always pass by value. - Val := Synth_Read_Memory - (Caller_Inst, Info.Obj, Info.Off, No_Net, - Info.Targ_Type, Assoc); + if Is_Static (Info.Obj) then + if Info.Off /= 0 then + raise Internal_Error; + end if; + Val := Info.Obj; + else + Val := Synth_Read_Memory + (Caller_Inst, Info.Obj, Info.Off, No_Net, + Info.Targ_Type, Assoc); + end if; when Iir_Kind_Interface_Signal_Declaration => -- Always pass by reference (use an alias). Val := Create_Value_Alias (Info.Obj, Info.Off, Info.Targ_Type); when Iir_Kind_Interface_File_Declaration => - Val := Create_Value_File - (Info.Targ_Type, Info.Obj.File); + Val := Info.Obj; end case; end; end case; diff --git a/src/synth/synth-values.adb b/src/synth/synth-values.adb index 9e1aef9eb..21830955f 100644 --- a/src/synth/synth-values.adb +++ b/src/synth/synth-values.adb @@ -56,7 +56,7 @@ package body Synth.Values is return False; when Value_Access | Value_File => - return False; + return True; when Value_Alias => return Is_Static (Val.A_Obj); when Value_Const => @@ -86,7 +86,7 @@ package body Synth.Values is return False; when Value_Access | Value_File => - return False; + return True; when Value_Const => return True; when Value_Alias => -- cgit v1.2.3