-
Notifications
You must be signed in to change notification settings - Fork 0
/
LCDRegDE2_115.vhd
59 lines (45 loc) · 1.55 KB
/
LCDRegDE2_115.vhd
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
-------------------------------------------------------------
-- CTU-FFE Prague, Dept. of Control Eng. [Richard Susta]
-- Published under GNU General Public License
-------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use work.VGApackage.all;
entity LCDRegDE2_115 is
port (
R,G,B : IN vga_byte; -- input colors
LCD_CLK_in, LCD_DEN_in : in std_logic; -- inputs of LCD controller signals
ACLRN_in : IN std_logic; -- input of Asynchronous clear negative
LCD_R, LCD_G, LCD_B : OUT std_logic_vector(5 downto 0); -- output 6-bit colors
LCD_CLK, LCD_DEN, LCD_DIM : OUT std_logic
-- signals fro LCD controller, pixel-clock, data-enable, dim = backlight on
);
end LCDRegDE2_115;
architecture driver of LCDRegDE2_115 is
signal pllreset : std_logic;
-- used only for the conversion of 8-bit colors to 6-bit colors
subtype RC is std_logic_vector(vga_byte'LEFT downto (vga_byte'LEFT-LCD_R'LENGTH+1));
constant ZERO : std_logic_vector(LCD_R'RANGE) := (others=>'0');
begin
LCD_CLK <= LCD_CLK_in;
process(LCD_CLK_in, ACLRN_in)
begin
if ACLRN_in='0' then
LCD_DEN<='0'; LCD_R <= ZERO; LCD_G <= ZERO; LCD_B <= ZERO;
LCD_DIM<='0';
elsif (falling_edge(LCD_CLK_in)) then
LCD_DIM <= '1'; -- backlight ON
if LCD_DEN_in='1' then -- data enable
LCD_R <= R(RC'Range);
LCD_G <= G(RC'Range);
LCD_B <= B(RC'Range);
else
LCD_R <= ZERO;
LCD_G <= ZERO;
LCD_B <= ZERO;
end if;
LCD_DEN <= LCD_DEN_in;
end if;
end process;
end architecture driver;