1 |
49 |
gorban |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// uart_debug_if.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 debug interface. ////
|
19 |
|
|
//// ////
|
20 |
|
|
//// Author(s): ////
|
21 |
|
|
//// - gorban@opencores.org ////
|
22 |
|
|
//// - Jacob Gorban ////
|
23 |
|
|
//// ////
|
24 |
|
|
//// Created: 2001/12/02 ////
|
25 |
|
|
//// (See log for the revision history) ////
|
26 |
|
|
//// ////
|
27 |
|
|
//////////////////////////////////////////////////////////////////////
|
28 |
|
|
//// ////
|
29 |
|
|
//// Copyright (C) 2000, 2001 Authors ////
|
30 |
|
|
//// ////
|
31 |
|
|
//// This source file may be used and distributed without ////
|
32 |
|
|
//// restriction provided that this copyright statement is not ////
|
33 |
|
|
//// removed from the file and that any derivative work contains ////
|
34 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
35 |
|
|
//// ////
|
36 |
|
|
//// This source file is free software; you can redistribute it ////
|
37 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
38 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
39 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
40 |
|
|
//// later version. ////
|
41 |
|
|
//// ////
|
42 |
|
|
//// This source is distributed in the hope that it will be ////
|
43 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
44 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
45 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
46 |
|
|
//// details. ////
|
47 |
|
|
//// ////
|
48 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
49 |
|
|
//// Public License along with this source; if not, download it ////
|
50 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
51 |
|
|
//// ////
|
52 |
|
|
//////////////////////////////////////////////////////////////////////
|
53 |
|
|
//
|
54 |
|
|
// CVS Revision History
|
55 |
|
|
//
|
56 |
|
|
// $Log: not supported by cvs2svn $
|
57 |
|
|
|
58 |
|
|
module uart_debug_if (/*AUTOARG*/
|
59 |
|
|
// Outputs
|
60 |
|
|
wb_dat32_o,
|
61 |
|
|
// Inputs
|
62 |
|
|
wb_clk_i, wb_rst_i, wb_adr_i, re_o, ier, iir, fcr, mcr, lcr, msr,
|
63 |
|
|
lsr, rf_count, tf_count, tstate, rstate
|
64 |
|
|
) ;
|
65 |
|
|
|
66 |
|
|
input wb_clk_i;
|
67 |
|
|
input wb_rst_i;
|
68 |
|
|
input [`UART_ADDR_WIDTH-1:0] wb_adr_i;
|
69 |
|
|
output [31:0] wb_dat32_o;
|
70 |
|
|
input re_o;
|
71 |
|
|
input [3:0] ier;
|
72 |
|
|
input [3:0] iir;
|
73 |
|
|
input [1:0] fcr; /// bits 7 and 6 of fcr. Other bits are ignored
|
74 |
|
|
input [4:0] mcr;
|
75 |
|
|
input [7:0] lcr;
|
76 |
|
|
input [7:0] msr;
|
77 |
|
|
input [7:0] lsr;
|
78 |
|
|
input [`UART_FIFO_COUNTER_W-1:0] rf_count;
|
79 |
|
|
input [`UART_FIFO_COUNTER_W-1:0] tf_count;
|
80 |
|
|
input [2:0] tstate;
|
81 |
|
|
input [3:0] rstate;
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
wire [`UART_ADDR_WIDTH-1:0] wb_adr_i;
|
85 |
|
|
reg [31:0] wb_dat32_o;
|
86 |
|
|
|
87 |
|
|
always @(/*AUTOSENSE*/fcr or ier or iir or lcr or lsr or mcr or msr
|
88 |
|
|
or rf_count or rstate or tf_count or tstate or wb_adr_i)
|
89 |
|
|
case (wb_adr_i)
|
90 |
|
|
// 8 + 8 + 4 + 4 + 8
|
91 |
|
|
5'b01000: wb_dat32_o = {msr,lcr,iir,ier,lsr};
|
92 |
|
|
// 5 + 2 + 5 + 4 + 5 + 3
|
93 |
|
|
5'b01100: wb_dat32_o = {8'b0, fcr,mcr, rf_count, rstate, tf_count, tstate};
|
94 |
|
|
default: wb_dat32_o = 0;
|
95 |
|
|
endcase // case(wb_adr_i)
|
96 |
|
|
|
97 |
|
|
endmodule
|
98 |
|
|
|