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

Subversion Repositories t6507lp

[/] [t6507lp/] [trunk/] [rtl/] [verilog/] [t6532.v] - Blame information for rev 194

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

Line No. Rev Author Line
1 192 creep
////////////////////////////////////////////////////////////////////////////
2
////                                                                    ////
3
//// t6532 IP Core                                                      ////
4
////                                                                    ////
5
//// This file is part of the t2600 project                             ////
6
//// http://www.opencores.org/cores/t2600/                              ////
7
////                                                                    ////
8
//// Description                                                        ////
9
//// 6532 top level                                                     ////
10
////                                                                    ////
11
//// TODO:                                                              ////
12
//// - Add the timer, ram and i/o                                       ////
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 193 creep
module t6532(clk, io_lines, enable, rw_mem, address, data);
48 192 creep
        parameter [3:0] DATA_SIZE = 4'd8;
49
        parameter [3:0] ADDR_SIZE = 4'd7; // this is the *local* addr_size
50
 
51
        localparam [3:0] DATA_SIZE_ = DATA_SIZE - 4'd1;
52
        localparam [3:0] ADDR_SIZE_ = ADDR_SIZE - 4'd1;
53
 
54
        input clk;
55
        input [15:0] io_lines;
56
        input enable;
57 193 creep
        input rw_mem;
58 192 creep
        input [ADDR_SIZE_:0] address;
59
        inout [DATA_SIZE_:0] data;
60 193 creep
 
61 194 creep
        reg [DATA_SIZE_:0] ram [127:0];
62
        reg [DATA_SIZE_:0] port_a;
63
        reg [DATA_SIZE_:0] port_b;
64
        reg [DATA_SIZE_:0] ddra;
65
        wire [DATA_SIZE_:0] ddrb;
66 193 creep
 
67
        reg [DATA_SIZE_:0] data_drv;
68
 
69 194 creep
        assign data = (rw_mem) ? 8'bZ: data_drv; // if i am writing the bus receives the data from cpu, else local data.  
70 193 creep
 
71 194 creep
        always @(clk) begin
72
                port_b[0] <= ~io_lines[0]; // these two are not actually switches
73
                port_b[1] <= ~io_lines[1];
74
 
75
                if (io_lines[3]) begin // these are.
76
                        port_b[3] <= !port_b[3];
77
                end
78
                if (io_lines[6]) begin
79
                        port_b[6] <= !port_b[6];
80
                end
81
                if (io_lines[7]) begin
82
                        port_b[7] <= !port_b[7];
83
                end
84 193 creep
 
85 194 creep
                port_a[0] <= (ddra[0] == 0) ? io_lines[8] : port_a[0];
86
                port_a[1] <= (ddra[1] == 0) ? io_lines[9] : port_a[1];
87
                port_a[2] <= (ddra[2] == 0) ? io_lines[10] : port_a[2];
88
                port_a[3] <= (ddra[3] == 0) ? io_lines[11] : port_a[3];
89
                port_a[4] <= (ddra[4] == 0) ? io_lines[12] : port_a[4];
90
                port_a[5] <= (ddra[5] == 0) ? io_lines[13] : port_a[5];
91
                port_a[6] <= (ddra[6] == 0) ? io_lines[14] : port_a[6];
92
                port_a[7] <= (ddra[7] == 0) ? io_lines[15] : port_a[7];
93
 
94 193 creep
                if (enable && rw_mem) begin
95
                        case (address)
96 194 creep
                                8'h80: data_drv = port_a;
97
                                8'h81: data_drv = ddra;
98
                                8'h82: data_drv = port_b;
99
                                8'h83: data_drv = ddrb;
100
                                8'h84: ;
101
                                8'h94: ;
102
                                8'h95: ;
103
                                8'h96: ;
104
                                8'h97: ;
105 193 creep
                                default: ;
106
                        endcase
107
                end
108
        end
109
 
110
        always @(*) begin
111 194 creep
                io_ports[3] = 8'h00; // portb ddr is always input
112
                io_ports[1] = ddra;
113 193 creep
        end
114
 
115
        // io
116
        // timer
117
        // ram
118 192 creep
 
119
endmodule

powered by: WebSVN 2.1.0

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