diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-09-25 06:59:14 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-09-25 06:59:31 +0200 |
commit | f062a7a4107c9f11267c86c988b7182489ed1346 (patch) | |
tree | 299a6d6b98f61755c99fd9306219c3f61c8feb63 /src | |
parent | 010aca1966eeb260529041d209d69a92654465f8 (diff) | |
download | ghdl-f062a7a4107c9f11267c86c988b7182489ed1346.tar.gz ghdl-f062a7a4107c9f11267c86c988b7182489ed1346.tar.bz2 ghdl-f062a7a4107c9f11267c86c988b7182489ed1346.zip |
synth: fixes after previous patch.
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/synth-decls.adb | 10 | ||||
-rw-r--r-- | src/synth/synth-expr.adb | 5 | ||||
-rw-r--r-- | src/synth/synth-insts.adb | 7 | ||||
-rw-r--r-- | src/synth/synth-stmts.adb | 2 |
4 files changed, 16 insertions, 8 deletions
diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb index ecc5d8572..874b9d303 100644 --- a/src/synth/synth-decls.adb +++ b/src/synth/synth-decls.adb @@ -418,13 +418,16 @@ package body Synth.Decls is end Synth_Constant_Declaration; procedure Synth_Attribute_Specification - (Syn_Inst : Synth_Instance_Acc; Decl : Node) + (Syn_Inst : Synth_Instance_Acc; Spec : Node) is + Decl : constant Node := Get_Attribute_Designator (Spec); Value : Iir_Attribute_Value; Val : Value_Acc; Val_Type : Type_Acc; begin - Value := Get_Attribute_Value_Spec_Chain (Decl); + Val_Type := Get_Value_Type + (Syn_Inst, Get_Type (Get_Named_Entity (Decl))); + Value := Get_Attribute_Value_Spec_Chain (Spec); while Value /= Null_Iir loop -- 2. The expression is evaluated to determine the value -- of the attribute. @@ -434,9 +437,8 @@ package body Synth.Decls is -- subtype conversion is first performed on the value, -- unless the attribute's subtype indication denotes an -- unconstrained array type. - Val_Type := Get_Value_Type (Syn_Inst, Get_Type (Value)); Val := Synth_Expression_With_Type - (Syn_Inst, Get_Expression (Decl), Val_Type); + (Syn_Inst, Get_Expression (Spec), Val_Type); -- Check_Constraints (Instance, Val, Attr_Type, Decl); -- 3. A new instance of the designated attribute is created diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index 5e76d3eb4..451a04951 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -1351,7 +1351,7 @@ package body Synth.Expr is Conv_Type : constant Node := Get_Type (Conv); Val : Value_Acc; begin - Val := Synth_Expression (Syn_Inst, Expr); + Val := Synth_Expression_With_Basetype (Syn_Inst, Expr); case Get_Kind (Conv_Type) is when Iir_Kind_Integer_Subtype_Definition => if Val.Typ.Kind = Type_Float then @@ -1534,8 +1534,7 @@ package body Synth.Expr is when Iir_Kind_Qualified_Expression => return Synth_Expression_With_Type (Syn_Inst, Get_Expression (Expr), - Get_Value_Type (Syn_Inst, Get_Type (Get_Named_Entity - (Get_Type_Mark (Expr))))); + Get_Value_Type (Syn_Inst, Get_Type (Get_Type_Mark (Expr)))); when Iir_Kind_Function_Call => declare Imp : constant Node := Get_Implementation (Expr); diff --git a/src/synth/synth-insts.adb b/src/synth/synth-insts.adb index 11d890c42..d92766ba6 100644 --- a/src/synth/synth-insts.adb +++ b/src/synth/synth-insts.adb @@ -309,6 +309,13 @@ package body Synth.Insts is -- Elaborate generic + map aspect Sub_Inst := Make_Instance (Syn_Inst, Ent, New_Sname_User (Get_Identifier (Ent))); + + Inter := Get_Generic_Chain (Ent); + while Is_Valid (Inter) loop + Synth_Declaration_Type (Sub_Inst, Inter); + Inter := Get_Chain (Inter); + end loop; + Synth_Subprogram_Association (Sub_Inst, Syn_Inst, Get_Generic_Chain (Ent), Get_Generic_Map_Aspect_Chain (Stmt)); diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb index e6a65d465..bc9884af1 100644 --- a/src/synth/synth-stmts.adb +++ b/src/synth/synth-stmts.adb @@ -1531,7 +1531,7 @@ package body Synth.Stmts is begin if Expr /= Null_Node then -- Return in function. - Val := Synth_Expression (C.Inst, Expr); + Val := Synth_Expression_With_Type (C.Inst, Expr, C.Ret_Typ); Val := Synth_Subtype_Conversion (Val, C.Ret_Typ, False, Stmt); if C.Nbr_Ret = 0 then |