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

Subversion Repositories ac97

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

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

powered by: WebSVN 2.1.0

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