diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-05-25 06:48:27 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-05-25 06:48:27 +0200 |
commit | 1aea5cb51957a3dd0d715bfc7d59db3dda747665 (patch) | |
tree | 25aafdd471844e1952536bb0574ad97e3624abc9 | |
parent | 0ceba3fdfbf42443a44a2b8ad4f601fb72add5a5 (diff) | |
download | ghdl-1aea5cb51957a3dd0d715bfc7d59db3dda747665.tar.gz ghdl-1aea5cb51957a3dd0d715bfc7d59db3dda747665.tar.bz2 ghdl-1aea5cb51957a3dd0d715bfc7d59db3dda747665.zip |
vhdl: move Is_Copyback_Parameter to vhdl-utils
-rw-r--r-- | src/synth/synth-vhdl_stmts.adb | 14 | ||||
-rw-r--r-- | src/vhdl/vhdl-utils.adb | 10 | ||||
-rw-r--r-- | src/vhdl/vhdl-utils.ads | 4 |
3 files changed, 16 insertions, 12 deletions
diff --git a/src/synth/synth-vhdl_stmts.adb b/src/synth/synth-vhdl_stmts.adb index dcb13ff65..7bccb6736 100644 --- a/src/synth/synth-vhdl_stmts.adb +++ b/src/synth/synth-vhdl_stmts.adb @@ -1609,16 +1609,6 @@ package body Synth.Vhdl_Stmts is end if; end Synth_Label; - function Is_Copyback_Interface (Inter : Node) return Boolean is - begin - case Iir_Parameter_Modes (Get_Mode (Inter)) is - when Iir_In_Mode => - return False; - when Iir_Out_Mode | Iir_Inout_Mode => - return Get_Kind (Inter) = Iir_Kind_Interface_Variable_Declaration; - end case; - end Is_Copyback_Interface; - type Association_Iterator_Kind is (Association_Function, Association_Operator); @@ -1671,7 +1661,7 @@ package body Synth.Vhdl_Stmts is while Is_Valid (Assoc) loop Inter := Get_Association_Interface (Assoc, Assoc_Inter); - if Is_Copyback_Interface (Inter) then + if Is_Copyback_Parameter (Inter) then Nbr_Inout := Nbr_Inout + 1; end if; @@ -2046,7 +2036,7 @@ package body Synth.Vhdl_Stmts is while Is_Valid (Assoc) loop Inter := Get_Association_Interface (Assoc, Assoc_Inter); - if Is_Copyback_Interface (Inter) then + if Is_Copyback_Parameter (Inter) then if not Get_Whole_Association_Flag (Assoc) then raise Internal_Error; end if; diff --git a/src/vhdl/vhdl-utils.adb b/src/vhdl/vhdl-utils.adb index fecb0602c..300c082a5 100644 --- a/src/vhdl/vhdl-utils.adb +++ b/src/vhdl/vhdl-utils.adb @@ -676,6 +676,16 @@ package body Vhdl.Utils is end case; end Is_Parameter; + function Is_Copyback_Parameter (Inter : Iir) return Boolean is + begin + case Iir_Parameter_Modes (Get_Mode (Inter)) is + when Iir_In_Mode => + return False; + when Iir_Out_Mode | Iir_Inout_Mode => + return Get_Kind (Inter) = Iir_Kind_Interface_Variable_Declaration; + end case; + end Is_Copyback_Parameter; + function Find_Name_In_Flist (List : Iir_Flist; Lit : Name_Id) return Iir is El : Iir; diff --git a/src/vhdl/vhdl-utils.ads b/src/vhdl/vhdl-utils.ads index f51599cdf..01425a157 100644 --- a/src/vhdl/vhdl-utils.ads +++ b/src/vhdl/vhdl-utils.ads @@ -112,6 +112,10 @@ package Vhdl.Utils is -- Return True iff interface INTER is a (subprogram) parameter. function Is_Parameter (Inter : Iir) return Boolean; + -- Return True iff parameter INTER should be copied back (for out/inout + -- variable). + function Is_Copyback_Parameter (Inter : Iir) return Boolean; + -- Duplicate enumeration literal LIT. function Copy_Enumeration_Literal (Lit : Iir) return Iir; |