Advertisement
Guest User

Untitled

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