1 |
4 |
rudi |
/////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// WISHBONE AC 97 Controller ////
|
4 |
|
|
//// DMA Request Module ////
|
5 |
|
|
//// ////
|
6 |
|
|
//// ////
|
7 |
|
|
//// Author: Rudolf Usselmann ////
|
8 |
|
|
//// rudi@asics.ws ////
|
9 |
|
|
//// ////
|
10 |
|
|
//// ////
|
11 |
|
|
//// Downloaded from: http://www.opencores.org/cores/ac97_ctrl/ ////
|
12 |
|
|
//// ////
|
13 |
|
|
/////////////////////////////////////////////////////////////////////
|
14 |
|
|
//// ////
|
15 |
|
|
//// Copyright (C) 2001 Rudolf Usselmann ////
|
16 |
|
|
//// rudi@asics.ws ////
|
17 |
|
|
//// ////
|
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 |
|
|
// $Id: ac97_dma_req.v,v 1.1 2001-08-03 06:54:49 rudi Exp $
|
42 |
|
|
//
|
43 |
|
|
// $Date: 2001-08-03 06:54:49 $
|
44 |
|
|
// $Revision: 1.1 $
|
45 |
|
|
// $Author: rudi $
|
46 |
|
|
// $Locker: $
|
47 |
|
|
// $State: Exp $
|
48 |
|
|
//
|
49 |
|
|
// Change History:
|
50 |
|
|
// $Log: not supported by cvs2svn $
|
51 |
|
|
// Revision 1.1.1.1 2001/05/19 02:29:16 rudi
|
52 |
|
|
// Initial Checkin
|
53 |
|
|
//
|
54 |
|
|
//
|
55 |
|
|
//
|
56 |
|
|
//
|
57 |
|
|
|
58 |
|
|
`include "ac97_defines.v"
|
59 |
|
|
|
60 |
|
|
module ac97_dma_req(clk, rst, cfg, status, full_empty, dma_req, dma_ack);
|
61 |
|
|
input clk, rst;
|
62 |
|
|
input [7:0] cfg;
|
63 |
|
|
input [1:0] status;
|
64 |
|
|
input full_empty;
|
65 |
|
|
output dma_req;
|
66 |
|
|
input dma_ack;
|
67 |
|
|
|
68 |
|
|
////////////////////////////////////////////////////////////////////
|
69 |
|
|
//
|
70 |
|
|
// Local Wires
|
71 |
|
|
//
|
72 |
|
|
reg dma_req_d;
|
73 |
|
|
reg dma_req_r1;
|
74 |
|
|
reg dma_req;
|
75 |
|
|
|
76 |
|
|
////////////////////////////////////////////////////////////////////
|
77 |
|
|
//
|
78 |
|
|
// Misc Logic
|
79 |
|
|
//
|
80 |
|
|
|
81 |
|
|
always @(cfg or status or full_empty)
|
82 |
|
|
case(cfg[5:4]) // synopsys parallel_case full_case
|
83 |
|
|
// REQ = Ch_EN & DMA_EN & Status
|
84 |
|
|
// 1/4 full/empty
|
85 |
|
|
0: dma_req_d = cfg[0] & cfg[6] & (full_empty | (status == 2'd0));
|
86 |
|
|
// 1/2 full/empty
|
87 |
|
|
1: dma_req_d = cfg[0] & cfg[6] & (full_empty | (status[1] == 1'd0));
|
88 |
|
|
// 3/4 full/empty
|
89 |
|
|
2: dma_req_d = cfg[0] & cfg[6] & (full_empty | (status < 2'd3));
|
90 |
|
|
3: dma_req_d = cfg[0] & cfg[6] & full_empty;
|
91 |
|
|
endcase
|
92 |
|
|
|
93 |
|
|
always @(posedge clk)
|
94 |
|
|
dma_req_r1 <= #1 dma_req_d & !dma_ack;
|
95 |
|
|
|
96 |
|
|
always @(posedge clk or negedge rst)
|
97 |
|
|
if(!rst) dma_req <= #1 0;
|
98 |
|
|
else
|
99 |
|
|
if(dma_req_r1 & dma_req_d & !dma_ack) dma_req <= #1 1;
|
100 |
|
|
else
|
101 |
|
|
if(dma_ack) dma_req <= #1 0;
|
102 |
|
|
|
103 |
|
|
endmodule
|
104 |
|
|
|