﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="thpdoc.xsl"?>
<page id="switchall" suffix=" Statement">
  <subsection>Equivalent to the <kw>switch</kw> statement. Additionally, performs completeness check for enumeration types.<code>switchall (Expression)
{
	case Val1:
	case Val2:
		...
		break;
	case Val3:
		...
		break;
	case ValN:
		...
		break;
}</code>
	<p>The <kw>switchall</kw> is equivalent to the <kw>switch</kw> statement. However, it cannot have the <kw>default</kw> case and can only be used with untyped enumerations. The <kw>case</kw> statements do not cover any of the enumeration values, an error message will be shown.</p>
</subsection>
<examples>
	<example name="Missing case">
		The following code has a missing case for State.Writing and will cause an error:
<code>entity SomeFSM
{
    port in logic clk, reset;
    port in logic Start;
    
	enum State
	{
		Initial,
		Reading,
		Writing,
	}
    
    signal State CurrentState = State.Initial;
    
    process StateFlow (clk.rising)
    {
    	switchall(CurrentState)
    	{
    	case State.Initial:
    		break;
    	case State.Reading:
    		break;
    	}
    }
}</code>
	
	<p>See <kw>enum</kw> page for common examples of <kw>switch</kw> statement.</p>
	</example>
</examples>
  <seealso id="process"/>
  <seealso id="functions"/>
  <seealso id="switchall"/>
  <seealso id="select"/>
  <seealso id="selectall"/>
</page>