📄 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 + -