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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [orp/] [orp_soc/] [rtl/] [verilog/] [uart16550.old/] [uart_top.v] - Blame information for rev 746

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

Line No. Rev Author Line
1 746 lampret
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  uart_top.v                                                  ////
4
////                                                              ////
5
////                                                              ////
6
////  This file is part of the "UART 16550 compatible" project    ////
7
////  http://www.opencores.org/cores/uart16550/                   ////
8
////                                                              ////
9
////  Documentation related to this project:                      ////
10
////  - http://www.opencores.org/cores/uart16550/                 ////
11
////                                                              ////
12
////  Projects compatibility:                                     ////
13
////  - WISHBONE                                                  ////
14
////  RS232 Protocol                                              ////
15
////  16550D uart (mostly supported)                              ////
16
////                                                              ////
17
////  Overview (main Features):                                   ////
18
////  UART core top level.                                        ////
19
////                                                              ////
20
////  Known problems (limits):                                    ////
21
////  Note that transmitter and receiver instances are inside     ////
22
////  the uart_regs.v file.                                       ////
23
////                                                              ////
24
////  To Do:                                                      ////
25
////  Nothing so far.                                             ////
26
////                                                              ////
27
////  Author(s):                                                  ////
28
////      - gorban@opencores.org                                  ////
29
////      - Jacob Gorban                                          ////
30
////      - Igor Mohor (igorm@opencores.org)                      ////
31
////                                                              ////
32
////  Created:        2001/05/12                                  ////
33
////  Last Updated:   2001/05/17                                  ////
34
////                  (See log for the revision history)          ////
35
////                                                              ////
36
////                                                              ////
37
//////////////////////////////////////////////////////////////////////
38
////                                                              ////
39
//// Copyright (C) 2000, 2001 Authors                             ////
40
////                                                              ////
41
//// This source file may be used and distributed without         ////
42
//// restriction provided that this copyright statement is not    ////
43
//// removed from the file and that any derivative work contains  ////
44
//// the original copyright notice and the associated disclaimer. ////
45
////                                                              ////
46
//// This source file is free software; you can redistribute it   ////
47
//// and/or modify it under the terms of the GNU Lesser General   ////
48
//// Public License as published by the Free Software Foundation; ////
49
//// either version 2.1 of the License, or (at your option) any   ////
50
//// later version.                                               ////
51
////                                                              ////
52
//// This source is distributed in the hope that it will be       ////
53
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
54
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
55
//// PURPOSE.  See the GNU Lesser General Public License for more ////
56
//// details.                                                     ////
57
////                                                              ////
58
//// You should have received a copy of the GNU Lesser General    ////
59
//// Public License along with this source; if not, download it   ////
60
//// from http://www.opencores.org/lgpl.shtml                     ////
61
////                                                              ////
62
//////////////////////////////////////////////////////////////////////
63
//
64
// CVS Revision History
65
//
66
// $Log: not supported by cvs2svn $
67
// Revision 1.17  2001/12/19 08:40:03  mohor
68
// Warnings fixed (unused signals removed).
69
//
70
// Revision 1.16  2001/12/06 14:51:04  gorban
71
// Bug in LSR[0] is fixed.
72
// All WISHBONE signals are now sampled, so another wait-state is introduced on all transfers.
73
//
74
// Revision 1.15  2001/12/03 21:44:29  gorban
75
// Updated specification documentation.
76
// Added full 32-bit data bus interface, now as default.
77
// Address is 5-bit wide in 32-bit data bus mode.
78
// Added wb_sel_i input to the core. It's used in the 32-bit mode.
79
// Added debug interface with two 32-bit read-only registers in 32-bit mode.
80
// Bits 5 and 6 of LSR are now only cleared on TX FIFO write.
81
// My small test bench is modified to work with 32-bit mode.
82
//
83
// Revision 1.14  2001/11/07 17:51:52  gorban
84
// Heavily rewritten interrupt and LSR subsystems.
85
// Many bugs hopefully squashed.
86
//
87
// Revision 1.13  2001/10/20 09:58:40  gorban
88
// Small synopsis fixes
89
//
90
// Revision 1.12  2001/08/25 15:46:19  gorban
91
// Modified port names again
92
//
93
// Revision 1.11  2001/08/24 21:01:12  mohor
94
// Things connected to parity changed.
95
// Clock devider changed.
96
//
97
// Revision 1.10  2001/08/23 16:05:05  mohor
98
// Stop bit bug fixed.
99
// Parity bug fixed.
100
// WISHBONE read cycle bug fixed,
101
// OE indicator (Overrun Error) bug fixed.
102
// PE indicator (Parity Error) bug fixed.
103
// Register read bug fixed.
104
//
105
// Revision 1.4  2001/05/31 20:08:01  gorban
106
// FIFO changes and other corrections.
107
//
108
// Revision 1.3  2001/05/21 19:12:02  gorban
109
// Corrected some Linter messages.
110
//
111
// Revision 1.2  2001/05/17 18:34:18  gorban
112
// First 'stable' release. Should be sythesizable now. Also added new header.
113
//
114
// Revision 1.0  2001-05-17 21:27:12+02  jacob
115
// Initial revision
116
//
117
//
118
// synopsys translate_off
119
`include "timescale.v"
120
// synopsys translate_on
121
 
122
`include "uart_defines.v"
123
 
124
module uart_top (
125
        wb_clk_i,
126
 
127
        // Wishbone signals
128
        wb_rst_i, wb_adr_i, wb_dat_i, wb_dat_o, wb_we_i, wb_stb_i, wb_cyc_i, wb_ack_o, wb_sel_i,
129
        int_o, // interrupt request
130
 
131
        // UART signals
132
        // serial input/output
133
        stx_pad_o, srx_pad_i,
134
 
135
        // modem signals
136
        rts_pad_o, cts_pad_i, dtr_pad_o, dsr_pad_i, ri_pad_i, dcd_pad_i
137
 
138
        );
139
 
140
parameter                                                        uart_data_width = `UART_DATA_WIDTH;
141
parameter                                                        uart_addr_width = `UART_ADDR_WIDTH;
142
 
143
input                                                            wb_clk_i;
144
 
145
// WISHBONE interface
146
input                                                            wb_rst_i;
147
input [uart_addr_width-1:0]       wb_adr_i;
148
input [uart_data_width-1:0]       wb_dat_i;
149
output [uart_data_width-1:0]      wb_dat_o;
150
input                                                            wb_we_i;
151
input                                                            wb_stb_i;
152
input                                                            wb_cyc_i;
153
input [3:0]                                                       wb_sel_i;
154
output                                                           wb_ack_o;
155
output                                                           int_o;
156
 
157
// UART signals
158
input                                                            srx_pad_i;
159
output                                                           stx_pad_o;
160
output                                                           rts_pad_o;
161
input                                                            cts_pad_i;
162
output                                                           dtr_pad_o;
163
input                                                            dsr_pad_i;
164
input                                                            ri_pad_i;
165
input                                                            dcd_pad_i;
166
 
167
wire                                                                     stx_pad_o;
168
wire                                                                     rts_pad_o;
169
wire                                                                     dtr_pad_o;
170
 
171
wire [uart_addr_width-1:0]        wb_adr_i;
172
wire [uart_data_width-1:0]        wb_dat_i;
173
wire [uart_data_width-1:0]        wb_dat_o;
174
 
175
wire [7:0]                                                        wb_dat8_i; // 8-bit internal data input
176
wire [7:0]                                                        wb_dat8_o; // 8-bit internal data output
177
wire [31:0]                                               wb_dat32_o; // debug interface 32-bit output
178
wire [3:0]                                                        wb_sel_i;  // WISHBONE select signal
179
wire [uart_addr_width-1:0]        wb_adr_int;
180
wire                                                                     we_o;  // Write enable for registers
181
wire                                 re_o;      // Read enable for registers
182
//
183
// MODULE INSTANCES
184
//
185
 
186
`ifdef DATA_BUS_WIDTH_8
187
`else
188
// debug interface wires
189
wire    [3:0] ier;
190
wire    [3:0] iir;
191
wire    [1:0] fcr;
192
wire    [4:0] mcr;
193
wire    [7:0] lcr;
194
wire    [7:0] msr;
195
wire    [7:0] lsr;
196
wire    [`UART_FIFO_COUNTER_W-1:0] rf_count;
197
wire    [`UART_FIFO_COUNTER_W-1:0] tf_count;
198
wire    [2:0] tstate;
199
wire    [3:0] rstate;
200
`endif
201
 
202
`ifdef DATA_BUS_WIDTH_8
203
////  WISHBONE interface module
204
uart_wb         wb_interface(
205
                .clk(           wb_clk_i                ),
206
                .wb_rst_i(      wb_rst_i        ),
207
        .wb_dat_i(wb_dat_i),
208
        .wb_dat_o(wb_dat_o),
209
        .wb_dat8_i(wb_dat8_i),
210
        .wb_dat8_o(wb_dat8_o),
211
         .wb_dat32_o(32'b0),
212
         .wb_sel_i(4'b0),
213
                .wb_we_i(       wb_we_i         ),
214
                .wb_stb_i(      wb_stb_i        ),
215
                .wb_cyc_i(      wb_cyc_i        ),
216
                .wb_ack_o(      wb_ack_o        ),
217
        .wb_adr_i(wb_adr_i),
218
        .wb_adr_int(wb_adr_int),
219
                .we_o(          we_o            ),
220
                .re_o(re_o)
221
                );
222
`else // !`ifdef DATA_BUS_WIDTH_8
223
uart_wb         wb_interface(
224
                .clk(           wb_clk_i                ),
225
                .wb_rst_i(      wb_rst_i        ),
226
        .wb_dat_i(wb_dat_i),
227
        .wb_dat_o(wb_dat_o),
228
        .wb_dat8_i(wb_dat8_i),
229
        .wb_dat8_o(wb_dat8_o),
230
         .wb_sel_i(wb_sel_i),
231
         .wb_dat32_o(wb_dat32_o),
232
                .wb_we_i(       wb_we_i         ),
233
                .wb_stb_i(      wb_stb_i        ),
234
                .wb_cyc_i(      wb_cyc_i        ),
235
                .wb_ack_o(      wb_ack_o        ),
236
        .wb_adr_i(wb_adr_i),
237
        .wb_adr_int(wb_adr_int),
238
                .we_o(          we_o            ),
239
                .re_o(re_o)
240
                );
241
`endif // !`ifdef DATA_BUS_WIDTH_8
242
 
243
// Registers
244
uart_regs       regs(
245
        .clk(           wb_clk_i                ),
246
        .wb_rst_i(      wb_rst_i        ),
247
        .wb_addr_i(     wb_adr_int      ),
248
        .wb_dat_i(      wb_dat8_i       ),
249
        .wb_dat_o(      wb_dat8_o       ),
250
        .wb_we_i(       we_o            ),
251
   .wb_re_i(re_o),
252
        .modem_inputs(  {cts_pad_i, dsr_pad_i,
253
        ri_pad_i,  dcd_pad_i}   ),
254
        .stx_pad_o(             stx_pad_o               ),
255
        .srx_pad_i(             srx_pad_i               ),
256
`ifdef DATA_BUS_WIDTH_8
257
`else
258
// debug interface signals      enabled
259
.ier(ier),
260
.iir(iir),
261
.fcr(fcr),
262
.mcr(mcr),
263
.lcr(lcr),
264
.msr(msr),
265
.lsr(lsr),
266
.rf_count(rf_count),
267
.tf_count(tf_count),
268
.tstate(tstate),
269
.rstate(rstate),
270
`endif
271
        .rts_pad_o(             rts_pad_o               ),
272
        .dtr_pad_o(             dtr_pad_o               ),
273
        .int_o(         int_o           )
274
);
275
 
276
`ifdef DATA_BUS_WIDTH_8
277
`else
278
uart_debug_if dbg(/*AUTOINST*/
279
                                                // Outputs
280
                                                .wb_dat32_o                              (wb_dat32_o[31:0]),
281
                                                // Inputs
282
                                                .wb_adr_i                                (wb_adr_int[`UART_ADDR_WIDTH-1:0]),
283
                                                .ier                                             (ier[3:0]),
284
                                                .iir                                             (iir[3:0]),
285
                                                .fcr                                             (fcr[1:0]),
286
                                                .mcr                                             (mcr[4:0]),
287
                                                .lcr                                             (lcr[7:0]),
288
                                                .msr                                             (msr[7:0]),
289
                                                .lsr                                             (lsr[7:0]),
290
                                                .rf_count                                (rf_count[`UART_FIFO_COUNTER_W-1:0]),
291
                                                .tf_count                                (tf_count[`UART_FIFO_COUNTER_W-1:0]),
292
                                                .tstate                                  (tstate[2:0]),
293
                                                .rstate                                  (rstate[3:0]));
294
`endif //  `ifdef DATA_BUS_WIDTH_8
295
 
296
endmodule
297
 
298
 

powered by: WebSVN 2.1.0

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