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

VGA显示彩色条纹Basys3开发板verilog代码

05/01 10:14
969
加入交流群
扫码加入
获取工程师必备礼包
参与热点资讯讨论

名称:VGA显示彩色条纹Basys3开发板verilog代码(代码在文末下载)

软件:VIVADO

语言:Verilog

代码功能:

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

本代码已在Basys3开发板验证,开发板如下,其他开发板可以修改管脚适配:

basys3开发板.png

工程文件

d56aa481-0ca5-4849-8b8d-56f02578712e.png

程序文件

aa5da2c0-609f-4e8a-b440-2c788b9dfeec.png

RTL图

d59c608e-763d-4e04-9049-155d1c9f68b5.png

程序编译

37bbb4f8-9882-497d-bd2b-b5b1c33eecf2.png

管脚分配

67b4ef7a-09e4-4db5-94c9-0cc306eb7cae.png

部分代码展示:

//彩色条纹控制模块
module?imageGenerator?(
inputi_clk,
input[10:0]i_x,
input[9:0]i_y,
output[3:0]o_blue,
output[3:0]o_green,
output[3:0]o_red
);
localparam?display_x?=?640;
localparam?display_y?=?480;
reg?[3:0]?blue=?4'h0;
reg?[3:0]?red=?4'h0;
reg?[3:0]?green=?4'h0;
//将3种颜色进行排列组合
always?@(posedge?i_clk?)?begin
if?(i_x?<?display_x/8)?begin//白色--1/8
blue??<=?4'h0;//蓝色
green?<=?4'h0;//绿色
red?<=?4'h0;//红色
end?else?if?(?display_x/8?<=?i_x?&&?i_x?<=?display_x/4?)begin//?1/8~2/8
blue??<=?4'h0;
????????green???<=?4'h0;
????????red?????<=?4'hf;
end?else?if?(?display_x/4?<=?i_x?&&?i_x?<=?3*display_x/8?)begin//?2/8~3/8
????????blue????<=?4'h0;
????????green???<=?4'hf;
????????red?????<=?4'h0;
end?else?if?(?3*display_x/8?<=?i_x?&&?i_x?<=?display_x/2?)begin//?3/8~4/8
????????blue????<=?4'h0;
????????green???<=?4'hf;
????????red?????<=?4'hf;
end?else?if?(?display_x/2?<=?i_x?&&?i_x?<=?5*display_x/8?)begin//?4/8~5/8
????????blue????<=?4'hf;
????????green???<=?4'h0;
????????red?????<=?4'h0;
end?else?if?(?5*display_x/8?<=?i_x?&&?i_x?<=?6*display_x/8?)begin//?5/8~6/8
????????blue????<=?4'hf;
????????green???<=?4'h0;
????????red?????<=?4'hf;
end?else?if?(?6*display_x/8?<=?i_x?&&?i_x?<=?7*display_x/8)begin//?6/8~7/8
blue??<=?4'hf;
green?<=?4'hf;
red?<=?4'h0;
end?else?begin//?7/8~8/8
blue??<=?4'hf;
green?<=?4'hf;
red?<=?4'hf;
end
end
assign?o_blue=?blue;
assign?o_red=?red;
assign?o_green=?green;
endmodule

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

相关推荐