求VHDL跑马灯程序,要求:1从左到右亮2从右到左亮3两边向中间亮4中间向两边亮 。非常感谢 5
展开全部
library ieee;
use ieee.std_logic_1164.all;
entity paoma is
port(clk,reset:in std_logic;
output:out std_logic_vector(7 downto 0));
end entity;
architecture art of paoma is
begin
process(clk,reset)
variable data:std_logic_vector(7 downto 0);
begin
if reset='1' then
data:="00000000";
elsif clk'event and clk='1' then
if data="00000000" then
data:="00000001";
else data:=data(6 downto 0)&data(7);--右到左
(data:=data(0)&data(7 downto 1);)--左到右
end if;
end if;
output<=data;
end process;
end art;
library ieee;
use ieee.std_logic_1164.all;
entity paoma is
port(clk,reset:in std_logic;
output:out std_logic_vector(7 downto 0));
end entity;
architecture art of paoma is
begin
process(clk,reset)
variable data:std_logic_vector(7 downto 0);
begin
if reset='1' then
data:="00000000";
elsif clk'event and clk='1' then
if data="00000000" then
data:="00011000" ;中间到两边
(data:="10000001";)-两边到中间
else
data:="data(6 downto 4)&data(7)&data(0)&data(3 downto 0);-从中间到两边
(data:="data(4)&data(7 downto 5)&data(2 downto 0)&data(3);)从两边到中间
end if;
end fi;
output<=data;
end process;
end art;
use ieee.std_logic_1164.all;
entity paoma is
port(clk,reset:in std_logic;
output:out std_logic_vector(7 downto 0));
end entity;
architecture art of paoma is
begin
process(clk,reset)
variable data:std_logic_vector(7 downto 0);
begin
if reset='1' then
data:="00000000";
elsif clk'event and clk='1' then
if data="00000000" then
data:="00000001";
else data:=data(6 downto 0)&data(7);--右到左
(data:=data(0)&data(7 downto 1);)--左到右
end if;
end if;
output<=data;
end process;
end art;
library ieee;
use ieee.std_logic_1164.all;
entity paoma is
port(clk,reset:in std_logic;
output:out std_logic_vector(7 downto 0));
end entity;
architecture art of paoma is
begin
process(clk,reset)
variable data:std_logic_vector(7 downto 0);
begin
if reset='1' then
data:="00000000";
elsif clk'event and clk='1' then
if data="00000000" then
data:="00011000" ;中间到两边
(data:="10000001";)-两边到中间
else
data:="data(6 downto 4)&data(7)&data(0)&data(3 downto 0);-从中间到两边
(data:="data(4)&data(7 downto 5)&data(2 downto 0)&data(3);)从两边到中间
end if;
end fi;
output<=data;
end process;
end art;
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询