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

Subversion Repositories t6507lp

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

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 237 creep
//// VGA controller test file. This is just a test file, it does not    ////
10
//// contain any part of the design itself                              ////
11 222 creep
////                                                                    ////
12
//// TODO:                                                              ////
13
//// - Feed the controller with data                                    ////
14
////                                                                    ////
15
//// Author(s):                                                         ////
16
//// - Gabriel Oshiro Zardo, gabrieloshiro@gmail.com                    ////
17
//// - Samuel Nascimento Pagliarini (creep), snpagliarini@gmail.com     ////
18
////                                                                    ////
19
////////////////////////////////////////////////////////////////////////////
20
////                                                                    ////
21
//// Copyright (C) 2001 Authors and OPENCORES.ORG                       ////
22
////                                                                    ////
23
//// This source file may be used and distributed without               ////
24
//// restriction provided that this copyright statement is not          ////
25
//// removed from the file and that any derivative work contains        ////
26
//// the original copyright notice and the associated disclaimer.       ////
27
////                                                                    ////
28
//// This source file is free software; you can redistribute it         ////
29
//// and/or modify it under the terms of the GNU Lesser General         ////
30
//// Public License as published by the Free Software Foundation;       ////
31
//// either version 2.1 of the License, or (at your option) any         ////
32
//// later version.                                                     ////
33
////                                                                    ////
34
//// This source is distributed in the hope that it will be             ////
35
//// useful, but WITHOUT ANY WARRANTY; without even the implied         ////
36
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR            ////
37
//// PURPOSE. See the GNU Lesser General Public License for more        ////
38
//// details.                                                           ////
39
////                                                                    ////
40
//// You should have received a copy of the GNU Lesser General          ////
41
//// Public License along with this source; if not, download it         ////
42
//// from http://www.opencores.org/lgpl.shtml                           ////
43
////                                                                    ////
44
////////////////////////////////////////////////////////////////////////////
45
 
46
`include "timescale.v"
47
 
48 233 creep
module controller_test(reset_n, clk_50, pixel, write_addr, write_data, write_enable_n, clk_358);
49 222 creep
 
50 227 creep
input reset_n;
51 225 gabrielosh
input clk_50;
52 233 creep
output reg [2:0] pixel;
53
output reg [10:0] write_addr;
54
output reg [2:0] write_data;
55
output reg write_enable_n;
56
output reg clk_358; // 3.58mhz
57 222 creep
 
58
reg [3:0] counter;
59
 
60 233 creep
//reg [3:0] red;
61
//reg [3:0] green;
62
//reg [3:0] blue;
63 222 creep
 
64 233 creep
reg [8:0] vert_counter;
65
reg [7:0] hor_counter;
66
 
67 227 creep
always @ (posedge clk_50 or negedge reset_n) begin
68
        if (reset_n == 1'b0) begin
69 222 creep
                clk_358 <= 1'b0;
70
                counter <= 4'd0;
71 233 creep
                //red <= 4'b1010;
72
                //green <= 4'b0001;
73
                //blue <= 4'b1110;
74 222 creep
        end
75
        else begin
76 233 creep
                //red <= 4'b1010;
77
                //green <= 4'b0001;
78
                //blue <= 4'b1110;
79 230 creep
 
80 222 creep
                if (counter == 4'h6) begin
81
                        clk_358 <= !clk_358;
82
                        counter <= 4'd0;
83
                end
84
                else begin
85 227 creep
                        counter <= counter + 4'd1;
86 222 creep
                end
87 227 creep
        end
88 222 creep
end
89
 
90 227 creep
always @ (posedge clk_358 or negedge reset_n) begin
91
        if (reset_n == 1'b0) begin
92 230 creep
                hor_counter <= 8'd0;
93 231 gabrielosh
                vert_counter <= 9'd0;
94 222 creep
        end
95
        else begin
96 230 creep
                if (hor_counter == 8'd227) begin // last colum
97
                        hor_counter <= 8'd0;
98 222 creep
 
99 230 creep
                        if (vert_counter == 9'd261) begin // last line
100
                                vert_counter <= 9'd0;
101
                        end
102
                        else begin
103
                                vert_counter <= vert_counter + 9'd1;
104
                        end
105 222 creep
                end
106
                else begin
107 230 creep
                        hor_counter <= hor_counter + 8'd1;
108 222 creep
                end
109
        end
110 227 creep
end
111 222 creep
 
112 230 creep
always @(*) begin // comb logic
113 233 creep
        if (hor_counter < 68 || vert_counter < 40 || vert_counter > 232) begin
114
                pixel = 3'd0;
115
                write_enable_n = 1'b1;
116
                write_addr = 0;
117
                write_data = vert_counter[2:0];
118 232 creep
        end
119
        else begin
120 233 creep
                pixel = 3'd4;
121
                write_enable_n = 1'b0;
122
                write_addr = (hor_counter - 68) + (vert_counter - 40)*160;
123
                write_data = 3'd4;
124 232 creep
        end
125 222 creep
end
126
 
127
endmodule

powered by: WebSVN 2.1.0

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