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

Subversion Repositories t6507lp

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

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 227 creep
module controller_test(reset_n, clk_50, line, vert_counter);
48 222 creep
 
49 227 creep
input reset_n;
50 225 gabrielosh
input clk_50;
51 222 creep
output reg [479:0] line;
52
output reg [4:0] vert_counter;
53
 
54
reg clk_358; // 3.58mhz
55
reg [3:0] counter;
56
 
57
reg [3:0] red;
58
reg [3:0] green;
59
reg [3:0] blue;
60
 
61
reg [11:0] pixel0;
62
reg [11:0] pixel1;
63
reg [11:0] pixel2;
64
reg [11:0] pixel3;
65
reg [11:0] pixel4;
66
reg [11:0] pixel5;
67
reg [11:0] pixel6;
68
reg [11:0] pixel7;
69
reg [11:0] pixel8;
70
reg [11:0] pixel9;
71
 
72
 
73 227 creep
always @ (posedge clk_50 or negedge reset_n) begin
74
        if (reset_n == 1'b0) begin
75 222 creep
                clk_358 <= 1'b0;
76
                counter <= 4'd0;
77
                red <= 4'b1010;
78
                green <= 4'b0001;
79
                blue <= 4'b1110;
80
        end
81
        else begin
82
                if (counter == 4'h6) begin
83
                        clk_358 <= !clk_358;
84
                        counter <= 4'd0;
85
                end
86
                else begin
87 227 creep
                        counter <= counter + 4'd1;
88 222 creep
                end
89 227 creep
        end
90 222 creep
end
91
 
92
 
93
 
94 227 creep
always @ (posedge clk_358 or negedge reset_n) begin
95
        if (reset_n == 1'b0) begin
96
                vert_counter <= 6'd0;
97 223 gabrielosh
                line <= 480'd0;
98 227 creep
                $write("NEVER!");
99 222 creep
        end
100
        else begin
101
 
102
                line <= {pixel0, pixel1, pixel2, pixel3, pixel4, pixel5, pixel6, pixel7, pixel8, pixel9,
103
                         pixel0, pixel1, pixel2, pixel3, pixel4, pixel5, pixel6, pixel7, pixel8, pixel9,
104
                         pixel0, pixel1, pixel2, pixel3, pixel4, pixel5, pixel6, pixel7, pixel8, pixel9,
105
                         pixel0, pixel1, pixel2, pixel3, pixel4, pixel5, pixel6, pixel7, pixel8, pixel9};
106
 
107
                if (vert_counter == 5'd29) begin
108 227 creep
                        vert_counter <= 6'd0;
109 222 creep
                end
110
                else begin
111
                        vert_counter <= vert_counter + 5'd1;
112
                end
113
        end
114 227 creep
end
115 222 creep
 
116
always @(*) begin
117
        pixel0 = {red, green, blue};
118
        pixel1 = {red, green, blue};
119
        pixel2 = {red, green, blue};
120
        pixel3 = {red, green, blue};
121
        pixel4 = {red, green, blue};
122
        pixel5 = {red, green, blue};
123
        pixel6 = {red, green, blue};
124
        pixel7 = {red, green, blue};
125
        pixel8 = {red, green, blue};
126
        pixel9 = {red, green, blue};
127
end
128
 
129
endmodule

powered by: WebSVN 2.1.0

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