EDA课程设计:八路彩灯控制器_eda八路彩灯课程设计
EDA课程设计:八路彩灯控制器由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“eda八路彩灯课程设计”。
EDA课程设计
设计题目:基于VHDL的8路彩灯控制器设计
一、课程设计的目的1.熟悉QuartusⅡ软件的使用方法,使用VHDL 文本输入设计法进行任务设计。2.增强自己实际动手能力,独立解决问题的能力。3.通过课程设计对所学的知识进行更新及巩固.二、课程设计的基本要求
本次课程设计是设计一个8路彩灯控制器,能够控制8路彩灯按照两种节拍,三种花型循环变化。设计完成后,通过仿真验证与设计要求进行对比,检验设计是否正确。
三、课程设计的内容
编写硬件描述语言VHDL程序,设计一个两种节拍、三种花型循环变化的8路彩灯控制器,两种节拍分别为0.25s和0.5s。三种花型分别是:
(1)8路彩灯分成两半,从左至右顺次渐渐点亮,全亮后则全灭。(2)从中间到两边对称地渐渐点亮,全亮后仍由中间向两边逐次熄灭。(3)8路彩灯从左至右按次序依次点亮,全亮后逆次序依次熄灭。
四、实验环境
PC机一台;软件QuartusⅡ6.0
五、课程设计具体步骤及仿真结果
1、系统总体设计框架结构
分频模块:把时钟脉冲二分频,得到另一个时钟脉冲,让这两种时钟脉冲来交替控制花型的速度。
二选一模块:选择两种频率中的一个控制彩灯的花型。
8路彩灯的三种花型控制模块:整个系统的枢纽,显示彩灯亮的情况。
2、系统硬件单元电路设计
1.分频模块设计 实验程序:library ieee;use ieee.std_logic_1164.all;entity fenpin2 is
port(clk:in std_logic;
clkk:out std_logic);end fenpin2;architecture behav of fenpin2 is begin
proce(clk)
variable clkk1:std_logic:='0';
begin
if clk'event and clk='1' then
clkk1:= not clkk1;
end if;
clkk
end proce;end behav;RTL电路图:
波形图:
2.二选一模块设计 实验程序:library ieee;use ieee.std_logic_1164.all;entity mux21 is port(a,b,s:in std_logic;
y:out std_logic);end mux21;architecture behave of mux21 is begin proce(a,b,s)begin if s='0' then y
波形图:
3.8路彩灯的三种花型控制模块设计 程序: library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity color8 is port(clk,rst :in std_logic;
q:out std_logic_vector(7 downto 0));end;architecture a of color8 is signal s:std_logic_vector(4 downto 0);begin proce(s,clk)begin if rst='1' then s
sqqqq
when “00100”=>qqqqqqqqqqqqqqqqqqqqqqqqqqnull;end case;end if;end proce;end;
RTL电路图:
波形图:
4.综合程序 library ieee;use ieee.std_logic_1164.all;entity fenpin2 is
port(clk:in std_logic;
clkk:out std_logic);end fenpin2;architecture behav of fenpin2 is begin
proce(clk)
variable clkk1:std_logic:='0';
begin
if clk'event and clk='1' then
end if;
clkk
end proce;end behav;library ieee;use ieee.std_logic_1164.all;entity mux21 is port(a,b,s:in std_logic;
y:out std_logic);end mux21;architecture behave of mux21 is begin proce(a,b,s)begin if s='0' then y
clkk1:= not clkk1;
use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity color8 is port(clk,rst :in std_logic;
q:out std_logic_vector(7 downto 0));end;architecture a of color8 is signal s:std_logic_vector(4 downto 0);begin proce(s,clk)begin if rst='1' then s
sqqqqqqqqqqqq
when “01100”=>qqqqqqqqqqqqqqqqqqnull;end case;end if;end proce;end;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity balucaideng is port(clk,s,rst:in std_logic;q:out std_logic_vector(7 downto 0));end;architecture one of balucaideng is
signal h0,h1:std_logic;component fenpin2
port(clk:in std_logic;
clkk:out std_logic);end component;component mux21 port(a,b,s:in std_logic;
y:out std_logic);end component;component color8 port(clk,rst :in std_logic;
q:out std_logic_vector(7 downto 0));end component;begin u1: fenpin2 port map(clk=>clk,clkk=>h0);u2: mux21 port map(a=>h0,b=>clk,s=>s;y=>h1);u3: color8 port map(clk=>h1,rst=>rst,q=>q);end;波形图:
六、实验总结