-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathline_buffer.vhd
More file actions
33 lines (29 loc) · 943 Bytes
/
Copy pathline_buffer.vhd
File metadata and controls
33 lines (29 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
-- SHIFT REGISTER THAT STORES A LINE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity line_buffer is
Generic (N: integer := 4);
Port ( A : in STD_LOGIC_VECTOR (7 downto 0);
clk,rst : in STD_LOGIC;
Y : out STD_LOGIC_VECTOR (7 downto 0));
end line_buffer;
architecture Behavioral of line_buffer is
signal sr : std_logic_vector(N*8-1 downto 0) := (Others => '0');
begin
process (clk,rst)
begin
if (rst = '1') then
Y <= "00000000";
elsif (clk'event and clk = '1') then
sr <= sr(sr'high - 8 downto sr'low) & A;
Y <= sr(sr'high downto sr'high-7);
end if;
end process;
end Behavioral;