From ba9341b82ec487d73c4f11ea92154bbabeb83707 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 4 Apr 2022 06:31:29 +0200 Subject: synth: handle shared variable without default value. For #2023 --- src/synth/elab-vhdl_decls.adb | 2 +- src/synth/synth-vhdl_decls.adb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/synth') diff --git a/src/synth/elab-vhdl_decls.adb b/src/synth/elab-vhdl_decls.adb index f8a82be14..897705e37 100644 --- a/src/synth/elab-vhdl_decls.adb +++ b/src/synth/elab-vhdl_decls.adb @@ -138,7 +138,7 @@ package body Elab.Vhdl_Decls is Init := Exec_Expression_With_Type (Syn_Inst, Def, Obj_Typ); Init := Exec_Subtype_Conversion (Init, Obj_Typ, False, Decl); else - Init := No_Valtyp; + Init := (Typ => Obj_Typ, Val => null); end if; Create_Object (Syn_Inst, Decl, Init); end Elab_Variable_Declaration; diff --git a/src/synth/synth-vhdl_decls.adb b/src/synth/synth-vhdl_decls.adb index c7ab62d8e..8d38eaaff 100644 --- a/src/synth/synth-vhdl_decls.adb +++ b/src/synth/synth-vhdl_decls.adb @@ -429,6 +429,9 @@ package body Synth.Vhdl_Decls is Val : Valtyp; begin Init := Get_Value (Syn_Inst, Decl); + if Init.Val = null then + Init := Create_Value_Default (Init.Typ); + end if; Val := Create_Var_Wire (Syn_Inst, Decl, Wire_Variable, Init); Mutate_Object (Syn_Inst, Decl, Val); -- cgit v1.2.3