Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Horizontal counter
- always @(posedge pclk or posedge rst)
- if (rst)
- hcount <= 0;
- else
- begin
- if (hcount == HorTotalTime - 1)
- hcount <= 0;
- else
- hcount <= hcount + 1;
- end
- //Vertical counter
- always @(posedge pclk or posedge rst)
- if (rst)
- hcount <= 0;
- else
- begin
- if (hcount == HorTotalTime - 1)
- begin
- if (vcount == VerTotalTime - 1)
- vcount <= 0;
- else
- vcount <= vcount +1;
- end
- end
- always @(posedge pclk or posedge rst)
- if (rst) begin
- hsync <= 0;
- vsync <= 0;
- hblnk <= 0;
- vblnk <= 0;
- end
- else begin
- if (hcount >= HorSyncStart && hcount <= (HorSyncStart + HorTimeWidth)) begin
- hsync = 1;
- end
- else begin
- hsync = 0;
- end
- if (vcount >= VerSyncStart && vcount <= (VerSyncStart + VerTimeWidth)) begin
- vsync = 1;
- end
- else begin
- vsync = 0;
- end
- if (hcount >= HorTimeToDisplay) begin
- hblnk = 1;
- end
- else begin
- hblnk = 0;
- end
- if (vcount >= VerTimeToDisplay) begin
- vblnk = 1;
- end
- else begin
- vblnk = 0;
- end
- end
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement