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

Subversion Repositories ac97

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

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 14 rudi
//// Copyright (C) 2000-2002 Rudolf Usselmann                    ////
16
////                         www.asics.ws                        ////
17
////                         rudi@asics.ws                       ////
18 4 rudi
////                                                             ////
19
//// This source file may be used and distributed without        ////
20
//// restriction provided that this copyright statement is not   ////
21
//// removed from the file and that any derivative work contains ////
22
//// the original copyright notice and the associated disclaimer.////
23
////                                                             ////
24
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
25
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
26
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
27
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
28
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
29
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
30
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
31
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
32
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
33
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
34
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
35
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
36
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
37
////                                                             ////
38
/////////////////////////////////////////////////////////////////////
39
 
40
//  CVS Log
41
//
42 14 rudi
//  $Id: ac97_wb_if.v,v 1.4 2002-09-19 06:30:56 rudi Exp $
43 4 rudi
//
44 14 rudi
//  $Date: 2002-09-19 06:30:56 $
45
//  $Revision: 1.4 $
46 4 rudi
//  $Author: rudi $
47
//  $Locker:  $
48
//  $State: Exp $
49
//
50
// Change History:
51
//               $Log: not supported by cvs2svn $
52 14 rudi
//               Revision 1.3  2002/03/05 04:44:05  rudi
53
//
54
//               - Fixed the order of the thrash hold bits to match the spec.
55
//               - Many minor synthesis cleanup items ...
56
//
57 10 rudi
//               Revision 1.2  2001/08/10 08:09:42  rudi
58
//
59
//               - Removed RTY_O output.
60
//               - Added Clock and Reset Inputs to documentation.
61
//               - Changed IO names to be more clear.
62
//               - Uniquifyed define names to be core specific.
63
//
64 6 rudi
//               Revision 1.1  2001/08/03 06:54:50  rudi
65
//
66
//
67
//               - Changed to new directory structure
68
//
69 4 rudi
//               Revision 1.1.1.1  2001/05/19 02:29:16  rudi
70
//               Initial Checkin
71
//
72
//
73
//
74
//
75
 
76
`include "ac97_defines.v"
77
 
78
module ac97_wb_if(clk, rst,
79
 
80
                wb_data_i, wb_data_o, wb_addr_i, wb_sel_i, wb_we_i, wb_cyc_i,
81
                wb_stb_i, wb_ack_o, wb_err_o,
82
 
83
                adr, dout, rf_din, i3_din, i4_din, i6_din,
84
                rf_we, rf_re, o3_we, o4_we, o6_we, o7_we, o8_we, o9_we,
85
                i3_re, i4_re, i6_re
86
 
87
                );
88
 
89
input           clk,rst;
90
 
91
// WISHBONE Interface
92
input   [31:0]   wb_data_i;
93
output  [31:0]   wb_data_o;
94
input   [31:0]   wb_addr_i;
95
input   [3:0]    wb_sel_i;
96
input           wb_we_i;
97
input           wb_cyc_i;
98
input           wb_stb_i;
99
output          wb_ack_o;
100
output          wb_err_o;
101
 
102
// Internal Interface
103
output  [3:0]    adr;
104
output  [31:0]   dout;
105
input   [31:0]   rf_din, i3_din, i4_din, i6_din;
106
output          rf_we;
107
output          rf_re;
108
output          o3_we, o4_we, o6_we, o7_we, o8_we, o9_we;
109
output          i3_re, i4_re, i6_re;
110
 
111
////////////////////////////////////////////////////////////////////
112
//
113
// Local Wires
114
//
115
 
116
reg     [31:0]   wb_data_o;
117
reg     [31:0]   dout;
118
reg             wb_ack_o;
119
 
120
reg             rf_we;
121
reg             o3_we, o4_we, o6_we, o7_we, o8_we, o9_we;
122
reg             i3_re, i4_re, i6_re;
123
 
124
reg             we1, we2;
125
wire            we;
126
reg             re2, re1;
127
wire            re;
128
 
129
////////////////////////////////////////////////////////////////////
130
//
131
// Modules
132
//
133
 
134
assign adr = wb_addr_i[5:2];
135
 
136 10 rudi
assign wb_err_o = 1'b0;
137 4 rudi
 
138
always @(posedge clk)
139
        dout <= #1 wb_data_i;
140
 
141
always @(posedge clk)
142
        case(wb_addr_i[6:2])    // synopsys parallel_case full_case
143 10 rudi
           5'he: wb_data_o <= #1 i3_din;
144
           5'hf: wb_data_o <= #1 i4_din;
145
           5'h10: wb_data_o <= #1 i6_din;
146 4 rudi
           default: wb_data_o <= #1 rf_din;
147
        endcase
148
 
149
always @(posedge clk)
150 6 rudi
        re1 <= #1 !re2 & wb_cyc_i & wb_stb_i & !wb_we_i & `AC97_REG_SEL;
151 4 rudi
 
152
always @(posedge clk)
153
        re2 <= #1 re & wb_cyc_i & wb_stb_i & !wb_we_i ;
154
 
155
assign re = re1 & !re2 & wb_cyc_i & wb_stb_i & !wb_we_i;
156
 
157 10 rudi
assign rf_re = re & (wb_addr_i[6:2] < 5'h8);
158 4 rudi
 
159
always @(posedge clk)
160 6 rudi
        we1 <= #1 !we & wb_cyc_i & wb_stb_i & wb_we_i & `AC97_REG_SEL;
161 4 rudi
 
162
always @(posedge clk)
163
        we2 <= #1 we1 & wb_cyc_i & wb_stb_i & wb_we_i;
164
 
165
assign we = we1 & !we2 & wb_cyc_i & wb_stb_i & wb_we_i;
166
 
167
always @(posedge clk)
168
        wb_ack_o <= #1 (re | we) & wb_cyc_i & wb_stb_i & ~wb_ack_o;
169
 
170
always @(posedge clk)
171 10 rudi
        rf_we <= #1 we & (wb_addr_i[6:2] < 5'h8);
172 4 rudi
 
173
always @(posedge clk)
174 10 rudi
        o3_we <= #1 we & (wb_addr_i[6:2] == 5'h8);
175 4 rudi
 
176
always @(posedge clk)
177 10 rudi
        o4_we <= #1 we & (wb_addr_i[6:2] == 5'h9);
178 4 rudi
 
179
always @(posedge clk)
180 10 rudi
        o6_we <= #1 we & (wb_addr_i[6:2] == 5'ha);
181 4 rudi
 
182
always @(posedge clk)
183 10 rudi
        o7_we <= #1 we & (wb_addr_i[6:2] == 5'hb);
184 4 rudi
 
185
always @(posedge clk)
186 10 rudi
        o8_we <= #1 we & (wb_addr_i[6:2] == 5'hc);
187 4 rudi
 
188
always @(posedge clk)
189 10 rudi
        o9_we <= #1 we & (wb_addr_i[6:2] == 5'hd);
190 4 rudi
 
191
always @(posedge clk)
192 10 rudi
        i3_re <= #1 re & (wb_addr_i[6:2] == 5'he);
193 4 rudi
 
194
always @(posedge clk)
195 10 rudi
        i4_re <= #1 re & (wb_addr_i[6:2] == 5'hf);
196 4 rudi
 
197
always @(posedge clk)
198 10 rudi
        i6_re <= #1 re & (wb_addr_i[6:2] == 5'h10);
199 4 rudi
 
200
endmodule

powered by: WebSVN 2.1.0

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