﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="thpdoc.xsl"?>
<page id="__error" suffix=" Function">
  <subsection>Raises a custom compile-time error.</subsection>
  <code>void __error(string format, ...);</code>
  The <kw>__error</kw>() function called from a process or a function that is being executed during compile-time or converted to VHDL will stop the compilation and produce a user-defined error. You can use .Net composite format strings to make your error messages more specific. 
  <examples>
	<example>
		<code>template &lt;int _Size&gt; entity Inner
{
	port in logic clk;
	
	process dummy ()
	{
		if (pow2(log2(_Size)) != _Size)
			__error("_Size = {1} is not a multiple of 2", _Size);
	}
}

entity Test
{
	Inner&lt;3&gt; uut(
		clk = auto
	);
}</code>
	The compilation will fail with an error message:
<code>_Size = 3 is not a multiple of 2</code>
	</example>
  </examples>
  <seealso id="entity"/>
  <seealso id="process"/>
  <seealso id="functions"/>
</page>