﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="thpdoc.xsl"?>
<page id="__decl" suffix=" Function">
  <subsection>Allows building lists of signals to use them from generic code.</subsection>
  <code>__list(__decl(sig1), __decl(sig2), ...)</code>
  The <kw>__decl</kw>() function should be used when declaring lists of signals to use them inside <kw>for</kw>/<kw>foreach</kw> statements.
  <examples>
	<example>
		<code>entity Test
{
	signal
	{
		logic[8] a;
		logic[16] b;
		int c;
		
		logic clk;
	}

	process count (clk.rising)
	{
		foreach(any sig in __list(__decl(a), __decl(b), __decl(c)))
			sig++;
	}	
}</code>
	Generated VHDL code:
<code>entity Test is
end entity Test;

architecture Behavioral of Test is
	signal a : std_logic_vector(7 downto 0);
	signal b : std_logic_vector(15 downto 0);
	signal c : integer;
	signal clk : std_logic;
	
	begin
		count : process (clk) is
		begin
			if rising_edge(clk) then
				a &lt;= (a + X"01");
				b &lt;= (b + X"0001");
				c &lt;= (c + 1);
			end if;
		end process count;
		
end architecture Behavioral;</code>
Note that omitting <kw>__decl</kw> keyword (e.g. __list(a,b,c)) would cause errors, as normally the values of list contents should be known at compile-time.
	</example>
  </examples>
  <seealso id="__list"/>
  <seealso id="lists"/>
  <seealso id="foreach"/>
  <seealso id="generate"/>
</page>