Advertisement
Guest User

Untitled

a guest
May 16th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.99 KB | None | 0 0
  1. LIBRARY ieee;
  2. USE ieee.std_logic_1164.all;
  3. USE ieee.std_logic_unsigned.all;
  4. -----------------------------------------------
  5. entity spec_register is
  6.     port (clk, rst : in std_logic;
  7.         A0, A1 : in std_logic;
  8.         Data : in std_logic_vector(6 downto 0);
  9.         Q : out std_logic_vector(6 downto 0));
  10. end spec_register;
  11. -----------------------------------------------
  12. architecture beh of spec_register is
  13.     signal Qreg : std_logic_vector(6 downto 0);
  14.     ----------------------------------------------------------
  15. begin
  16.     Q <= Qreg;
  17.     process (clk)
  18.     begin
  19.         if (clk'event and clk = '1') then
  20.             if (rst='0') THEN
  21.                 Qreg <= "0000000";
  22.                
  23.             elsif A0 = '0' and A1 = '1' then --LR1
  24.                 Qreg <= '0' & Qreg(6 downto 1);
  25.             elsif A0 = '1' and A1 = '0' then --CR1
  26.                 Qreg <= Qreg(0) & Qreg(6 downto 1);
  27.             elsif A0 = '1' and A1 = '1' then --AL2
  28.                 Qreg <= Qreg(6) & Qreg(3 downto 0) & "00";
  29.             elsif A0 = '0' and A1 = '0' then --saugojimas
  30.                 Qreg <= Data;
  31.             end if;
  32.         end if;
  33.     end process;
  34. end beh;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement