EDA基于VHDL语言的花样彩灯控制器的设计.doc
文本预览下载声明
《EDA技术》课程实验报告
学生姓名: 所在班级: 指导教师: 记分及评价:
项目满分 10分 得 分
实验名称
实验8:花样彩灯控制器的设计
任务及要求
【基本部分】5分
1、在QuartusII平台上,采用文本输入设计方法,通过编写VHDL语言程序,设计一花样彩灯控制器,实现对实验箱8个LED发光二极管的显示控制,要求至少4种以上的花样。
2、实验箱上选择恰当的模式进行验证,目标芯片为ACEX1K系列EP1K30TC144-3。
【发挥部分】5分
实现不同的花样播放不同的背景音乐的功能。
实验程序
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity caideng is
port (clk:in std_logic;
q:out std_logic_vector(7 downto 0));
end;
architecture ART of caideng is
signal mode:std_logic_vector(2 downto 0);
signal mode1:std_logic_vector(2 downto 0);
begin
------------------------------------------------彩灯--------------------
process(clk,mode)
variable qs:std_logic_vector(7 downto 0);
begin
if rising_edge(clk) then
if mode1 = 7 then
mode = mode + 1;
end if;
-----------------------------------------------------从右到左连续点亮
if mode=0 then
if qs=0 then
qs:
elsif qsthen
qs:
else
qs(6 downto 0):=qs(7 downto 1);
end if;
-----------------------------------------------------从左到右连续点亮
elsif mode=1 then
if qs=0 then
qs:
elsif qsthen
qs:
else
qs(7 downto 1):=qs(6 downto 0);
end if;
-----------------------------------------------------从两边向中间连续点亮
elsif mode=2 then
if qs=0 then
qs:
elsif qsthen
qs:
else
qs(6 downto 4):=qs(7 downto 5);
qs(3 downto 1):=qs(2 downto 0);
end if;
------------------------------------------------------从中间向两边连续点亮
elsif mode=3 then
if qs=0 then
qs:
elsif qsthen
qs:
else
qs(7 downto 5):=qs(6 downto 4);
qs(2 downto 0):=qs(3 downto 1);
end if;
-----------------------------------------------------从右到左逐个点亮
elsif mode=4 then
if qs=0 then
qs:
elsif qsthen
qs:
else
qs(6 downto 0):=qs(7 downto 1);
qs(7):=0;
end if;
-------------------------------------------
显示全部