Advertisement
Guest User

Dziala / bez assign

a guest
Mar 12th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // File: vga_timing.v
  2. // This is the vga timing design for EE178 Lab #4.
  3.  
  4. // The `timescale directive specifies what the
  5. // simulation time units are (1 ns here) and what
  6. // the simulator time step should be (1 ps here).
  7.  
  8. `timescale 1 ns / 1 ps
  9.  
  10. // Declare the module and its ports. This is
  11. // using Verilog-2001 syntax.
  12.  
  13. module vga_timing (
  14.   output reg [10:0] vcount,             //zmiana na reg
  15.   output reg vsync,
  16.   output reg vblnk,
  17.   output reg [10:0] hcount,
  18.   output reg hsync,
  19.   output reg hblnk,
  20.   input wire pclk
  21.   );
  22.  
  23.     reg vsync_nxt = 0;
  24.     reg vblnk_nxt = 0;
  25.     reg hsync_nxt = 0;
  26.     reg hblnk_nxt = 0;
  27.     reg [10:0] vcount_nxt = 0;
  28.     reg [10:0] hcount_nxt = 0;
  29.    
  30.     always@(posedge pclk)
  31.         begin
  32.             vcount <= vcount_nxt;
  33.             hcount <= hcount_nxt;
  34.             vblnk <= vblnk_nxt;
  35.             vsync <= vsync_nxt;
  36.             hblnk <= hblnk_nxt;
  37.             hsync <= hsync_nxt;
  38.         end
  39.        
  40.     always @(*)
  41.         begin
  42.                 if(hcount < 1055)
  43.                     begin
  44.                         hcount_nxt = hcount + 1;
  45.                         vcount_nxt = vcount;
  46.                     end
  47.                 else
  48.                     begin
  49.                         hcount_nxt = 0;
  50.                         if(vcount < 628)
  51.                             vcount_nxt = vcount + 1;
  52.                         else
  53.                             vcount_nxt = 0;    
  54.                     end  
  55.                    
  56.             vblnk_nxt = (vcount_nxt >= 600);
  57.             vsync_nxt = (vcount_nxt >= 601 && vcount_nxt <= 605);
  58.             hblnk_nxt = (hcount_nxt >= 800);
  59.             hsync_nxt = (hcount_nxt >= 840 && hcount_nxt <= 968);
  60.  
  61.        
  62.         end
  63. /*        
  64.         assign vblnk_nxt = (vcount_nxt >= 600);
  65.         assign vsync_nxt = (vcount_nxt >= 601 && vcount_nxt <= 605);
  66.         assign hblnk_nxt = (hcount_nxt >= 800);
  67.         assign hsync_nxt = (hcount_nxt >= 840 && hcount_nxt <= 968);
  68. */
  69.        
  70.   // Describe the actual circuit for the assignment.
  71.   // Video timing controller set for 800x600@60fps
  72.   // using a 40 MHz pixel clock per VESA spec.
  73.  
  74. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement