• 方案介绍
  • 附件下载
  • 相关推荐
申请入驻 产业图谱

交通灯(带左转)设计Verilog代码Quartus仿真

09/28 09:09
512
加入交流群
扫码加入
获取工程师必备礼包
参与热点资讯讨论

2-24102920413OK.doc

共1个文件

名称:交通灯(带左转)设计Verilog代码Quartus仿真

软件:Quartus

语言:Verilog

代码功能:

交通灯(带左转)

1、主路:red=20;green=12;left=68;yellow=5

2、支路:red=19;green=05;left=68;yellow=5

3、全局使能en=1时,控制交通灯开始变化

FPGA代码Verilog/VHDL代码资源下载:www.hdlcode.com

演示视频:

设计文档:

1. 工程文件

2. 程序文件

3. 程序编译

4. RTL图

5. Testebnch

6. 仿真图

整体仿真图

分频模块

A路红绿灯控制模块

B路红绿灯控制模块

显示模块

部分代码展示:

//顶层模块
module traffic(
input clk_in,//40M
input rst_p,//复位
input en,//全局使能en=1开始
//红绿灯
output A_red,
output A_green,
output A_left,
output A_yellow,
//红绿灯
output B_red,
output B_green,
output B_left,
output B_yellow,
//倒计时
output [7:0] HEX0,//数码管0
output [7:0] HEX1,//数码管1
output [7:0] HEX2,//数码管2
output [7:0] HEX3//数码管3
);
wire clk_1Hz;//1Hz
//倒计时
wire [7:0] A_downcnt;
wire [7:0] B_downcnt;
//分频模块
clk_div i_clk_div(
. clk_in(clk_in),//40M
. rst_p(rst_p),//复位
. clk_1Hz(clk_1Hz)
);
//A控制模块
A_led_ctrl i_A_led_ctrl(
. clk_in(clk_in),//40M
. rst_p(rst_p),//复位
. clk_1Hz(clk_1Hz),
. en(en),//全局使能en=1开始
//红绿灯
. red   (A_red   ),
. green (A_green ),
. left  (A_left  ),
. yellow(A_yellow),
//倒计时
. downcnt(A_downcnt)
);

点击链接获取代码文件:http://www.hdlcode.com/index.php?m=home&c=View&a=index&aid=1285

  • 2-24102920413OK.doc
    下载

相关推荐