名称:基于FPGA的交通灯设计Verilog代码ISE仿真
软件:ISE
语言:Verilog
代码功能:要求是PPT上技术指标的基础指标
FPGA代码Verilog/VHDL代码资源下载:www.hdlcode.com
演示视频:
设计文档:
1. 工程文件
2. 程序文件
3. 程序编译
4. RTL图
5. Testbench
6. 仿真图
整体仿真图
分频模块
控制模块
倒计时模块
显示模块
部分代码展示:
/* 红->绿 绿->黄 黄->红 1、红--计时main_red_times------------------------绿--计时main_green_times---main_yellow_times黄灯---------------红 2、绿--计时branch_green_times---branch_yellow_times黄灯--------------------红--计时branch_reg_times-------------------绿 */ //东西为支路 //南北为主路 module traffic_light( input clk,//时钟 input night_key,//夜间按键 input main_g_add,//主路绿灯加 input main_g_sub,//主路绿灯减 input branch_g_add,//支路绿灯加 input branch_g_sub,//支路绿灯减 input main_y_add,//主路黄灯加 input main_y_sub,//主路黄灯减 input branch_y_add,//支路黄灯加 input branch_y_sub,//支路黄灯减 //led 1亮0灭 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 0亮1灭 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 ;//支路灯 //定义路口个灯持续时间,修改此处时间 //主路绿灯+主路黄灯=支路红灯时间 //支路绿灯+支路黄灯=主路红灯时间 wire [7:0]main_green_time; wire [7:0]main_yellow_time; wire [7:0]branch_green_time; wire [7:0]branch_yellow_time;
点击链接获取代码文件:http://www.hdlcode.com/index.php?m=home&c=View&a=index&aid=829
阅读全文
461