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

Subversion Repositories wb_dma

[/] [wb_dma/] [trunk/] [rtl/] [verilog/] [wb_dma_wb_mast.v] - Blame information for rev 17

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 rudi
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  WISHBONE DMA WISHBONE Master Interface                     ////
4
////                                                             ////
5
////                                                             ////
6
////  Author: Rudolf Usselmann                                   ////
7
////          rudi@asics.ws                                      ////
8
////                                                             ////
9
////                                                             ////
10
////  Downloaded from: http://www.opencores.org/cores/wb_dma/    ////
11
////                                                             ////
12
/////////////////////////////////////////////////////////////////////
13
////                                                             ////
14 15 rudi
//// Copyright (C) 2000-2002 Rudolf Usselmann                    ////
15
////                         www.asics.ws                        ////
16
////                         rudi@asics.ws                       ////
17 5 rudi
////                                                             ////
18
//// This source file may be used and distributed without        ////
19
//// restriction provided that this copyright statement is not   ////
20
//// removed from the file and that any derivative work contains ////
21
//// the original copyright notice and the associated disclaimer.////
22
////                                                             ////
23
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
24
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
25
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
26
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
27
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
28
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
29
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
30
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
31
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
32
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
33
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
34
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
35
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
36
////                                                             ////
37
/////////////////////////////////////////////////////////////////////
38
 
39
//  CVS Log
40
//
41 15 rudi
//  $Id: wb_dma_wb_mast.v,v 1.2 2002-02-01 01:54:45 rudi Exp $
42 5 rudi
//
43 15 rudi
//  $Date: 2002-02-01 01:54:45 $
44
//  $Revision: 1.2 $
45 5 rudi
//  $Author: rudi $
46
//  $Locker:  $
47
//  $State: Exp $
48
//
49
// Change History:
50
//               $Log: not supported by cvs2svn $
51 15 rudi
//               Revision 1.1  2001/07/29 08:57:02  rudi
52
//
53
//
54
//               1) Changed Directory Structure
55
//               2) Added restart signal (REST)
56
//
57 5 rudi
//               Revision 1.2  2001/06/05 10:22:37  rudi
58
//
59
//
60
//               - Added Support of up to 31 channels
61
//               - Added support for 2,4 and 8 priority levels
62
//               - Now can have up to 31 channels
63
//               - Added many configuration items
64
//               - Changed reset to async
65
//
66
//               Revision 1.1.1.1  2001/03/19 13:11:05  rudi
67
//               Initial Release
68
//
69
//
70
//
71
 
72
`include "wb_dma_defines.v"
73
 
74
module wb_dma_wb_mast(clk, rst,
75
 
76
        wb_data_i, wb_data_o, wb_addr_o, wb_sel_o, wb_we_o, wb_cyc_o,
77
        wb_stb_o, wb_ack_i, wb_err_i, wb_rty_i,
78
 
79
        mast_go, mast_we, mast_adr, mast_din, mast_dout, mast_err,
80
        mast_drdy, mast_wait,
81
 
82
        pt_sel, mast_pt_in, mast_pt_out
83
        );
84
 
85
input           clk, rst;
86
 
87
// --------------------------------------
88
// WISHBONE INTERFACE 
89
 
90
input   [31:0]   wb_data_i;
91
output  [31:0]   wb_data_o;
92
output  [31:0]   wb_addr_o;
93
output  [3:0]    wb_sel_o;
94
output          wb_we_o;
95
output          wb_cyc_o;
96
output          wb_stb_o;
97
input           wb_ack_i;
98
input           wb_err_i;
99
input           wb_rty_i;
100
 
101
// --------------------------------------
102
// INTERNAL DMA INTERFACE 
103
input           mast_go;        // Perform a Master Cycle (as long as this
104
                                // line is asserted)
105
input           mast_we;        // Read/Write
106
input   [31:0]   mast_adr;       // Address for the transfer
107
input   [31:0]   mast_din;       // Internal Input Data
108
output  [31:0]   mast_dout;      // Internal Output Data
109
output          mast_err;       // Indicates an error has occurred
110
 
111
output          mast_drdy;      // Indicated that either data is available
112
                                // during a read, or that the master can accept
113
                                // the next data during a write
114
input           mast_wait;      // Tells the master to insert wait cycles
115
                                // because data can not be accepted/provided
116
 
117
// Pass Through Interface
118
input           pt_sel;         // Pass Through Mode Selected
119
input   [70:0]   mast_pt_in;     // Grouped WISHBONE inputs
120
output  [34:0]   mast_pt_out;    // Grouped WISHBONE outputs
121
 
122
////////////////////////////////////////////////////////////////////
123
//
124
// Local Wires
125
//
126
 
127
reg             mast_cyc, mast_stb;
128
reg             mast_we_r;
129
reg     [3:0]    mast_be;
130
reg     [31:0]   mast_dout;
131
 
132
////////////////////////////////////////////////////////////////////
133
//
134
// Pass-Through Interface
135
//
136
 
137
assign {wb_data_o, wb_addr_o, wb_sel_o, wb_we_o, wb_cyc_o, wb_stb_o} =
138
        pt_sel ? mast_pt_in :
139
        {mast_din, mast_adr, mast_be, mast_we_r, mast_cyc, mast_stb};
140
 
141
assign mast_pt_out = {wb_data_i, wb_ack_i, wb_err_i, wb_rty_i};
142
 
143
////////////////////////////////////////////////////////////////////
144
//
145
// DMA Engine Interface
146
//
147
 
148
always @(posedge clk)
149
        if(wb_ack_i)    mast_dout <= #1 wb_data_i;
150
 
151
always @(posedge clk)
152
        mast_be <= #1 4'hf;
153
 
154
always @(posedge clk)
155
        mast_we_r <= #1 mast_we;
156
 
157
always @(posedge clk)
158
        mast_cyc <= #1 mast_go;
159
 
160
always @(posedge clk)
161
        mast_stb <= #1 mast_go & !mast_wait;
162
 
163
assign mast_drdy = wb_ack_i;
164
assign mast_err  = wb_err_i;
165
 
166
endmodule

powered by: WebSVN 2.1.0

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