Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 10/23/2019 02:55:09 PM
  6. -- Design Name:
  7. -- Module Name: automat - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool Versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20.  
  21.  
  22. library IEEE;
  23. use IEEE.STD_LOGIC_1164.ALL;
  24.  
  25. -- Uncomment the following library declaration if using
  26. -- arithmetic functions with Signed or Unsigned values
  27. --use IEEE.NUMERIC_STD.ALL;
  28.  
  29. -- Uncomment the following library declaration if instantiating
  30. -- any Xilinx leaf cells in this code.
  31. --library UNISIM;
  32. --use UNISIM.VComponents.all;
  33.  
  34. entity automat_e is
  35. Port (I,clk:in STD_LOGIC;
  36. Q:out STD_LOGIC);
  37. end automat_e;
  38.  
  39. architecture automat_a of automat_e is
  40. Type myType is (S0,S1,S11,S110,S1101);
  41. signal pr_state,nx_state: myType;
  42. begin
  43. process(clk,I,pr_state,nx_state)
  44. begin
  45. case pr_state is
  46. when S0=>
  47. if (I='1' and rising_edge(clk)) then
  48. nx_state <= S1; Q<='0';
  49. elsif (I='0') then
  50. nx_state <= S0;
  51. end if;
  52. when S1=>
  53. if (I='1' and rising_edge(clk)) then
  54. nx_state <= S11; Q<='0';
  55. elsif (I='0') then
  56. nx_state <= S0;
  57. end if;
  58. when S11=>
  59. if (I='0' and rising_edge(clk)) then
  60. nx_state <= S110; Q<='0';
  61. elsif (I='1') then
  62. nx_state <= S0;
  63. end if;
  64. when S110=>
  65. if (I='1' and rising_edge(clk)) then
  66. nx_state <= S1101; Q<='0';
  67. elsif (I='0') then
  68. nx_state <= S0;
  69. end if;
  70. when S1101=>
  71. if (I='1' and rising_edge(clk)) then
  72. Q <='1';
  73. end if;
  74. end case;
  75. end process;
  76. end automat_a;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement