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

Subversion Repositories ac97

[/] [ac97/] [trunk/] [rtl/] [verilog/] [ac97_wb_if.v] - Blame information for rev 6

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

Line No. Rev Author Line
1 4 rudi
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  WISHBONE AC 97 Controller                                  ////
4
////  WISHBONE Interface 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 6 rudi
//  $Id: ac97_wb_if.v,v 1.2 2001-08-10 08:09:42 rudi Exp $
42 4 rudi
//
43 6 rudi
//  $Date: 2001-08-10 08:09:42 $
44
//  $Revision: 1.2 $
45 4 rudi
//  $Author: rudi $
46
//  $Locker:  $
47
//  $State: Exp $
48
//
49
// Change History:
50
//               $Log: not supported by cvs2svn $
51 6 rudi
//               Revision 1.1  2001/08/03 06:54:50  rudi
52
//
53
//
54
//               - Changed to new directory structure
55
//
56 4 rudi
//               Revision 1.1.1.1  2001/05/19 02:29:16  rudi
57
//               Initial Checkin
58
//
59
//
60
//
61
//
62
 
63
`include "ac97_defines.v"
64
 
65
module ac97_wb_if(clk, rst,
66
 
67
                wb_data_i, wb_data_o, wb_addr_i, wb_sel_i, wb_we_i, wb_cyc_i,
68
                wb_stb_i, wb_ack_o, wb_err_o,
69
 
70
                adr, dout, rf_din, i3_din, i4_din, i6_din,
71
                rf_we, rf_re, o3_we, o4_we, o6_we, o7_we, o8_we, o9_we,
72
                i3_re, i4_re, i6_re
73
 
74
                );
75
 
76
input           clk,rst;
77
 
78
// WISHBONE Interface
79
input   [31:0]   wb_data_i;
80
output  [31:0]   wb_data_o;
81
input   [31:0]   wb_addr_i;
82
input   [3:0]    wb_sel_i;
83
input           wb_we_i;
84
input           wb_cyc_i;
85
input           wb_stb_i;
86
output          wb_ack_o;
87
output          wb_err_o;
88
 
89
// Internal Interface
90
output  [3:0]    adr;
91
output  [31:0]   dout;
92
input   [31:0]   rf_din, i3_din, i4_din, i6_din;
93
output          rf_we;
94
output          rf_re;
95
output          o3_we, o4_we, o6_we, o7_we, o8_we, o9_we;
96
output          i3_re, i4_re, i6_re;
97
 
98
////////////////////////////////////////////////////////////////////
99
//
100
// Local Wires
101
//
102
 
103
reg     [31:0]   wb_data_o;
104
reg     [31:0]   dout;
105
reg             wb_ack_o;
106
 
107
reg             rf_we;
108
reg             o3_we, o4_we, o6_we, o7_we, o8_we, o9_we;
109
reg             i3_re, i4_re, i6_re;
110
 
111
reg             we1, we2;
112
wire            we;
113
reg             re2, re1;
114
wire            re;
115
 
116
////////////////////////////////////////////////////////////////////
117
//
118
// Modules
119
//
120
 
121
assign adr = wb_addr_i[5:2];
122
 
123
assign wb_err_o = 0;
124
 
125
always @(posedge clk)
126
        dout <= #1 wb_data_i;
127
 
128
always @(posedge clk)
129
        case(wb_addr_i[6:2])    // synopsys parallel_case full_case
130
           14: wb_data_o <= #1 i3_din;
131
           15: wb_data_o <= #1 i4_din;
132
           16: wb_data_o <= #1 i6_din;
133
           default: wb_data_o <= #1 rf_din;
134
        endcase
135
 
136
always @(posedge clk)
137 6 rudi
        re1 <= #1 !re2 & wb_cyc_i & wb_stb_i & !wb_we_i & `AC97_REG_SEL;
138 4 rudi
 
139
always @(posedge clk)
140
        re2 <= #1 re & wb_cyc_i & wb_stb_i & !wb_we_i ;
141
 
142
assign re = re1 & !re2 & wb_cyc_i & wb_stb_i & !wb_we_i;
143
 
144
assign rf_re = re & (wb_addr_i[6:2] < 8);
145
 
146
always @(posedge clk)
147 6 rudi
        we1 <= #1 !we & wb_cyc_i & wb_stb_i & wb_we_i & `AC97_REG_SEL;
148 4 rudi
 
149
always @(posedge clk)
150
        we2 <= #1 we1 & wb_cyc_i & wb_stb_i & wb_we_i;
151
 
152
assign we = we1 & !we2 & wb_cyc_i & wb_stb_i & wb_we_i;
153
 
154
always @(posedge clk)
155
        wb_ack_o <= #1 (re | we) & wb_cyc_i & wb_stb_i & ~wb_ack_o;
156
 
157
always @(posedge clk)
158
        rf_we <= #1 we & (wb_addr_i[6:2] < 8);
159
 
160
always @(posedge clk)
161
        o3_we <= #1 we & (wb_addr_i[6:2] == 8);
162
 
163
always @(posedge clk)
164
        o4_we <= #1 we & (wb_addr_i[6:2] == 9);
165
 
166
always @(posedge clk)
167
        o6_we <= #1 we & (wb_addr_i[6:2] == 10);
168
 
169
always @(posedge clk)
170
        o7_we <= #1 we & (wb_addr_i[6:2] == 11);
171
 
172
always @(posedge clk)
173
        o8_we <= #1 we & (wb_addr_i[6:2] == 12);
174
 
175
always @(posedge clk)
176
        o9_we <= #1 we & (wb_addr_i[6:2] == 13);
177
 
178
always @(posedge clk)
179
        i3_re <= #1 re & (wb_addr_i[6:2] == 14);
180
 
181
always @(posedge clk)
182
        i4_re <= #1 re & (wb_addr_i[6:2] == 15);
183
 
184
always @(posedge clk)
185
        i6_re <= #1 re & (wb_addr_i[6:2] == 16);
186
 
187
endmodule

powered by: WebSVN 2.1.0

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