Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. entity AUT2 is port (
  4. CLK,RESET,UP: in std_logic;
  5. Q: out std_logic_vector(0 to 2);
  6. Y: out std_logic
  7. );
  8. end AUT2;
  9.  
  10. architecture arch_of_AUT2 of AUT2 is
  11. type states is (state0, state1, state2, state3, state4, state5);
  12. -- directiva care specific? implementarea automatului secven?ial de tip "one-hot-one"
  13. attribute state_encoding of states: type is one_hot_one;
  14.  
  15. signal state: states;
  16. begin
  17. process (CLK)
  18. begin
  19. if (CLK'event and CLK='0') then
  20. if RESET ='1' then
  21. state <= state0;
  22. else
  23. case state is
  24. when state0 =>
  25. if UP = '1' then
  26. state <= state1;
  27. else
  28. state <= state5;
  29. end if;
  30. when state1 =>
  31. if UP = '1' then
  32. state <= state2;
  33. else
  34. state <= state0;
  35. end if;
  36. when state2 =>
  37. if UP = '1' then
  38. state <= state3;
  39. else
  40. state <= state1;
  41. end if;
  42. when state3 =>
  43. if UP = '1' then
  44. state <= state4;
  45. else
  46. state <= state2;
  47. end if;
  48. when state4 =>
  49. if UP = '1' then
  50. state <= state5;
  51. else
  52. state <= state3;
  53. end if;
  54. when state5 =>
  55. if UP = '1' then
  56. state <= state0;
  57. else
  58. state <= state4;
  59. end if;
  60. end case;
  61. end if;
  62. end if;
  63. end process;
  64. ---IESIRE DE TIP MOORE
  65. Q <= "001" when (state=state0) else
  66. "011" when (state=state1) else
  67. "010" when (state=state2) else
  68. "110" when (state=state3) else
  69. "111" when (state=state4) else
  70. "101";
  71. ---IESIRE DE TIP MEALY
  72. Y <= '1' when (state = state2 and UP='1' ) else
  73. '0';
  74.  
  75. end arch_of_AUT2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement