aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/translate/trans-chap5.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-11-10 07:33:53 +0100
committerTristan Gingold <tgingold@free.fr>2018-11-10 07:33:53 +0100
commitc59d83d278f2bb72630fc1e015b3c36b28d3b0c7 (patch)
tree5e06d9f6340b816f622bb908ee7c9f5072de6f37 /src/vhdl/translate/trans-chap5.adb
parent39f7879742b5b4b87a5b4881871ece229f968b5b (diff)
downloadghdl-c59d83d278f2bb72630fc1e015b3c36b28d3b0c7.tar.gz
ghdl-c59d83d278f2bb72630fc1e015b3c36b28d3b0c7.tar.bz2
ghdl-c59d83d278f2bb72630fc1e015b3c36b28d3b0c7.zip
trans-chap5: do subtype conversion in signal association.
Diffstat (limited to 'src/vhdl/translate/trans-chap5.adb')
-rw-r--r--src/vhdl/translate/trans-chap5.adb12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/vhdl/translate/trans-chap5.adb b/src/vhdl/translate/trans-chap5.adb
index 4c3f0ce20..c85ed26f0 100644
--- a/src/vhdl/translate/trans-chap5.adb
+++ b/src/vhdl/translate/trans-chap5.adb
@@ -365,6 +365,7 @@ package body Trans.Chap5 is
Formal_Type : constant Iir := Get_Type (Formal);
Actual_Type : constant Iir := Get_Type (Actual);
Port : constant Iir := Get_Interface_Of_Formal (Formal);
+ Formal_Tinfo : Type_Info_Acc;
Formal_Sig : Mnode;
Formal_Val : Mnode;
Actual_Sig : Mnode;
@@ -421,10 +422,17 @@ package body Trans.Chap5 is
Chap6.Translate_Signal_Name (Formal, Formal_Sig, Formal_Val);
-- Copy pointer to the values.
- if Get_Info (Formal_Type).Type_Mode in Type_Mode_Composite then
+ Formal_Tinfo := Get_Info (Formal_Type);
+ if Formal_Tinfo.Type_Mode in Type_Mode_Composite then
+ -- Need to convert base, as you can assign a bounded type
+ -- to an unbounded type (or the opposite). Maybe convert
+ -- only when needed ? Subtype matching is checked below.
New_Assign_Stmt
(M2Lp (Chap3.Get_Composite_Base (Formal_Val)),
- M2Addr (Chap3.Get_Composite_Unbounded_Base (Actual_Val)));
+ New_Convert_Ov
+ (M2Addr
+ (Chap3.Get_Composite_Unbounded_Base (Actual_Val)),
+ Formal_Tinfo.B.Base_Ptr_Type (Mode_Value)));
else
New_Assign_Stmt (M2Lp (Formal_Val), M2Addr (Actual_Val));
end if;