Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.94 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4.  
  5. entity rej is
  6.  
  7. generic (N:integer:=8);
  8.  
  9. port
  10.  
  11. (
  12.   clk    : in  std_logic;
  13.   reset  : in  std_logic;
  14.   output : out std_logic_vector(11 downto 0);
  15.   result : in std_logic_vector(N-1 downto 0);
  16.   F : in std_logic_vector(3 downto 0)
  17.   );
  18. end rej;
  19.  
  20.  
  21. architecture Rejestr of rej is
  22.  
  23. signal slowo : std_logic_vector(11 downto 0);
  24. type reg is array(N-1 downto 0) of std_logic_vector(11 downto 0); -- reg jest tablica 8 slow
  25. signal licznik : integer range 0 to 7;
  26. signal tablica: reg;
  27.  
  28.  
  29. begin
  30.  
  31. slowo <= result & F;
  32.  
  33. process(clk,reset)
  34. begin
  35.   if (reset='1') then
  36.  
  37.     licznik <= 0;
  38.    
  39.    
  40.   elsif (clk'event and clk ='1') then
  41.    
  42.     if (licznik <7) then       
  43.     tablica(licznik) <= slowo;
  44.     licznik <= licznik + 1;
  45.    
  46.     else
  47.     licznik <= 0;
  48.     tablica(licznik) <= slowo;
  49.    
  50.     end if;
  51.  
  52.  
  53.   end if;
  54.  
  55.  output <= slowo;
  56.  
  57.  end process;
  58.  
  59.  
  60.  end Rejestr;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement