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

Subversion Repositories t6507lp

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

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 230 creep
module controller_test(reset_n, clk_50, pixel, vert_counter, hor_counter);
48 222 creep
 
49 227 creep
input reset_n;
50 225 gabrielosh
input clk_50;
51 230 creep
output reg [11:0] pixel;
52
output reg [8:0] vert_counter;
53
output reg [7:0] hor_counter;
54 222 creep
 
55
reg clk_358; // 3.58mhz
56
reg [3:0] counter;
57
 
58
reg [3:0] red;
59
reg [3:0] green;
60
reg [3:0] blue;
61
 
62 227 creep
always @ (posedge clk_50 or negedge reset_n) begin
63
        if (reset_n == 1'b0) begin
64 222 creep
                clk_358 <= 1'b0;
65
                counter <= 4'd0;
66
                red <= 4'b1010;
67
                green <= 4'b0001;
68
                blue <= 4'b1110;
69
        end
70
        else begin
71 230 creep
                red <= 4'b1010;
72
                green <= 4'b0001;
73
                blue <= 4'b1110;
74
 
75 222 creep
                if (counter == 4'h6) begin
76
                        clk_358 <= !clk_358;
77
                        counter <= 4'd0;
78
                end
79
                else begin
80 227 creep
                        counter <= counter + 4'd1;
81 222 creep
                end
82 227 creep
        end
83 222 creep
end
84
 
85
 
86
 
87 227 creep
always @ (posedge clk_358 or negedge reset_n) begin
88
        if (reset_n == 1'b0) begin
89 230 creep
                hor_counter <= 8'd0;
90 231 gabrielosh
                vert_counter <= 9'd0;
91 222 creep
        end
92
        else begin
93 230 creep
                if (hor_counter == 8'd227) begin // last colum
94
                        hor_counter <= 8'd0;
95 222 creep
 
96 230 creep
                        if (vert_counter == 9'd261) begin // last line
97
                                vert_counter <= 9'd0;
98
                        end
99
                        else begin
100
                                vert_counter <= vert_counter + 9'd1;
101
                        end
102 222 creep
                end
103
                else begin
104 230 creep
                        hor_counter <= hor_counter + 8'd1;
105 222 creep
                end
106
        end
107 227 creep
end
108 222 creep
 
109 230 creep
always @(*) begin // comb logic
110
        pixel = {red, green, blue};
111 222 creep
end
112
 
113
endmodule

powered by: WebSVN 2.1.0

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