欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 4567|回復: 0
打印 上一主題 下一主題
收起左側

FPGA VGA顯示 verilog源碼仿真與資料分享

[復制鏈接]
跳轉到指定樓層
樓主
FPGA 驅動vga顯示源碼仿真與資料都有


  1. `timescale 1ns / 1ps
  2. /*==============================================================================
  3. Engineer            : a fei
  4. Module Hierarchy    : top function module
  5. Design Name         : vga_module.v
  6. Module Name         : vga_module
  7. Project Name        : test_project_top.qsf
  8. Target Devices      : Altera
  9. Tool versions       : QUARTUSII11.0/Windows XP
  10. Description         : 顯示“囧”字,綠背景,藍框,800*600@60Hz
  11. Dependencies        :                       
  12. Revision            : 0.01 - File Created
  13. Additional Comments : modify the pixer to 800X600@72Hz
  14. ==============================================================================*/
  15. module vga_module(
  16.         input                 i_fpga_clk        ,        //50MHz
  17.         input                 i_rst_n                        ,        //低電平復位
  18.                        
  19.         output                 o_vga_red                ,
  20.         output                 o_vga_green        ,
  21.         output                 o_vga_blue        ,
  22.         output                 o_vga_hsync        ,        //行同步信號
  23.         output                 o_vga_vsync                //場同步信號
  24. );

  25. //================================================================================
  26. // 4、Wire and reg declaration
  27. //================================================================================
  28.         reg[9:0] r_x_cnt;        //行坐標(這里包括了行同步、后沿、有效數據區、前沿)
  29.         reg[9:0] r_y_cnt;        //列坐標(這里包括了場同步、后沿、有效數據區、前沿)
  30. always @ (posedge i_fpga_clk or negedge i_rst_n)
  31.         if(!i_rst_n)
  32.                 r_x_cnt <= 10'd0;
  33.         else if(r_x_cnt == 10'd1000)
  34.                 r_x_cnt <= 10'd0;                //行計數只記到1000
  35.         else
  36.                 r_x_cnt <= r_x_cnt+1'b1;

  37. always @ (posedge i_fpga_clk or negedge i_rst_n)
  38.         if(!i_rst_n)
  39.                 r_y_cnt <= 10'd0;
  40.         else if(r_y_cnt == 10'd665)
  41.                 r_y_cnt <= 10'd0;                //場同步只記到665
  42.         else if(r_x_cnt == 10'd1000)
  43.                 r_y_cnt <= r_y_cnt+1'b1;//每計數完一行,場同步就加一
  44.         else
  45.                 r_y_cnt <= r_y_cnt;
  46.                
  47. //================================================================================
  48. // 4、Wire and reg declaration
  49. //================================================================================
  50.         wire w_vga_valid;        //有效數據顯示區標志,當坐標不處于有效顯示區時,R、G、B三原色信號接的電平都必須拉底(0)*/
  51. assign w_vga_valid = (r_x_cnt > 10'd180) && (r_x_cnt < 10'd980) //800*600
  52.                                         && (r_y_cnt > 10'd35) && (r_y_cnt < 10'd635);

  53.         wire        [9:0] w_x_pos;
  54.         wire        [9:0]        w_y_pos;        //有效顯示區坐標
  55. assign w_x_pos = r_x_cnt-10'd180;//
  56. assign w_y_pos = r_y_cnt-10'd35;//

  57.         reg         r_vga_hsync;
  58.         reg                r_vga_vsync;
  59. always @ (posedge i_fpga_clk or negedge i_rst_n)
  60.   if (!i_rst_n)
  61.           begin
  62.                         r_vga_hsync <= 1'b0;
  63.              r_vga_vsync <= 1'b0;
  64.      end
  65.   else
  66.           begin
  67.              r_vga_hsync <= r_x_cnt <= 10'd50;  //產生hsync信號(行同步)0-50
  68.              r_vga_vsync <= r_y_cnt <= 10'd6;   //產生vsync信號(場同步)0-6
  69.     end

  70. //================================================================================
  71. // 4、Wire and reg declaration
  72. //================================================================================
  73.         //顯示一個矩形框
  74.         wire a_dis,b_dis,c_dis,d_dis;        //矩形框顯示區域定位
  75. assign a_dis = ( (w_x_pos>=200) && (w_x_pos<=220) )
  76.                                 &&        ( (w_y_pos>=140) && (w_y_pos<=460) );                               
  77. assign b_dis = ( (w_x_pos>=580) && (w_x_pos<=600) )
  78.                                 && ( (w_y_pos>=140) && (w_y_pos<=460) );
  79. assign c_dis = ( (w_x_pos>=220) && (w_x_pos<=580) )
  80.                                 &&        ( (w_y_pos>140)  && (w_y_pos<=160) );                               
  81. assign d_dis = ( (w_x_pos>=220) && (w_x_pos<=580) )
  82.                                 && ( (w_y_pos>=440) && (w_y_pos<=460) );

  83.         wire e_dis,f_dis,g_dis,h_dis;        //矩形框顯示區域定位
  84. assign e_dis = ( (w_x_pos>=320) && (w_x_pos<=340) )
  85.                                 &&        ( (w_y_pos>=320) && (w_y_pos<=410) );                               
  86. assign f_dis = ( (w_x_pos>=460) && (w_x_pos<=480) )
  87.                                 && ( (w_y_pos>=320) && (w_y_pos<=410) );
  88. assign g_dis = ( (w_x_pos>=340) && (w_x_pos<=460) )
  89.                                 &&        ( (w_y_pos>320)  && (w_y_pos<=340) );                               
  90. assign h_dis = ( (w_x_pos>=340) && (w_x_pos<=460) )
  91.                                 && ( (w_y_pos>=390) && (w_y_pos<=410) );

  92.         wire i_dis,j_dis,k_dis,l_dis;
  93. assign i_dis = ( (w_x_pos>=320) && (w_x_pos<=340) )
  94.                                 &&        ( (w_y_pos>=210) && (w_y_pos<=290) );                               
  95. assign j_dis = ( (w_x_pos>=460) && (w_x_pos<=480) )
  96.                                 && ( (w_y_pos>=210) && (w_y_pos<=290) );
  97. assign k_dis = ( (w_x_pos>=270) && (w_x_pos<=320) )
  98.                                 &&        ( (w_y_pos>270)  && (w_y_pos<=290) );                               
  99. assign l_dis = ( (w_x_pos>=480) && (w_x_pos<=530) )
  100.                                 && ( (w_y_pos>=270) && (w_y_pos<=290) );

  101. //================================================================================
  102. // 2、output                                                                  
  103. //================================================================================

  104.         assign o_vga_red = w_vga_valid ?        (i_dis | j_dis | k_dis | l_dis): 1'b0;
  105.         assign o_vga_blue = w_vga_valid ?  (a_dis | b_dis | c_dis | d_dis | e_dis | f_dis | g_dis | h_dis ) : 1'b0;
  106.         assign o_vga_green = w_vga_valid ? ~(a_dis | b_dis | c_dis | d_dis | e_dis | f_dis | g_dis | h_dis | i_dis | j_dis | k_dis | l_dis) : 1'b0;          
  107.         assign o_vga_vsync = r_vga_vsync ;
  108.         assign o_vga_hsync = r_vga_hsync ;
  109.        
  110. //================================================================================
  111. endmodule
復制代碼

全部資料51hei下載地址:
M20_VGA display.zip (4.48 MB, 下載次數: 65)


評分

參與人數 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表