aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2023-04-23 19:30:02 +0200
committerTristan Gingold <tgingold@free.fr>2023-04-23 19:30:02 +0200
commit0ffb1ee5a504c47eb447ebc313a8f8fc6dc74806 (patch)
treeb3308a933f2815fccf78fcea1b8c076fa053b95a
parent54e8c06d1bb86a1dda7f35bbc46d89d4bf78e78e (diff)
downloadghdl-0ffb1ee5a504c47eb447ebc313a8f8fc6dc74806.tar.gz
ghdl-0ffb1ee5a504c47eb447ebc313a8f8fc6dc74806.tar.bz2
ghdl-0ffb1ee5a504c47eb447ebc313a8f8fc6dc74806.zip
synth-vhdl_expr: handle components in external names
-rw-r--r--src/synth/synth-vhdl_expr.adb27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/synth/synth-vhdl_expr.adb b/src/synth/synth-vhdl_expr.adb
index 274548616..e0b7f7f11 100644
--- a/src/synth/synth-vhdl_expr.adb
+++ b/src/synth/synth-vhdl_expr.adb
@@ -512,6 +512,9 @@ package body Synth.Vhdl_Expr is
return Reshape_Value ((Val.Typ, Val.Val.C_Val), Ntype);
when Value_Memory =>
return (Ntype, Val.Val);
+ when Value_Signal =>
+ -- For external names.
+ return (Ntype, Create_Value_Signal (Val.Val.S, Val.Val.Init));
when others =>
raise Internal_Error;
end case;
@@ -983,13 +986,23 @@ package body Synth.Vhdl_Expr is
end if;
case Get_Kind (Res) is
when Iir_Kind_Component_Instantiation_Statement =>
- if Is_Entity_Instantiation (Res) then
- return Synth_Pathname
- (Loc_Inst, Name, Get_Sub_Instance (Cur_Inst, Res), Suffix);
- else
- -- TODO: skip component.
- raise Internal_Error;
- end if;
+ declare
+ Sub_Inst : Synth_Instance_Acc;
+ Comp_Inst : Synth_Instance_Acc;
+ begin
+ if Is_Entity_Instantiation (Res) then
+ Sub_Inst := Get_Sub_Instance (Cur_Inst, Res);
+ else
+ Comp_Inst := Get_Sub_Instance (Cur_Inst, Res);
+ Sub_Inst := Get_Component_Instance (Comp_Inst);
+ if Cur_Inst = null then
+ Error_Msg_Synth
+ (Loc_Inst, Path, "component for %i is not bound", +Res);
+ return No_Valtyp;
+ end if;
+ end if;
+ return Synth_Pathname (Loc_Inst, Name, Sub_Inst, Suffix);
+ end;
when others =>
Error_Kind ("synth_pathname(2)", Res);
end case;