-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvgabuffer.vhd
More file actions
65 lines (52 loc) · 1.46 KB
/
vgabuffer.vhd
File metadata and controls
65 lines (52 loc) · 1.46 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY vgabuffer IS
GENERIC(
DEPTH : INTEGER := 1
);
PORT (
clk_in : IN STD_LOGIC;
frame_ready : in STD_LOGIC;
frame_sync : IN STD_LOGIC;
clk_out : IN STD_LOGIC;
srl_in : IN STD_LOGIC_VECTOR(3*DEPTH - 1 DOWNTO 0);
srl_out : OUT STD_LOGIC_VECTOR(3*DEPTH - 1 DOWNTO 0)
);
END vgabuffer;
ARCHITECTURE behavioral OF vgabuffer IS
SIGNAL buffer_in : STD_LOGIC_VECTOR(3*DEPTH*640*480 - 1 DOWNTO 0);
SIGNAL frame : STD_LOGIC_VECTOR(3*DEPTH*640*480 - 1 DOWNTO 0);
SIGNAL buffer_out : STD_LOGIC_VECTOR(3*DEPTH*640*480 - 1 DOWNTO 0);
BEGIN
PROCESS(clk_in)
BEGIN
IF RISING_EDGE(clk_in) THEN
--shift data in
buffer_in(3*DEPTH*640*480 - 1 DOWNTO 3*DEPTH) <= buffer_in(3*DEPTH*640*480 - 3*DEPTH - 1 DOWNTO 0);
buffer_in(3*DEPTH - 1 DOWNTO 0) <= srl_in;
END IF;
END PROCESS;
PROCESS (frame_ready)
BEGIN
IF RISING_EDGE(frame_ready) THEN
frame <= buffer_in;
END IF;
END PROCESS;
PROCESS (frame_sync)
BEGIN
IF RISING_EDGE(frame_sync) THEN
buffer_out <= frame;
END IF;
END PROCESS;
PROCESS(clk_out)
BEGIN
IF RISING_EDGE(clk_out) THEN
--shift data out
buffer_out(3*DEPTH*640*480 - 1 DOWNTO 3*DEPTH) <= buffer_in(3*DEPTH*640*480 - 3*DEPTH - 1 DOWNTO 0);
END IF;
END PROCESS;
srl_out <= buffer_out(3*DEPTH*640*480 - 1 DOWNTO 3*DEPTH*640*480 - 3*DEPTH - 1);
END architecture;