名称:交通灯控制器设计Verilog代码VIVADO仿真
软件:VIVADO
语言:Verilog
代码功能:
交通灯控制器设计
要求实现功能如下:①假设一个十字路口南北方向和东西方向的交通灯按照红灯x秒、绿灯x秒、黄灯y秒轮流点亮;②红灯、黄灯、绿灯的亮灭时间诵过7段数码管正确显示。
FPGA代码Verilog/VHDL代码资源下载:www.hdlcode.com
演示视频:
设计文档:
1. 工程文件
2. 程序文件
3. 程序编译
4. RTL图
5. Testbench
6. 仿真图
整体仿真图
分频模块
1KHZ分频产生1Hz信号
计数模块
锁存模块
译码模块
部分代码展示:
//交通灯 module traffic_light( input clk,//1KHz input reset,//复位---- //led output main_red,//主路灯 output main_green,//主路灯-- output main_yellow,//主路灯-- output branch_red,//支路灯-- output branch_green,//支路灯-- output branch_yellow,//支路灯-- output [3:0] weixuan,//数码管位选 output [7:0] duanxian//数码管段选 ); wire clk_1Hz; wire [7:0] main_green_BCD; wire [7:0] main_yellow_BCD; wire [7:0] main_red_BCD; wire [7:0] branch_green_BCD; wire [7:0] branch_yellow_BCD; wire [7:0] branch_red_BCD; wire [7:0] main_data_out; wire [7:0] branch_data_out; wire main_red_led;//主路灯 wire main_green_led;//主路灯 wire main_yellow_led;//主路灯 wire branch_red_led;//支路灯 wire branch_green_led;//支路灯 wire branch_yellow_led;//支路灯 //led assign main_red=main_red_led;//主路灯 assign main_green=main_green_led;//主路灯 assign main_yellow=main_yellow_led ;//主路灯 assign branch_red=branch_red_led;//支路灯 assign branch_green=branch_green_led;//支路灯 assign branch_yellow=branch_yellow_led ;//支路灯
点击链接获取代码文件:http://www.hdlcode.com/index.php?m=home&c=View&a=index&aid=890
阅读全文
420