VHDL程序如下:
libraryieee;
use ieee.s td_logic_1164.all;
use ieee.s td_logic_arith.all;
use ieee.s td_logic_uns igned.all;
entityledis
port (clk1,clk2,reset: ins td_logic;
led_s: out s td_logic_vector(2downto0);
memcs,rd,wr,cs0809,selmled:out s td_logic;
a: out s td_logic_vector(15downto0);
ad: out s td_logic_vector(7downto0));
end;
architecture led_archofledis
s ignalcol:integerrange 0to7;
s ignalpage :integerrange 0to15;
s ignaloe:s td_logic;
begin
proces s(clk2,reset,col)
begin
ifreset='1' then
col<=0;
els if(clk2'event andclk2='1')then
col<=col+1;
endif;
led_s <= conv_s td_logic_vector(col,3);
a(2downto0)<=conv_s td_logic_vector(col,3);
endproces s;
proces s(clk1,page)
begin
if(clk1'event andclk1='1')then
page<=page+1;
endif;
a(6downto3)<=conv_s td_logic_vector(page,4);
endproces s;
ad<= "ZZZZZZZZ";oe <= '0';
memcs <= '0';rd<= '0';
wr<= '1';selmled<='1';cs0809<= '1';
a(15downto7)<="100000000";
endled_arch;