aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-12-26 09:18:35 +0100
committerTristan Gingold <tgingold@free.fr>2022-12-26 10:25:21 +0100
commitec534f56b3dfe5b4dbfae63303bc0c23ce68d4eb (patch)
tree522d8954db2cc536a8109e2e058a22bcc8f088d8 /src
parent28dffd50f5e3f43c04a79f24f0b28e08e5f00e5c (diff)
downloadghdl-ec534f56b3dfe5b4dbfae63303bc0c23ce68d4eb.tar.gz
ghdl-ec534f56b3dfe5b4dbfae63303bc0c23ce68d4eb.tar.bz2
ghdl-ec534f56b3dfe5b4dbfae63303bc0c23ce68d4eb.zip
simul: allow unassigned top generics
Diffstat (limited to 'src')
-rw-r--r--src/ghdldrv/ghdlsimul.adb2
-rw-r--r--src/synth/elab-vhdl_insts.adb10
2 files changed, 9 insertions, 3 deletions
diff --git a/src/ghdldrv/ghdlsimul.adb b/src/ghdldrv/ghdlsimul.adb
index 08377c1e1..1e5c0f557 100644
--- a/src/ghdldrv/ghdlsimul.adb
+++ b/src/ghdldrv/ghdlsimul.adb
@@ -79,7 +79,7 @@ package body Ghdlsimul is
Lib_Unit : Node;
Inst : Synth_Instance_Acc;
begin
- Common_Compile_Elab (Cmd_Name, Args, False, Opt_Arg, Config);
+ Common_Compile_Elab (Cmd_Name, Args, True, Opt_Arg, Config);
for I in Opt_Arg .. Args'Last loop
if Args (I).all = "--expect-failure" then
diff --git a/src/synth/elab-vhdl_insts.adb b/src/synth/elab-vhdl_insts.adb
index be7d5a7d5..389a816a4 100644
--- a/src/synth/elab-vhdl_insts.adb
+++ b/src/synth/elab-vhdl_insts.adb
@@ -910,11 +910,17 @@ package body Elab.Vhdl_Insts is
Em : Mark_Type;
Val : Valtyp;
Inter_Typ : Type_Acc;
+ Defval : Node;
begin
Mark_Expr_Pool (Em);
Inter_Typ := Elab_Declaration_Type (Top_Inst, Inter);
- Val := Synth_Expression_With_Type
- (Top_Inst, Get_Default_Value (Inter), Inter_Typ);
+ Defval := Get_Default_Value (Inter);
+ if Defval /= Null_Node then
+ Val := Synth_Expression_With_Type (Top_Inst, Defval, Inter_Typ);
+ else
+ -- Only for simulation, expect override.
+ Val := Create_Value_Default (Inter_Typ);
+ end if;
pragma Assert (Is_Static (Val.Val));
Val := Unshare (Val, Instance_Pool);
Val.Typ := Unshare_Type_Instance (Val.Typ, Inter_Typ);