?? extension.vhd
字號:
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
ENTITY extension IS
PORT (
arm_data : inout std_logic_vector(7 downto 0);
cpu_addr : in std_logic_vector(15 downto 0);
cpu_read : in std_logic;
cpu_writ : in std_logic;
cpu_cs : in std_logic;
cpld_rst : in std_logic;
key_in : in std_logic_vector(7 downto 0);
key_led : out std_logic;
lcd_light: out std_logic;
lcd_e : out std_logic;
lcd_rw : out std_logic;
lcd_rs : out std_logic;
lcd_db : out std_logic_vector(3 downto 0)
);
END extension;
ARCHITECTURE maxpld OF extension IS
signal lcd_temp : std_logic;
BEGIN
arm_data <= key_in when cpu_addr="0001000000000001" and cpu_read = '0' and cpu_cs = '0'
else--鍵碼,地址:0x1001
"ZZZZZZZZ";
lcd_light<=lcd_temp;
process(cpld_rst, cpu_writ)--lcd控制信號lcd_e,地址:0x1002
begin
if cpld_rst = '1' then
lcd_e <= '0';
elsif cpu_writ'event and cpu_writ = '1' then
if cpu_addr="0001000000000010" and cpu_cs = '0' then
lcd_e <= arm_data(0);
end if;
end if;
end process;
process(cpld_rst, cpu_writ)--lcd控制信號lcd_rw,地址:0x1003
begin
if cpld_rst = '1' then
lcd_rw <= '0';
elsif cpu_writ'event and cpu_writ = '1' then
if cpu_addr="0001000000000011" and cpu_cs = '0' then
lcd_rw <= arm_data(0);
end if;
end if;
end process;
process(cpld_rst, cpu_writ)--lcd控制信號lcd_rs,地址:0x1004
begin
if cpld_rst = '1' then
lcd_rs <= '0';
elsif cpu_writ'event and cpu_writ = '1' then
if cpu_addr="0001000000000100" and cpu_cs = '0' then
lcd_rs <= arm_data(0);
end if;
end if;
end process;
process(cpld_rst, cpu_writ)--lcd數據信號,地址:0x1005
begin
if cpld_rst = '1' then
lcd_db(3 downto 0) <= "0000";
elsif cpu_writ'event and cpu_writ = '1' then
if cpu_addr="0001000000000101" and cpu_cs = '0' then
lcd_db(3 downto 0) <= arm_data(7 downto 4);
end if;
end if;
end process;
process(cpld_rst, cpu_writ)--lcd背光信號,地址:0x1006
begin
if cpld_rst = '1' then
lcd_temp <= '1';
elsif cpu_writ'event and cpu_writ = '1' then
if cpu_addr="0001000000000110" and cpu_cs = '0' then
lcd_temp <= arm_data(0);
end if;
end if;
end process;
process(cpld_rst, cpu_writ)--key報警燈,地址:0x1007
begin
if cpld_rst = '1' then
key_led <= '0';
elsif cpu_writ'event and cpu_writ = '1' then
if cpu_addr="0001000000000111" and cpu_cs = '0' then
key_led <= arm_data(0);
end if;
end if;
end process;
END maxpld;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -