diff options
Diffstat (limited to 'src/synth/elab-vhdl_insts.adb')
-rw-r--r-- | src/synth/elab-vhdl_insts.adb | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/synth/elab-vhdl_insts.adb b/src/synth/elab-vhdl_insts.adb index 820e20ff1..a86c94eb1 100644 --- a/src/synth/elab-vhdl_insts.adb +++ b/src/synth/elab-vhdl_insts.adb @@ -71,8 +71,7 @@ package body Elab.Vhdl_Insts is Inter := Get_Association_Interface (Assoc, Assoc_Inter); case Iir_Kinds_Interface_Declaration (Get_Kind (Inter)) is when Iir_Kind_Interface_Constant_Declaration => - Elab_Declaration_Type (Sub_Inst, Inter); - Inter_Type := Get_Subtype_Object (Sub_Inst, Get_Type (Inter)); + Inter_Type := Elab_Declaration_Type (Sub_Inst, Inter); case Get_Kind (Assoc) is when Iir_Kind_Association_Element_Open => @@ -326,7 +325,10 @@ package body Elab.Vhdl_Insts is function Elab_Port_Association_Type (Sub_Inst : Synth_Instance_Acc; Syn_Inst : Synth_Instance_Acc; Inter : Node; - Assoc : Node) return Type_Acc is + Assoc : Node) return Type_Acc + is + Inter_Typ : Type_Acc; + Val : Valtyp; begin if not Is_Fully_Constrained_Type (Get_Type (Inter)) then -- TODO @@ -336,7 +338,18 @@ package body Elab.Vhdl_Insts is if Assoc = Null_Node then raise Internal_Error; end if; - case Get_Kind (Assoc) is + + if Get_Kind (Assoc) = Iir_Kind_Association_Element_By_Expression + and then not Get_Inertial_Flag (Assoc) + then + -- For expression: just compute the expression and associate. + Inter_Typ := Elab_Declaration_Type (Sub_Inst, Inter); + Val := Exec_Expression_With_Type + (Syn_Inst, Get_Actual (Assoc), Inter_Typ); + return Val.Typ; + end if; + + case Iir_Kinds_Association_Element_Parameters (Get_Kind (Assoc)) is when Iir_Kinds_Association_Element_By_Actual => return Exec_Type_Of_Object (Syn_Inst, Get_Actual (Assoc)); when Iir_Kind_Association_Element_By_Individual => @@ -345,12 +358,9 @@ package body Elab.Vhdl_Insts is when Iir_Kind_Association_Element_Open => return Exec_Type_Of_Object (Syn_Inst, Get_Default_Value (Inter)); - when others => - raise Internal_Error; end case; else - Elab_Declaration_Type (Sub_Inst, Inter); - return Get_Subtype_Object (Sub_Inst, Get_Type (Inter)); + return Elab_Declaration_Type (Sub_Inst, Inter); end if; end Elab_Port_Association_Type; @@ -659,8 +669,7 @@ package body Elab.Vhdl_Insts is Inter_Typ := Elab_Port_Association_Type (Comp_Inst, Syn_Inst, Inter, Assoc); - - Create_Signal (Comp_Inst, Assoc_Inter, Inter_Typ, null); + Create_Signal (Comp_Inst, Inter, Inter_Typ, null); end if; Next_Association_Interface (Assoc, Assoc_Inter); end loop; @@ -789,12 +798,11 @@ package body Elab.Vhdl_Insts is -- Compute generics. Inter := Get_Generic_Chain (Entity); while Is_Valid (Inter) loop - Elab_Declaration_Type (Top_Inst, Inter); declare Val : Valtyp; Inter_Typ : Type_Acc; begin - Inter_Typ := Get_Subtype_Object (Top_Inst, Get_Type (Inter)); + Inter_Typ := Elab_Declaration_Type (Top_Inst, Inter); Val := Exec_Expression_With_Type (Top_Inst, Get_Default_Value (Inter), Inter_Typ); pragma Assert (Is_Static (Val.Val)); @@ -815,8 +823,7 @@ package body Elab.Vhdl_Insts is declare Inter_Typ : Type_Acc; begin - Elab_Declaration_Type (Top_Inst, Inter); - Inter_Typ := Get_Subtype_Object (Top_Inst, Get_Type (Inter)); + Inter_Typ := Elab_Declaration_Type (Top_Inst, Inter); Create_Signal (Top_Inst, Inter, Inter_Typ, null); end; Inter := Get_Chain (Inter); |