aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-09-17 21:46:17 +0200
committerTristan Gingold <tgingold@free.fr>2022-09-17 21:46:17 +0200
commitf3a6a541dd119cba285d0277a00e8def5f927d88 (patch)
tree8c417a1e971c11cb72b09d55ed5ae8b19a876b0d /src
parent6f258316773f74846c735daedc61817064737caf (diff)
downloadghdl-f3a6a541dd119cba285d0277a00e8def5f927d88.tar.gz
ghdl-f3a6a541dd119cba285d0277a00e8def5f927d88.tar.bz2
ghdl-f3a6a541dd119cba285d0277a00e8def5f927d88.zip
synth: handle open variable association
Diffstat (limited to 'src')
-rw-r--r--src/synth/synth-vhdl_stmts.adb53
1 files changed, 31 insertions, 22 deletions
diff --git a/src/synth/synth-vhdl_stmts.adb b/src/synth/synth-vhdl_stmts.adb
index 36c8cb6cb..b0726d03b 100644
--- a/src/synth/synth-vhdl_stmts.adb
+++ b/src/synth/synth-vhdl_stmts.adb
@@ -1973,30 +1973,39 @@ package body Synth.Vhdl_Stmts is
end if;
when Iir_Kind_Interface_Variable_Declaration =>
-- Always pass by value.
- Actual := Get_Actual (Assoc);
- Info := Synth_Target (Caller_Inst, Actual);
- if Is_Copyback_Parameter (Inter) then
- -- For the copy back: keep info of formal.
- Create_Object (Caller_Inst, Assoc, Info_To_Valtyp (Info));
- end if;
- if Info.Kind /= Target_Memory
- and then Info.Obj.Val.Kind = Value_Memory
- then
- -- FIXME: the subtype conversion will copy the value, so
- -- allocate here in current_pool ?
- Val := Create_Value_Memory (Info.Targ_Type, Instance_Pool);
- Copy_Memory (Val.Val.Mem,
- Info.Obj.Val.Mem + Info.Off.Mem_Off,
- Info.Targ_Type.Sz);
- elsif Info.Kind = Target_Simple
- and then Info.Obj.Val.Kind = Value_File
+ if Assoc = Null_Node
+ or else Get_Kind (Assoc) = Iir_Kind_Association_Element_Open
then
- -- For vhdl-87
- Val := Create_Value_File
- (Info.Targ_Type, Info.Obj.Val.File, Instance_Pool);
- else
- Val := Synth_Read (Caller_Inst, Info, Assoc);
+ Val := Synth_Expression_With_Type
+ (Caller_Inst, Get_Default_Value (Inter), Inter_Typ);
Val := Unshare (Val, Instance_Pool);
+ else
+ Actual := Get_Actual (Assoc);
+ Info := Synth_Target (Caller_Inst, Actual);
+ if Is_Copyback_Parameter (Inter) then
+ -- For the copy back: keep info of formal.
+ Create_Object (Caller_Inst, Assoc, Info_To_Valtyp (Info));
+ end if;
+ if Info.Kind /= Target_Memory
+ and then Info.Obj.Val.Kind = Value_Memory
+ then
+ -- FIXME: the subtype conversion will copy the value, so
+ -- allocate here in current_pool ?
+ Val := Create_Value_Memory
+ (Info.Targ_Type, Instance_Pool);
+ Copy_Memory (Val.Val.Mem,
+ Info.Obj.Val.Mem + Info.Off.Mem_Off,
+ Info.Targ_Type.Sz);
+ elsif Info.Kind = Target_Simple
+ and then Info.Obj.Val.Kind = Value_File
+ then
+ -- For vhdl-87
+ Val := Create_Value_File
+ (Info.Targ_Type, Info.Obj.Val.File, Instance_Pool);
+ else
+ Val := Synth_Read (Caller_Inst, Info, Assoc);
+ Val := Unshare (Val, Instance_Pool);
+ end if;
end if;
when Iir_Kind_Interface_Signal_Declaration =>
-- Always pass by reference (use an alias).