title: VHDL output declarations with State machine
body: <p>I'm trying to write a state machine in VHDL that will scan a 4x4 keypad.  I want keyP set to 0 at the start and after a Reset.  I also want the <code>Col</code> to be set to "1111" at the start and after a Reset.</p>
  
  <p>As I'm not fully versed in VHDL programming I'm sure it's just a stupid syntax error.<br>
  The error I get is:</p>
  
  <blockquote>
    <p>Error (10818): Can't infer register for "Col[0]" at Lab_7_Keypad.vhd(39) because it does not hold its value outside the clock edge</p>
  </blockquote>
  
  <p>and the same for <code>Col[1]</code>, <code>Col[2]</code>, <code>Col[3]</code>, and for <code>keyP</code> as well.</p>
  
  <p>Here's my code for the start of it all.  Can someone give me an idea where I've gone wrong?</p>
  
  <p>Thanks</p>
  
  <pre><code>ENTITY Lab_7_Keypad IS
  PORT(
      nReset          :   IN  STD_LOGIC;
      clk             :   IN  STD_LOGIC;
      row             :   IN  STD_LOGIC_VECTOR (3 downto 0);
      Col             :   OUT STD_LOGIC_VECTOR (3 downto 0);
      data            :   OUT STD_LOGIC_VECTOR (3 downto 0);
      keyP            :   OUT STD_LOGIC);
  
      END Lab_7_Keypad;
  
  ARCHITECTURE a OF Lab_7_Keypad IS   
  TYPE STATE_TYPE IS ( Col1Set, Col2Set, Col3Set, Col4Set );
  SIGNAL  coltest :   STATE_TYPE;
  
  BEGIN
  PROCESS (clk, nReset )
  BEGIN
      keyP &lt;= '0';
      Col &lt;= "1111";
      IF nReset = '0' THEN                        --  asynch Reset to zero
          coltest &lt;=  Col1Set;
          Col &lt;="1111";
          keyP &lt;= '0';
      ELSIF clk'EVENT AND clk = '1' THEN          --  triggers on PGT
  
          CASE coltest IS
              WHEN Col1Set =&gt; 
              Col &lt;="1110";
                  CASE row IS
                      WHEN    "1110"=&gt;--row 1
                      data &lt;= "0001";
                      keyP &lt;= '1';
                      WHEN    "1101"=&gt;--row 2
                      data &lt;= "0100";
                      keyP &lt;= '1';
                      WHEN    "1011"=&gt;--row 3
                      data &lt;= "0111";
                      keyP &lt;= '1';
                      WHEN    "0111"=&gt;--row 4
                      data &lt;= "1110";
                      keyP &lt;= '1';
                      WHEN OTHERS =&gt; coltest &lt;= Col2Set;
                  END CASE;
    --And continues with same Case statements three more times.
  </code></pre>