From 1aea5cb51957a3dd0d715bfc7d59db3dda747665 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 25 May 2022 06:48:27 +0200 Subject: vhdl: move Is_Copyback_Parameter to vhdl-utils --- src/vhdl/vhdl-utils.adb | 10 ++++++++++ src/vhdl/vhdl-utils.ads | 4 ++++ 2 files changed, 14 insertions(+) (limited to 'src/vhdl') 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; -- cgit v1.2.3