资源描述
1、显示控制
-- Module Name: DispCtrl - Behavioral
-- Description: Generates the immage for the VGA Demo
--------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity DispCtrl is
Port (clk25MHz : in std_logic;
Hcnt: in std_logic_vector(9 downto 0); -- horizontal counter
Vcnt: in std_logic_vector(9 downto 0); -- verical counter
romdatain : in std_logic_vector(7 downto 0); -- vvvvvvvvvvvvvvvvvvv
outRed : out std_logic_vector(2 downto 0); -- final color
outGreen: out std_logic_vector(2 downto 0); -- outputs
outBlue : out std_logic_vector(1 downto 0);
adrVideoMem : out std_logic_vector(3 downto 0));
-- addr in the Logo immage
end DispCtrl;
architecture Behavioral of DispCtrl is
-- constants for Synchro module
constant PAL:integer:=640; --Pixels/Active Line (pixels)
constant LAF:integer:=480; --Lines/Active Frame (lines)
-- constants for VGA Demo
constant HBorder:integer:=40; -- Horizontal border (pixels)
constant VBorder:integer:=40; -- Vertical border (lines)
constant Hsize:integer:=7; -- Horizontal logo size (pixels) 标志的水平尺寸 64
constant Vsize:integer:=11; -- Vertical logo size (pixels) 标志的垂直尺寸 64
signal Horigin:integer:=60; -- Horizontal logo origin (pixels) 标志的水平原点
signal Vorigin:integer:=60; -- Vertical logo origin (pixels) 标志的垂直原点
signal adrVideoPixel: std_logic_vector(2 downto 0);
signal adrVideoLine: std_logic_vector(3 downto 0);
signal cntDyn: integer range 0 to 2**28-1; -- dynamic effect counter
signal intHcnt: integer range 0 to 800-1; --PLD-1 - horizontal counter--- 水平计数器
signal intVcnt: integer range 0 to 521-1; -- LFD-1 - verical counter --- 垂直计数器
begin
-- mapping the std_logic_vector ports to internal integers
intHcnt <= conv_integer(Hcnt);
intVcnt <= conv_integer(Vcnt);
adrVideoPixel <= conv_std_logic_vector(intHcnt - Horigin,4);
adrVideoLine <= conv_std_logic_vector(intVcnt - Vorigin,4);
adrVideoMem <= adrVideoLine;
-- counter for color bar dynamics
diynamic:process (clk25MHz)
begin
if clk25MHz'event and clk25MHz = '1' then
cntDyn <= cntDyn+1;
end if;
end process;
mixer: process(clk25MHz,intHcnt, intVcnt)
begin
if intHcnt < PAL and intVcnt < LAF then -- 在激活的显示区域
if intHcnt >= Horigin and intHcnt <= Horigin + Hsize and
intVcnt >= Vorigin and intVcnt <= Vorigin + Vsize
then -- image --rom中的数据输出作为色差的信息;
if romdatain(adrVideoPixel)='0' then
outRed<="100";
outGreen<="100";
outBlue(1 downto 0) <="01";
else -- the moving lines area
-- red
outRed(2 downto 0) <="000";
-- green
outGreen(2 downto 0) <="000";
-- blue
outBlue(1 downto 0) <="00";
end if;
else
outRed <= (others => '0');
outGreen <= (others => '0');
outBlue <= (others => '0');
end if;
end if;
end process;
-- place the logo at the mouse pos, if left button pressed
end Behavioral;
2 、PS接口定义
见附件中Keyctrl.vhd和Ps2keyboard.vhd
3、状态灯指示字母输入
见附件中SnakeledDemo.vhd
展开阅读全文