名稱:VGA顯示彩色條紋Basys3開發(fā)板verilog代碼(代碼在文末下載)
軟件:VIVADO
語言:Verilog
代碼功能:
編寫 VGA 驅(qū)動, 使用 FPGA 開發(fā)板驅(qū)動 VGA 顯示器顯示十色等寬彩條,VGA 顯示模式為 640x480@60。
FPGA代碼Verilog/VHDL代碼資源下載:www.hdlcode.com
本代碼已在Basys3開發(fā)板驗(yàn)證,開發(fā)板如下,其他開發(fā)板可以修改管腳適配:
工程文件
程序文件
RTL圖
程序編譯
管腳分配
部分代碼展示:
//彩色條紋控制模塊 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
閱讀全文