EDA课设new

上传人:bao****ty 文档编号:149761699 上传时间:2020-10-29 格式:DOCX 页数:7 大小:117.93KB
返回 下载 相关 举报
EDA课设new_第1页
第1页 / 共7页
EDA课设new_第2页
第2页 / 共7页
EDA课设new_第3页
第3页 / 共7页
EDA课设new_第4页
第4页 / 共7页
EDA课设new_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《EDA课设new》由会员分享,可在线阅读,更多相关《EDA课设new(7页珍藏版)》请在金锄头文库上搜索。

1、交通信号控制器的VHDL设计 班 级:电子信息工程学 号:姓 名: 一、设计任务模拟十字路口交通信号灯的工作过程,利用实验板上的两组红、黄、绿LED作为交通信号灯,设计一个交通信号灯控制器。要求:(1) 交通灯从绿变红时,有4秒黄灯亮的间隔时间;(2) 交通灯红变绿是直接进行的,没有间隔时间;(3) 主干道上的绿灯时间为40秒,支干道的绿灯时间为20秒;(4) 在任意时间,显示每个状态到该状态结束所需的时间。 ABCD主干道交通灯绿(40秒)黄(4秒)红(20秒)红(4秒)支干道交通灯红红绿黄表1 交通信号灯的4种状态二、设计目的学习EDA软件和QuartusII的使用方法,熟悉可编程逻辑器件

2、的使用。通过制作来了解交通灯控制系统,交通灯控制系统主要是实现城市十字交叉路口红绿灯的控制,设计交通灯控制系统主要是为了实现城市十字交叉路口红绿灯的控制。通过掌握VHDL程序设计的实现,熟悉可编程逻辑器件的使用。同时加深对交通灯控制系统的了解与应用。三、设计方案采用VHDL语言输入的方式实现交通信号灯控制器秒脉冲信号发生器(进程P1和P2)状态寄存器(进程P6)计数器(进程P3、P4和P5)CLK 时间显示数据输出 次态发生器信号灯输出信号(进程P7) 信号灯输出 图3 交通信号灯控制器程序原理框图 该程序由7个进程组成,进程P1和P2将CLK信号分频后产生1秒信号,进程P3、P4、P5构成两

3、个带有预置数功能的十进制计数器,其中P4产生允许十位计数器计数的控制信号。进程P6实现状态转换和产生状态转换的控制信号,进程P7产生次态信号和信号灯输出信号,以及每一个状态的时间值。四、程序清单library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity traffic is port (clk,reset,yj:in std_logic; led1h,led1l,led2h,led2l:out std_logic_vector(3downto 0); light:out std_logic_ve

4、ctor(5 downto 0); end; architecture one of traffic istype fsm_st is (a,b,c,d); signal current_state,next_state:fsm_st; signal l1h,l1l,l2h,l2l: integer range 0 to 9; signal t1,t2,time:integer range 0 to 70;beginp1: process(clk,reset,yj) begin if reset=1then time=0;current_state=a; elsif yj=0 and (clk

5、=1 and clkevent )then if time=66 then time=time+1; else time =0; end if; current_state=next_state; end if; end process;p2: process (current_state, time,yj) beginif yj=1then lightlight=001100;t1=39-time; if time=39 then next_state=b; else next_statelight=010100;t1=43-time; if time=43 then next_state=

6、c; else next_statelight=100001;t1=67-time; if time=63 then next_state=d; else next_statelight=100010;t1=67-time; if time=67 then next_state=a;else next_state=d; end if; end case; end if;end process;p3: process (current_state ) beginif current_state = a thent2 = t1 + 4;elsif current_state = b thent2

7、= t1;elsif current_state = c thent2 = t1 - 4;elsif current_state = d thent2 = t1;end if; end process;p4: process (t1,t2)begin l1h=t1/10;l1l=t1 rem 10;l2h=t2/10;l2l=t2 rem 10;end process;p5: process (l1h,l1l) beginif l1h=0 then led1h=0000;elsif l1h=1 then led1h=0001;elsif l1h=2 then led1h=0010;elsif

8、l1h=3 then led1h=0011;else null;end if;if l1l=0 then led1l=0000;elsif l1l=1 then led1l=0001;elsif l1l=2 then led1l=0010;elsif l1l=3 then led1l=0011;elsif l1l=4 then led1l=0100;elsif l1l=5 then led1l=0101;elsif l1l=6 then led1l=0110;elsif l1l=7 then led1l=0111;elsif l1l=8 then led1l=1000;elsif l1l=9

9、then led1l=1001;else null;end if;end process;p6: process (l2h,l2l) beginif l2h=0 then led2h=0000;elsif l2h=1 then led2h=0001;elsif l2h=2 then led2h=0010;elsif l2h=3 then led2h=0011;elsif l2h=4 then led2h=0100;else null;end if;if l2l=0 then led2l=0000;elsif l2l=1 then led2l=0001;elsif l2l=2 then led2

10、l=0010;elsif l2l=3 then led2l=0011;elsif l2l=4 then led2l=0100;elsif l2l=5 then led2l=0101;elsif l2l=6 then led2l=0110;elsif l2l=7 then led2l=0111;elsif l2l=8 then led2l=1000;elsif l2l=9 then led2l=1001;else null;end if;end process;end;五、时序仿真显示模块软件时序仿真结果如下:图4 显示模块软件仿真结果六、引脚设置根据电路模式5进行引脚选择图5 引脚设置图七、总

11、结与体会本设计基于VHDL 硬件描述语言,利用FPGA 器件作为主要芯片。在编程过程中充分利用了计数状态所对应的信息,实现了模拟十字路口交通灯的运行状态控制。仿真分析和实践证明,本系统设计是成功的和符合实际的。同时增加了人机交互方面的一些控制信号,则可以实现用户的手工调整交通灯的运行。本次课程设计让我对VHDL语言的使用又有了新的认识,学会了很多解决错误的方法,让我对EDA技术有了进一步的认识,对其产生了更大的兴趣。同时此设计也让我知道仅仅理论知识是不够的,需要学会理论联系实际才能真正掌握所学知识,通过课程设计,能够对所学的知识有进一步的了解,并能掌握学习理论时没有注意的细节。在实际工作中,只要有一个环节没有做好,整个体系都不能正常运行。调试程序,排除故障有助于提高分析问题,解决问题的能力。课程设计中碰到的挫折,有助于养成良好的学习习惯,严谨的工作作风。

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 高等教育 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号