﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="thpdoc.xsl"?>
<page id="__equal_obj" suffix=" Function">
  <subsection>Returns true if both arguments represent the same compile-time object.</subsection>
  <code>bool __equal_obj(any obj1, any obj2);</code>
  The <kw>__equal_obj</kw>() function allows comparing the <kw>foreach</kw> iterator or an object from a list with a given one. It is useful when writing generic list-based code.
  <examples>
	<example name="Skipping an object from the list">
		<code>class Class1
{
	typedef logic[4] Type;
}

class Class2
{
	typedef logic[8] Type;
	const int Val = 5;
}

entity Test
{
	generate dummy foreach(any c in __list(Class1, Class2))
	{
		generate inner if (!__equal_obj(c, Class1))
		{
			signal c.Type sig = c.Val;
		}
	}
}
generate_vhdl(Test);</code>
	Generated VHDL code:
<code>entity Test is
end entity Test;

architecture Behavioral of Test is
	signal dummy_1_inner_case_1_sig : std_logic_vector(7 downto 0) := X"05";
	
	begin
		
end architecture Behavioral;</code>
	</example>
  </examples>
  <seealso id="lists"/>
  <seealso id="foreach"/>
  <seealso id="generate"/>
</page>