Advertisement
Guest User

Untitled

a guest
May 24th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. library IEEE ;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3. entity spec_register is
  4. port (
  5. clk , rst : in std_logic ;
  6. A0 , A1 : in std_logic ;
  7. Data : in std_logic_vector (7 downto 0);
  8. Q : out std_logic_vector (7 downto 0)
  9. );
  10. end spec_register ;
  11. architecture beh of spec_register is
  12. signal Qreg : std_logic_vector (7 downto 0);
  13. begin
  14. Q <= Qreg ;
  15. process (clk , rst)
  16. begin
  17. if rst = '0' then
  18. Qreg <= "00000000";
  19. elsif clk ' event and clk = '1' then
  20. if A0 = '0' and A1 = '0' then
  21. Qreg <= Data ;
  22. elsif A0 = '0' and A1 = '1' then
  23. Qreg <= Qreg (7 downto 0) & "00";
  24. elsif A0 = '1' and A1 = '0' then
  25. Qreg <= Qreg (0) & Qreg (4 downto 1);
  26. elsif A0 = '1' and A1 = '1' then
  27. Qreg <= Qreg (7) & "0" & Qreg (6 downto 0);
  28. end if;
  29. end if;
  30. end process ;
  31. end beh ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement