• 方案介紹
  • 相關(guān)推薦
申請入駐 產(chǎn)業(yè)圖譜

VGA顯示彩色條紋Basys3開發(fā)板verilog代碼

加入交流群
掃碼加入
獲取工程師必備禮包
參與熱點(diǎn)資訊討論

名稱:VGA顯示彩色條紋Basys3開發(fā)板verilog代碼(代碼在文末下載)

軟件:VIVADO

語言:Verilog

代碼功能:

FPGA代碼Verilog/VHDL代碼資源下載:www.hdlcode.com

本代碼已在Basys3開發(fā)板驗(yàn)證,開發(fā)板如下,其他開發(fā)板可以修改管腳適配:

basys3開發(fā)板.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種顏色進(jìn)行排列組合
always?@(posedge?i_clk?)?begin
if?(i_x?<?display_x/8)?begin//白色--1/8
blue??<=?4'h0;//藍(lán)色
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

點(diǎn)擊鏈接獲取代碼文件:http://www.hdlcode.com/index.php?m=home&c=View&a=index&aid=289

相關(guān)推薦