Advertisement
Guest User

dibujarcuadro

a guest
Aug 20th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module dibujar_pantalla(
  2.     input reset,
  3.     input CLK100MHZ,
  4.     output VGA_HS,
  5.     output VGA_VS,
  6.     output [3:0] VGA_R,
  7.     output [3:0] VGA_G,
  8.     output [3:0] VGA_B
  9.     );
  10.     logic clk_vga;    
  11.     logic [11:0] VGA_COLOR;  
  12.     logic [11:0]vc_visible,hc_visible;
  13.     logic [11:0] cambio = 'b0;  
  14.  
  15.  
  16.   clk_wiz_0 ins(
  17.     .clk_out1(clk_vga),
  18.     .locked(),
  19.     .clk_in1(CLK100MHZ),
  20.     .reset(0));
  21.  driver_vga_1024x768(
  22.       .clk_vga(clk_vga),                    
  23.       .hs(VGA_HS),
  24.       .vs(VGA_VS),
  25.       .hc_visible(hc_visible),
  26.       .vc_visible(vc_visible)
  27.       );
  28.         localparam CUADRILLA_XI =       212;
  29.         localparam CUADRILLA_XF =  CUADRILLA_XI + 600;
  30.          
  31.         localparam CUADRILLA_YI =  250;
  32.         localparam CUADRILLA_YF =  CUADRILLA_YI + 400;
  33.         localparam COLOR_BLUE       = 12'h00F;
  34.         localparam COLOR_YELLOW     = 12'hFF0;
  35.         localparam COLOR_RED        = 12'hF00;
  36.         localparam COLOR_BLACK      = 12'h000;
  37.         localparam COLOR_WHITE      = 12'hFFF;
  38.         localparam COLOR_CYAN       = 12'h0FF;
  39.        
  40. always @(posedge clk_vga )
  41.     begin
  42.             if(( hc_visible != 0) && ( vc_visible != 0))
  43.                      
  44.                        //el fondo de la pantalla
  45.                          
  46.                         if((hc_visible > CUADRILLA_XI) && (hc_visible <= CUADRILLA_XF) && (vc_visible > CUADRILLA_YI) && (vc_visible <= CUADRILLA_YF))
  47.                                      
  48.                             VGA_COLOR = COLOR_RED;// el fondo de la grilla.
  49.                          else
  50.                              VGA_COLOR  = COLOR_BLACK;                  
  51.                                    
  52.                    
  53.                    
  54.             else
  55.                        VGA_COLOR  = COLOR_BLACK;//esto es necesario para no poner en riesgo la pantalla.
  56.     end  
  57.        
  58.         assign {VGA_R, VGA_G, VGA_B} = VGA_COLOR;
  59.        
  60.        
  61.  
  62.            
  63.            
  64.          
  65.  
  66.       endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement