|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY disp IS
PORT(clk:IN STD_LOGIC;
clka:IN STD_LOGIC;
addr:INOUT STD_LOGIC_VECTOR(2 DOWNTO 0);
data:OUT STD_LOGIC_VECTOR(7 DOWNTO 0));
END;
ARCHITECTURE disp_arch OF disp IS
TYPE romtable IS ARRAY (0 TO 7) OF STD_LOGIC_VECTOR(7 DOWNTO 0);
CONSTANT roma:romtable:=romtable'(
"11101111",
"00000001",
"01101101",
"00000001",
"01101101",
"00000001",
"11101111",
"11100001");
CONSTANT romb:romtable:=romtable'(
"00000000",
"11111101",
"11111011",
"00000000",
"11110111",
"11110111",
"11110111",
"11100111");
SIGNAL q: STD_LOGIC_VECTOR(3 DOWNTO 0);
BEGIN
P1ROCESS(clka)
BEGIN
IF rising_edge(clka)THEN
q<=q+'1';
END IF;
END PROCESS P1;
P2ROCESS(clk)
BEGIN
IF rising_edge(clk)THEN
addr<=addr+'1';
END IF;
END PROCESS P2;
P3ROCESS(addr)
BEGIN
IF q(3)='1' THEN
data<=roma(addr);
ELSE
data<=romb(addr);
END IF;
END PROCESS P3;
END disp_arch; |
|