Advertisement
Guest User

ECE410 Part 1

a guest
Oct 23rd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.76 KB | None | 0 0
  1. -- Error: Port 'Sig_Name' is assigned to Package_Pin 'XYZ' which can only be used as the N side of a differential clock input.
  2. -- https://www.xilinx.com/support/answers/67599.html
  3.  
  4. ----------------------------------------------------------------------------------
  5. -- Company:
  6. -- Engineer:
  7. --
  8. -- Create Date: 05/15/2018 03:55:57 PM
  9. -- Design Name:
  10. -- Module Name: SequenceDetector - Behavioral
  11. -- Project Name:
  12. -- Target Devices:
  13. -- Tool Versions:
  14. -- Description:
  15. --
  16. -- Dependencies:
  17. --
  18. -- Revision:
  19. -- Revision 0.01 - File Created
  20. -- Additional Comments:
  21. --
  22. ----------------------------------------------------------------------------------
  23.  
  24.  
  25. library IEEE;
  26. use IEEE.STD_LOGIC_1164.ALL;
  27. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  28. use IEEE.NUMERIC_STD.ALL;
  29.  
  30. -- Uncomment the following library declaration if using
  31. -- arithmetic functions with Signed or Unsigned values
  32. --use IEEE.NUMERIC_STD.ALL;
  33.  
  34. -- Uncomment the following library declaration if instantiating
  35. -- any Xilinx leaf cells in this code.
  36. --library UNISIM;
  37. --use UNISIM.VComponents.all;
  38.  
  39. entity SequenceDetector is
  40. Port (
  41. clk : in STD_LOGIC;
  42. Data_In : in STD_LOGIC; --swt(0) as Data_In
  43. Clk_Btn : in STD_LOGIC; --btn(0) used as clock
  44. sw : in STD_LOGIC_VECTOR(3 DOWNTO 0);
  45. led6_r : out STD_LOGIC;
  46. led : out STD_LOGIC_VECTOR (3 DOWNTO 0)
  47. );
  48. end SequenceDetector;
  49.  
  50. architecture Behavioral of SequenceDetector is
  51.  
  52. signal clk_out : STD_LOGIC;
  53.  
  54. component clock_divider is
  55. Port (clk : in STD_LOGIC;
  56. clk_out : out STD_LOGIC);
  57. end component;
  58.  
  59. TYPE STATES IS (S0,S1,S2,S3,S4,S5,S6);
  60. signal state, next_state: STATES;
  61.  
  62. begin
  63. divider: clock_divider port map
  64. (
  65. clk => clk,
  66. clk_out=>clk_out
  67. );
  68.  
  69. SequenceDetector0: -- '01101'
  70. process (Clk_Btn)
  71. begin
  72. if Clk_Btn'event and Clk_Btn='1' then
  73. state<=next_state;
  74. end if;
  75.  
  76. end process;
  77. -- process (clk_out)
  78. -- begin
  79. -- if clk_out'event and clk_out='1' then
  80. -- state<=next_state;
  81. -- end if;
  82. -- end process;
  83.  
  84. NS: Process(Data_In, state)
  85. begin
  86. -- if Clk_Btn'event and Clk_Btn='1' then
  87. case state is
  88. when S0=>
  89. if Data_In='1' then
  90. next_state<=S1;
  91. else
  92. next_state<=S0;
  93. led6_r<='0';
  94. end if;
  95. led<="0000";
  96. when S1=>
  97. if Data_In='1' then
  98. next_state<=S2;
  99. else
  100. next_state<=S0;
  101. end if;
  102. led<="0001";
  103. when S2=>
  104. if Data_In='0' then
  105. next_state<=S3;
  106. else
  107. next_state<=S0;
  108. end if;
  109. led<="0010";
  110. when S3=>
  111. if Data_In='1' then
  112. next_state<=S4;
  113. else
  114. next_state<=S0;
  115. end if;
  116. led<="0011";
  117. when S4=>
  118. led6_r<='1';
  119. led<="0100";
  120. next_state<=S2;
  121. when others=>
  122. next_state<=S0;
  123. end case;
  124. -- end if;
  125. end process;
  126.  
  127. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement