OpenCores
URL https://opencores.org/ocsvn/ag_6502/ag_6502/trunk

Subversion Repositories ag_6502

[/] [ag_6502/] [trunk/] [fighter/] [videoctl.v] - Blame information for rev 8

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 olegodints
`timescale 1ns / 1ps
2
//////////////////////////////////////////////////////////////////////////////////
3
// Company:   BMSTU
4
// Engineer:  Oleg Odintsov
5
// 
6
// Create Date:    20:41:53 01/18/2012 
7
// Design Name: 
8
// Module Name:    videoctl 
9
// Project Name:    Agat Hardware Project
10
// Target Devices: 
11
// Tool versions: 
12
// Description: 
13
//
14
// Dependencies: 
15
//
16
// Revision: 
17
// Revision 0.01 - File Created
18
// Additional Comments: 
19
//
20
//////////////////////////////////////////////////////////////////////////////////
21
 
22
module video_counters(
23
                input clk,
24
                output reg video_vsync = 1,
25
                output reg video_hsync = 1,
26
                output video_on,
27
                output reg [10:1] hpos = 0,
28
                output reg [9:1] vpos = 0);
29
 
30
        integer hcnt = 0, vcnt = 0;
31
 
32
        reg video_von = 0, video_hon = 0;
33
        assign video_on = video_von & video_hon;
34
 
35
        always @(posedge video_hsync) begin
36
                vcnt <= vcnt + 1;
37
                vpos <= video_von?vpos + 1: 0;
38
                case (vcnt)
39
                2: video_vsync = 1;
40
                31: video_von = 1;
41
                511: video_von = 0;
42
                521: begin vcnt <=0; video_vsync = 0; end
43
                endcase
44
        end
45
 
46
        always @(posedge clk) begin
47
                if (!video_hon) hcnt <= hcnt - 1;
48
                else hpos <= hpos + 1;
49
 
50
                if (hpos == 639) video_hon <= 0;
51
 
52
                if (hpos == 640) begin
53
                        if (!hcnt) begin
54
                                hcnt <= 96;
55
                                video_hsync <= 0;
56
                                hpos <= 0;
57
                        end
58
                end else if (!hcnt) begin
59
                        if (!video_hsync) begin
60
                                video_hsync <= 1;
61
                                hcnt <= 48;
62
                        end else if (!video_hon) begin
63
                                video_hon <= 1;
64
                                hcnt <= 16;
65
                        end
66
                end
67
        end
68
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.