Advertisement
Guest User

Untitled

a guest
Mar 7th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //////////////////////////////////////////////////////////////////////////////////
  2. // Create Date: 05.03.2019 14:28:42
  3. // Module Name: draw_background
  4. // Description:
  5. //////////////////////////////////////////////////////////////////////////////////
  6.  `timescale 1ns / 1ps
  7.  
  8. module draw_background(
  9.     input wire pclk,
  10.     input wire [10:0] hcount_in,
  11.     input wire hsync_in,
  12.     input wire hblnk_in,
  13.     input wire [10:0] vcount_in,
  14.     input wire vsync_in,
  15.     input wire vblnk_in,
  16.    
  17.     output reg [10:0] hcount_out,
  18.     output reg hsync_out,
  19.     output reg hblnk_out,
  20.     output reg [10:0] vcount_out,
  21.     output reg vsync_out,
  22.     output reg vblnk_out,
  23.    
  24.     output reg [11:0] rgb_out
  25.     );
  26.    
  27.     reg [11:0] rgb_out_nxt;
  28.  
  29. always @(posedge pclk)
  30.     begin
  31.         // Just pass these through.
  32.         hsync_out <= hsync_in;
  33.         vsync_out <= vsync_in;
  34.         hblnk_out <= hblnk_in;
  35.         vblnk_out <= vblnk_in;
  36.        
  37.         hcount_out <= hcount_in;
  38.         vcount_out <= vcount_in;
  39.    // During blanking, make it it black.
  40.    if (vblnk_in || hblnk_in) rgb_out <= 12'h0_0_0;
  41.    else
  42.    begin
  43.     // Active display, top edge, make a yellow line.
  44.     if (vcount_in == 0) rgb_out <= 12'h0_0_0;                  
  45.     //LITERKA M
  46.       else if (hcount_in >= 100 && hcount_in <= 150 && vcount_in >=150 && vcount_in <= 450) rgb_out <= 12'hf_a_0;
  47.       else if (hcount_in >= 150 && hcount_in <= 200 && vcount_in >=150 && vcount_in <= 200) rgb_out <= 12'hf_a_0;
  48.       else if (hcount_in >= 200 && hcount_in <= 250 && vcount_in >=200 && vcount_in <= 250) rgb_out <= 12'hf_a_0;
  49.       else if (hcount_in >= 250 && hcount_in <= 300 && vcount_in >=150 && vcount_in <= 200) rgb_out <= 12'hf_a_0;
  50.       else if (hcount_in >= 300 && hcount_in <= 350 && vcount_in >=150 && vcount_in <= 450) rgb_out <= 12'hf_a_0;
  51.       //Uzupelnienia(male kwadraty)
  52.       else if (hcount_in >= 175 && hcount_in <= 200 && vcount_in >=200 && vcount_in <= 225) rgb_out <= 12'hf_a_0;
  53.       else if (hcount_in >= 250 && hcount_in <= 275 && vcount_in >=200 && vcount_in <= 225) rgb_out <= 12'hf_a_0;
  54.       //LITERKA R
  55.       else if (hcount_in >= 450 && hcount_in <= 500 && vcount_in >=150 && vcount_in <= 450) rgb_out <= 12'h0_7_a;
  56.       else if (hcount_in >= 500 && hcount_in <= 625 && vcount_in >=150 && vcount_in <= 200) rgb_out <= 12'h0_7_a;
  57.       else if (hcount_in >= 625 && hcount_in <= 675 && vcount_in >=200 && vcount_in <= 250) rgb_out <= 12'h0_7_a;
  58.       else if (hcount_in >= 500 && hcount_in <= 625 && vcount_in >=250 && vcount_in <= 300) rgb_out <= 12'h0_7_a;
  59.       else if (hcount_in >= 625 && hcount_in <= 660 && vcount_in >=300 && vcount_in <= 375) rgb_out <= 12'h0_7_a;
  60.       else if (hcount_in >= 640 && hcount_in <= 675 && vcount_in >=375 && vcount_in <= 450) rgb_out <= 12'h0_7_a;
  61.       //Uzupelnienia(male kwadraty)
  62.       else if (hcount_in >= 625 && hcount_in <= 650 && vcount_in >=175 && vcount_in <= 200) rgb_out <= 12'h0_7_a;
  63.       else if (hcount_in >= 625 && hcount_in <= 650 && vcount_in >=250 && vcount_in <= 275) rgb_out <= 12'h0_7_a;
  64.       else if (hcount_in >= 600 && hcount_in <= 625 && vcount_in >=300 && vcount_in <= 325) rgb_out <= 12'h0_7_a;
  65.      
  66.       else rgb_out <= 12'h8_8_8;    
  67.     end
  68.   end
  69. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement