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

Subversion Repositories t6507lp

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

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 225 gabrielosh
module controller_test(reset, clk_50, line, vert_counter);
49 222 creep
 
50 225 gabrielosh
input reset;
51
input clk_50;
52 222 creep
 
53
output reg [479:0] line;
54
output reg [4:0] vert_counter;
55
 
56 225 gabrielosh
//reg reset_n;
57
//reg clk_50;
58 222 creep
 
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 225 gabrielosh
 
77
//always #10 clk_50 <= !clk_50;
78 222 creep
 
79 225 gabrielosh
//initial begin
80
        //reset_n = 1'b0;
81
        //clk_50 = 1'b0;
82
        //#20;
83
        //reset_n = 1'b1;
84
//end
85 222 creep
 
86 225 gabrielosh
always @ (posedge clk_50 or negedge reset) begin
87
        if (reset == 0) begin
88 222 creep
                clk_358 <= 1'b0;
89
                counter <= 4'd0;
90
                red <= 4'b1010;
91
                green <= 4'b0001;
92
                blue <= 4'b1110;
93
        end
94
        else begin
95
                if (counter == 4'h6) begin
96
                        clk_358 <= !clk_358;
97
                        counter <= 4'd0;
98
                end
99
                else begin
100 225 gabrielosh
                        counter <= counter + 4'd1;
101 222 creep
                end
102 225 gabrielosh
        end
103
        red <= 4'b1010;
104
        green <= 4'b0001;
105
        blue <= 4'b1110;
106 222 creep
end
107
 
108
 
109
 
110 225 gabrielosh
always @ (posedge clk_358 or negedge reset) begin
111
        if (reset == 0) begin
112
                vert_counter <= 5'd0;
113 223 gabrielosh
                line <= 480'd0;
114 222 creep
        end
115
        else begin
116
 
117
                line <= {pixel0, pixel1, pixel2, pixel3, pixel4, pixel5, pixel6, pixel7, pixel8, pixel9,
118
                         pixel0, pixel1, pixel2, pixel3, pixel4, pixel5, pixel6, pixel7, pixel8, pixel9,
119
                         pixel0, pixel1, pixel2, pixel3, pixel4, pixel5, pixel6, pixel7, pixel8, pixel9,
120
                         pixel0, pixel1, pixel2, pixel3, pixel4, pixel5, pixel6, pixel7, pixel8, pixel9};
121
 
122
                if (vert_counter == 5'd29) begin
123 225 gabrielosh
                        vert_counter <= 5'd0;
124 222 creep
                end
125
                else begin
126
                        vert_counter <= vert_counter + 5'd1;
127
                end
128
        end
129 223 gabrielosh
end
130 222 creep
 
131
always @(*) begin
132
        pixel0 = {red, green, blue};
133
        pixel1 = {red, green, blue};
134
        pixel2 = {red, green, blue};
135
        pixel3 = {red, green, blue};
136
        pixel4 = {red, green, blue};
137
        pixel5 = {red, green, blue};
138
        pixel6 = {red, green, blue};
139
        pixel7 = {red, green, blue};
140
        pixel8 = {red, green, blue};
141
        pixel9 = {red, green, blue};
142
end
143
 
144
endmodule

powered by: WebSVN 2.1.0

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