Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 10:11:18 11/26/2014
  6. -- Design Name:
  7. -- Module Name: pierewsze - 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. library IEEE;
  21. use IEEE.STD_LOGIC_1164.ALL;
  22.  
  23. -- Uncomment the following library declaration if using
  24. -- arithmetic functions with Signed or Unsigned values
  25. --use IEEE.NUMERIC_STD.ALL;
  26.  
  27. -- Uncomment the following library declaration if instantiating
  28. -- any Xilinx primitives in this code.
  29. --library UNISIM;
  30. --use UNISIM.VComponents.all;
  31.  
  32. entity pierewsze is
  33. Port ( Q : out STD_LOGIC_VECTOR (2 downto 0);
  34. DIR : in STD_LOGIC;
  35. CE : in STD_LOGIC;
  36. CLK : in STD_LOGIC;
  37. Clr : in STD_LOGIC);
  38. end pierewsze;
  39.  
  40. architecture Behavioral of pierewsze is
  41. SIGNAL T: STD_LOGIC_VECTOR(2 downto 0);
  42. SIGNAL q1: STD_LOGIC_VECTOR(2 downto 0);
  43. SIGNAL pom: STD_LOGIC_VECTOR(3 downto 0);
  44. begin
  45.  
  46. pom <= DIR & q1;
  47.  
  48. with pom select
  49. T <= "001" when "1000",
  50. "110" when "1001",
  51. "010" when "1110",
  52. "011" when "1010",
  53. "100" when "1011",
  54. "101" when "1100",
  55. "111" when "1101",
  56. "000" when "1111",
  57.  
  58. "111" when "0000",
  59. "101" when "0111",
  60. "100" when "0101",
  61. "011" when "0100",
  62. "010" when "0011",
  63. "110" when "0010",
  64. "001" when "0110",
  65. "000" when "0001",
  66. "110" when others;
  67.  
  68. process( CLK, Clr )
  69. begin
  70. if Clr = '1' then
  71. q1(2) <= '0';
  72. elsif rising_edge( CLK ) then
  73. if CE = '1' then
  74. q1(2) <= T(2);
  75. end if;
  76. end if;
  77. end process;
  78.  
  79.  
  80. process( CLK, Clr )
  81. begin
  82. if Clr = '1' then
  83. q1(1) <= '0';
  84. elsif rising_edge( CLK ) then
  85. if CE = '1' then
  86. q1(1) <= T(1);
  87. end if;
  88. end if;
  89. end process;
  90.  
  91.  
  92. process( CLK, Clr )
  93. begin
  94. if Clr = '1' then
  95. q1(0) <= '0';
  96. elsif rising_edge( CLK ) then
  97. if CE = '1' then
  98. q1(0) <= T(0);
  99. end if;
  100. end if;
  101. end process;
  102.  
  103. Q <= q1;
  104.  
  105. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement