Advertisement
Guest User

Dziala z assign

a guest
Mar 12th, 2019
67
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 wire vsync,
  16.   output wire vblnk,
  17.   output reg [10:0] hcount,
  18.   output wire hsync,
  19.   output wire hblnk,
  20.   input wire pclk
  21.   );
  22.  
  23.     reg [10:0] vcount_nxt = 0;
  24.     reg [10:0] hcount_nxt = 0;
  25.    
  26.     always@(posedge pclk)
  27.         begin
  28.             vcount <= vcount_nxt;
  29.             hcount <= hcount_nxt;
  30.         end
  31.        
  32.     always @(*)
  33.         begin
  34.                 if(hcount < 1055)
  35.                     begin
  36.                         hcount_nxt = hcount + 1;
  37.                         vcount_nxt = vcount;
  38.                     end
  39.                 else
  40.                     begin
  41.                         hcount_nxt = 0;
  42.                         if(vcount < 628)
  43.                             vcount_nxt = vcount + 1;
  44.                         else
  45.                             vcount_nxt = 0;    
  46.                     end                    
  47.         end
  48.        
  49.         assign vblnk = (vcount >= 600);
  50.         assign vsync = (vcount >= 601 && vcount <= 605);
  51.         assign hblnk = (hcount >= 800);
  52.         assign hsync = (hcount >= 840 && hcount <= 968);
  53.        
  54.   // Describe the actual circuit for the assignment.
  55.   // Video timing controller set for 800x600@60fps
  56.   // using a 40 MHz pixel clock per VESA spec.
  57.  
  58. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement