diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-05-12 19:00:33 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-05-13 06:01:07 +0200 |
commit | 9f8e1f46b1c3ad3b2e820365861dfcb9567684be (patch) | |
tree | 5c7f7f6c7d1ad4efd1ed931940aeb77940343baa | |
parent | 841001b3747e41ba4553d062319de867a9639a9b (diff) | |
download | ghdl-9f8e1f46b1c3ad3b2e820365861dfcb9567684be.tar.gz ghdl-9f8e1f46b1c3ad3b2e820365861dfcb9567684be.tar.bz2 ghdl-9f8e1f46b1c3ad3b2e820365861dfcb9567684be.zip |
trans-chap5: handle record subtypes in port association.
Part of #1300
-rw-r--r-- | src/vhdl/translate/trans-chap5.adb | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/vhdl/translate/trans-chap5.adb b/src/vhdl/translate/trans-chap5.adb index 5b85430fe..b8264f3db 100644 --- a/src/vhdl/translate/trans-chap5.adb +++ b/src/vhdl/translate/trans-chap5.adb @@ -424,19 +424,28 @@ package body Trans.Chap5 is -- Copy pointer to the values. 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)), - 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; + -- 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. + case Formal_Tinfo.Type_Mode is + when Type_Mode_Unbounded_Array + | Type_Mode_Unbounded_Record => + New_Assign_Stmt + (M2Lp (Chap3.Get_Composite_Base (Formal_Val)), + New_Convert_Ov + (M2Addr (Chap3.Get_Composite_Base (Actual_Val)), + Formal_Tinfo.B.Base_Ptr_Type (Mode_Value))); + when Type_Mode_Bounded_Arrays + | Type_Mode_Bounded_Records => + New_Assign_Stmt + (M2Lp (Formal_Val), + New_Convert_Ov + (M2Addr (Chap3.Get_Composite_Base (Actual_Val)), + Formal_Tinfo.Ortho_Ptr_Type (Mode_Value))); + when others => + New_Assign_Stmt + (M2Lp (Formal_Val), M2Addr (Actual_Val)); + end case; else Set_Map_Env (Actual_Env); Actual_Sig := Chap6.Translate_Name (Actual, Mode_Signal); |