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

Subversion Repositories ac97

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

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

powered by: WebSVN 2.1.0

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