diff options
Diffstat (limited to 'src/synth/synth-vhdl_decls.adb')
-rw-r--r-- | src/synth/synth-vhdl_decls.adb | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/synth/synth-vhdl_decls.adb b/src/synth/synth-vhdl_decls.adb index 840663054..56d7ab9e0 100644 --- a/src/synth/synth-vhdl_decls.adb +++ b/src/synth/synth-vhdl_decls.adb @@ -18,6 +18,7 @@ with Types; use Types; with Std_Names; +with Errorout; use Errorout; with Netlists.Builders; use Netlists.Builders; with Netlists.Folds; use Netlists.Folds; @@ -135,7 +136,7 @@ package body Synth.Vhdl_Decls is Cst : Valtyp; Obj_Type : Type_Acc; begin - Elab_Declaration_Type (Syn_Inst, Decl); + Obj_Type := Elab_Declaration_Type (Syn_Inst, Decl); if Deferred_Decl = Null_Node or else Get_Deferred_Declaration_Flag (Decl) then @@ -169,7 +170,6 @@ package body Synth.Vhdl_Decls is end if; Last_Type := Decl_Type; end if; - Obj_Type := Get_Subtype_Object (Syn_Inst, Decl_Type); Val := Synth_Expression_With_Type (Syn_Inst, Get_Default_Value (Decl), Obj_Type); if Val = No_Valtyp then @@ -379,7 +379,7 @@ package body Synth.Vhdl_Decls is Obj_Typ : Type_Acc; Wid : Wire_Id; begin - Elab_Declaration_Type (Syn_Inst, Decl); + Obj_Typ := Elab_Declaration_Type (Syn_Inst, Decl); if Get_Kind (Decl_Type) = Iir_Kind_Protected_Type_Declaration then Error_Msg_Synth (+Decl, "protected type variable is not synthesizable"); @@ -388,8 +388,7 @@ package body Synth.Vhdl_Decls is return; end if; - Obj_Typ := Get_Subtype_Object (Syn_Inst, Decl_Type); - if not Obj_Typ.Is_Synth + if Obj_Typ.Wkind /= Wkind_Net and then not Get_Instance_Const (Syn_Inst) then Error_Msg_Synth @@ -400,7 +399,7 @@ package body Synth.Vhdl_Decls is if Is_Valid (Def) then Init := Synth_Expression_With_Type (Syn_Inst, Def, Obj_Typ); Init := Synth_Subtype_Conversion - (Ctxt, Init, Obj_Typ, False, Decl); + (Ctxt, Init, Obj_Typ, True, Decl); if not Is_Subprg and then not Is_Static (Init.Val) then @@ -597,7 +596,12 @@ package body Synth.Vhdl_Decls is (Syn_Inst, Get_Type_Definition (Decl), Get_Subtype_Definition (Decl)); when Iir_Kind_Subtype_Declaration => - Elab_Declaration_Type (Syn_Inst, Decl); + declare + T : Type_Acc; + begin + T := Elab_Declaration_Type (Syn_Inst, Decl); + pragma Unreferenced (T); + end; when Iir_Kind_Component_Declaration => null; when Iir_Kind_File_Declaration => @@ -697,10 +701,11 @@ package body Synth.Vhdl_Decls is -- TODO: maybe simply remove it. if Def_Val = No_Net then Warning_Msg_Synth - (+Decl, "%n is never assigned and has no default value", - (1 => +Decl)); + (Warnid_Nowrite, +Decl, + "%n is never assigned and has no default value", +Decl); else - Warning_Msg_Synth (+Decl, "%n is never assigned", (1 => +Decl)); + Warning_Msg_Synth + (Warnid_Nowrite, +Decl, "%n is never assigned", +Decl); end if; end if; if Def_Val = No_Net then |