------------------------------------------------------------------------------- -- -- This is an example of trying to combine the outputs of a circuit with the -- definition of the FSM. This causes an extra register to be inferred. -- -- Paul Chow -- Department of Electrical and Computer Engineering -- University of Toronto -- -- October 1998 -- ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_signed.all; entity fsm_bad is port( iClk : in STD_LOGIC; iReset : in STD_LOGIC; iX,iY : in STD_LOGIC; oOutput : out STD_LOGIC ); end fsm_bad; architecture RTL of fsm_bad is type StateTypes is (StateA,StateB); signal State : StateTypes; begin -- RTL BAD: process (iClk,iReset) begin -- BAD if(iReset = '1') then State <= StateA; elsif (iClk'event and iClk = '1') then case State is when StateA => oOutput <= iX; State <= StateB; when StateB => oOutput <= iY; State <= StateA; end case; -- State end if; end process BAD; end RTL; -- of fsm_bad