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

Subversion Repositories t6507lp

[/] [t6507lp/] [trunk/] [rtl/] [verilog/] [controller_test.v] - Blame information for rev 222

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

Line No. Rev Author Line
1 222 creep
////////////////////////////////////////////////////////////////////////////
2
////                                                                    ////
3
//// t2600 IP Core                                                      ////
4
////                                                                    ////
5
//// This file is part of the t2600 project                             ////
6
//// http://www.opencores.org/cores/t2600/                              ////
7
////                                                                    ////
8
//// Description                                                        ////
9
//// VGA controller                                                     ////
10
////                                                                    ////
11
//// TODO:                                                              ////
12
//// - Feed the controller with data                                    ////
13
////                                                                    ////
14
//// Author(s):                                                         ////
15
//// - Gabriel Oshiro Zardo, gabrieloshiro@gmail.com                    ////
16
//// - Samuel Nascimento Pagliarini (creep), snpagliarini@gmail.com     ////
17
////                                                                    ////
18
////////////////////////////////////////////////////////////////////////////
19
////                                                                    ////
20
//// Copyright (C) 2001 Authors and OPENCORES.ORG                       ////
21
////                                                                    ////
22
//// This source file may be used and distributed without               ////
23
//// restriction provided that this copyright statement is not          ////
24
//// removed from the file and that any derivative work contains        ////
25
//// the original copyright notice and the associated disclaimer.       ////
26
////                                                                    ////
27
//// This source file is free software; you can redistribute it         ////
28
//// and/or modify it under the terms of the GNU Lesser General         ////
29
//// Public License as published by the Free Software Foundation;       ////
30
//// either version 2.1 of the License, or (at your option) any         ////
31
//// later version.                                                     ////
32
////                                                                    ////
33
//// This source is distributed in the hope that it will be             ////
34
//// useful, but WITHOUT ANY WARRANTY; without even the implied         ////
35
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR            ////
36
//// PURPOSE. See the GNU Lesser General Public License for more        ////
37
//// details.                                                           ////
38
////                                                                    ////
39
//// You should have received a copy of the GNU Lesser General          ////
40
//// Public License along with this source; if not, download it         ////
41
//// from http://www.opencores.org/lgpl.shtml                           ////
42
////                                                                    ////
43
////////////////////////////////////////////////////////////////////////////
44
 
45
`include "timescale.v"
46
 
47
//module vga_tester (reset_n, clk_50);
48
module vga_tester(line, vert_counter);
49
 
50
//input reset_n;
51
//input clk_50;
52
 
53
output reg [479:0] line;
54
output reg [4:0] vert_counter;
55
 
56
reg reset_n;
57
reg clk_50;
58
 
59
reg clk_358; // 3.58mhz
60
reg [3:0] counter;
61
 
62
reg [3:0] red;
63
reg [3:0] green;
64
reg [3:0] blue;
65
 
66
reg [11:0] pixel0;
67
reg [11:0] pixel1;
68
reg [11:0] pixel2;
69
reg [11:0] pixel3;
70
reg [11:0] pixel4;
71
reg [11:0] pixel5;
72
reg [11:0] pixel6;
73
reg [11:0] pixel7;
74
reg [11:0] pixel8;
75
reg [11:0] pixel9;
76
always #10 clk_50 <= !clk_50;
77
 
78
initial begin
79
        reset_n = 1'b0;
80
        clk_50 = 1'b0;
81
        #20;
82
        reset_n = 1'b1;
83
end
84
 
85
always @ (posedge clk_50 or negedge reset_n) begin
86
        if (reset_n == 0) begin
87
                clk_358 <= 1'b0;
88
                counter <= 4'd0;
89
                vert_counter <= 6'd0;
90
                red <= 4'b1010;
91
                green <= 4'b0001;
92
                blue <= 4'b1110;
93
                line <= 480'd0;
94
        end
95
        else begin
96
                if (counter == 4'h6) begin
97
                        clk_358 <= !clk_358;
98
                        counter <= 4'd0;
99
                end
100
                else begin
101
                        counter <= counter + 4'd1;
102
                end
103
        end
104
end
105
 
106
 
107
 
108
always @ (posedge clk_358 or negedge reset_n) begin
109
        if (reset_n == 0) begin
110
        end
111
        else begin
112
 
113
                line <= {pixel0, pixel1, pixel2, pixel3, pixel4, pixel5, pixel6, pixel7, pixel8, pixel9,
114
                         pixel0, pixel1, pixel2, pixel3, pixel4, pixel5, pixel6, pixel7, pixel8, pixel9,
115
                         pixel0, pixel1, pixel2, pixel3, pixel4, pixel5, pixel6, pixel7, pixel8, pixel9,
116
                         pixel0, pixel1, pixel2, pixel3, pixel4, pixel5, pixel6, pixel7, pixel8, pixel9};
117
 
118
                if (vert_counter == 5'd29) begin
119
                        vert_counter <= 6'd0;
120
                end
121
                else begin
122
                        vert_counter <= vert_counter + 5'd1;
123
                end
124
        end
125
end
126
 
127
always @(*) begin
128
        pixel0 = {red, green, blue};
129
        pixel1 = {red, green, blue};
130
        pixel2 = {red, green, blue};
131
        pixel3 = {red, green, blue};
132
        pixel4 = {red, green, blue};
133
        pixel5 = {red, green, blue};
134
        pixel6 = {red, green, blue};
135
        pixel7 = {red, green, blue};
136
        pixel8 = {red, green, blue};
137
        pixel9 = {red, green, blue};
138
end
139
 
140
endmodule

powered by: WebSVN 2.1.0

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