<chapter id="chapter.gui.fsm">
  <title>Navigating the FSM State/State Transition Coverage Window</title>
  <para>
    The Verbose FSM State/State Transition Coverage window allows the user to see which states and state transitions of a
    currently selected FSM have been covered or are uncovered.  To view this window, simply select the "FSM" coverage
    metric mode in the <link linkend="section.gui.main.covbar">coverage bar</link> in the main window and select an
    underlined FSM state variable in the <link linkend="section.gui.main.viewer">file viewer</link>.  This will cause the
    FSM Coverage window to be displayed with the currently selected FSM information loaded.
    <xref linkend="figure.gui.fsm"/> below shows an example of this window.
  </para>
  <para>
    <figure id="figure.gui.fsm">
      <title>Verbose FSM Coverage Window</title>
      <mediaobject><imageobject><imagedata fileref="img/fsm_window.gif" format="GIF"/></imageobject></mediaobject>
    </figure>
  </para>

  <sect1 id="section.gui.fsm.navigate">
    <title>Navigating the FSM Window</title>
    <para>
      The Verbose FSM window is split into two main frames.  The top frame contains the expressions that make up the
      input and output states of the selected FSM.  The bottom frame contains a two-dimensional table showing the covered
      and/or uncovered states and state transitions.
    </para>
    <para>
      The state/state transition table is a two-dimensional table with all possible values of the input states in the
      left-most column, the output states in the upper-most row, and the state transitions in the rest of the table.
    </para>
    <para>
      To determine which states have been uncovered in the table, simply find all state values in the input column or
      output row (both show the same information) which are highlighted with the "Uncovered" color selection specified in
      the <link linkend="chapter.gui.preferences">preferences window</link>.  To determine which states have been covered
      in the table, simply find all state values in the input column or output row which are highlighted with the
      "Covered" color selection.  All other state values which are not highlighted are either impossible values (if all
      of the state transitions were specified in the Verilog file) or are unknown for coverage (if not all of the state
      transitions were specified in the Verilog file).
    </para>
    <para>
      To determine which state transitions have been uncovered in the table, simply find all empty boxes in the table
      that are highlighted with the "Uncovered" background color.  If one of these exist, it specifies that the
      transition of "input state" (the value specified in the left-most column in the same row) to "output state" (the
      value specified in the upper-most row in the same column) did not occur.  In the example above, we can see that the
      following state transitions did not occur:
    </para>
    <para>
      <itemizedlist>
        <listitem><para>2 -&gt; 4</para></listitem>
        <listitem><para>4 -&gt; 1</para></listitem>
      </itemizedlist>
    </para>
    <para>
      Follow the same procedure for finding all covered state transitions in the table except that these boxes will be
      highlighted with the "Covered" background color.  In the example above, we can see that the following state
      transitions occurred:
    </para>
    <para>
      <itemizedlist>
        <listitem><para>1 -&gt; 2</para></listitem>
        <listitem><para>1 -&gt; 1 (loopback case)</para></listitem>
        <listitem><para>2 -&gt; 2 (loopback case)</para></listitem>
      </itemizedlist>
    </para>
    <para>
      All other state transition boxes that are not highlighted are either impossible state transitions (if all state
      transitions were specified in the Verilog source code) or are unknown in their coverage (either not hit or
      impossible transition if all state transitions were not specified in the Verilog source code).
    </para>
    <para>
      To exit this window, simply click on <emphasis role="bold">Close</emphasis> button. To see this help page for the
      FSM window, click on the help (?) button.
    </para>
  </sect1>

  <sect1 id="section.gui.fsm.excl">
    <title>Excluding/Including a State Transition</title>
    <para>
      Uncovered state transitions can be excluded/included for FSM coverage consideration.  This is done by clicking on
      the "I" (state transition is currently included in coverage results) or "E" (state transition is currently excluded
      from coverage results) character in the middle of a state transition square.  Changing a state transition from an
      "I" to an "E" will automatically cause a <link linkend="chapter.gui.exclude">exclusion reason popup window</link>
      to be displayed, allowing you to specify the reason for excluding this state transition.  After a reason has been
      entered, the state transition summary coverage information in the
      <link linkend="section.gui.main.listbox">listbox</link> to be updated and the background color of the state
      transition box will change from the uncovered color to the covered color.  Changing a state transition from an "E"
      to an "I" will automatically cause the state transition summary coverage information in the Main Window Summary Bar
      to be updated and the background color of the state transition box will change from the covered color to the uncovered
      color.  <xref linkend="figure.gui.fsm.excl"/> below shows an example of the <xref linkend="figure.gui.fsm"/> state
      machine coverage information with a couple of state transitions excluded from coverage.
    </para>
    <para>
      <figure id="figure.gui.fsm.excl">
        <title>Example of excluded state transitions</title>
        <mediaobject><imageobject><imagedata fileref="img/fsm_excl.gif" format="GIF"/></imageobject></mediaobject>
      </figure>
    </para>
    <para>
      If all of the state transitions for a state machine have been excluded for coverage consideration, the output state
      variable in the <link linkend="section.gui.main.viewer">file viewer</link> will change its background from the uncovered to the
      covered background color.  However, the underline will remain under the variable to allow the user to still examine
      the verbose FSM information for that state machine.
    </para>
    <para>
      If the user excludes any state transition in the design, the <emphasis role="bold">Save CDD...</emphasis> option in
      the <link linkend="section.gui.main.filemenu">file</link> menu will be enabled.  This allows the user to save the excluded
      property either back to the CDD file (or to a newly named CDD file).  Doing so will allow the user to load the CDD
      file at a different time and retain the knowledge of which state transitions have been excluded/included for
      coverage.  Additionally, if a saved CDD file with coverage exclusion is merged with another CDD file, the excluded
      state transition information is preserved for the resulting merged CDD file.
    </para>
    <para>
      If a state transition has been excluded from coverage and an exclusion reason was specified, you can view the reason
      for exclusion by moving the cursor over the state transition.  This will cause a tooltip-style window to be displayed
      specifying the state transition and the reason for exclusion.  The background color of the tooltip will be the same
      color as the "covered" background color to help distinguish it from a normal tooltip.  To cause the exclusion reason
      tooltip to disappear, simply move the cursor off of the state transition cell.
    </para>
  </sect1>

  <sect1 id="section.gui.fsm.display">
    <title>Displaying a New FSM</title>
    <para>
      If the Verbose FSM Coverage window is currently displayed, the user may select a new FSM state variable in the
      <link linkend="section.gui.main.viewer">file viewer</link> of the Main window. When a new FSM is selected, its information
      immediately replaces the currently selected FSM.  This feature allows many different FSMs to be viewed one after
      the other without having to create/destroy a new window for each.
    </para>
    <para>
      The user may also see the previous or next uncovered FSM in the main viewer by clicking either the left arrow
      button (for previous signal viewing) or the right arrow button (for next signal viewing). Note that the left arrow
      button will be disabled if there is not a signal previous to the current signal in the given module and the right
      arrow button will be disabled if there is not a signal after the current signal in the given module.
    </para>
  </sect1>

</chapter>
