Advertisement
anderson02021

FSM_Moore

Jun 15th, 2021
717
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.95 KB | None | 0 0
  1.  
  2. library IEEE;
  3. use IEEE.STD_LOGIC_1164.all;
  4.  
  5. entity simple is
  6. port (
  7.     clock, reset, w :   in std_logic;
  8.     z:                  out std_logic
  9. );
  10.  
  11. end simple;
  12.  
  13. architecture comp of simple is
  14.     type statetype is (A, B, C);
  15.    
  16.     signal y: statetype;
  17.  
  18. begin
  19.     process (clock, reset) begin
  20.       if reset = '0' then y <= A;
  21.           elsif (clock'event and clock = '1') then
  22.           case y is
  23.               when A =>
  24.                   if (w = '0')
  25.                       then y <= A;
  26.                       else y <= B;
  27.                   end if;
  28.               when B =>
  29.                   if (w = '0')
  30.                       then y <= A;
  31.                       else y <= C;
  32.                   end if;
  33.               when C =>
  34.                   if (w = '0')
  35.                       then y <= A;
  36.                       else y <= C;
  37.                   end if;
  38.            end case;
  39.        end if;
  40.      end process;
  41.     z <= '1' when y = C else '0';
  42. end comp;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement