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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [mp3/] [rtl/] [verilog/] [audio/] [audio_wb_if.v] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 266 lampret
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  MP3 demo WISHBONE i/f of Audio block                        ////
4
////                                                              ////
5
////  This file is part of the MP3 demo application               ////
6
////  http://www.opencores.org/cores/or1k/mp3/                    ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  Connect the audio block to the WISHBONE bus.                ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////   - nothing really                                           ////
13
////                                                              ////
14
////  Author(s):                                                  ////
15
////      - Lior Shtram, lior.shtram@flextronicssemi.com          ////
16
////                                                              ////
17
//////////////////////////////////////////////////////////////////////
18
////                                                              ////
19
//// Copyright (C) 2001 Authors                                   ////
20
////                                                              ////
21
//// This source file may be used and distributed without         ////
22
//// restriction provided that this copyright statement is not    ////
23
//// removed from the file and that any derivative work contains  ////
24
//// the original copyright notice and the associated disclaimer. ////
25
////                                                              ////
26
//// This source file is free software; you can redistribute it   ////
27
//// and/or modify it under the terms of the GNU Lesser General   ////
28
//// Public License as published by the Free Software Foundation; ////
29
//// either version 2.1 of the License, or (at your option) any   ////
30
//// later version.                                               ////
31
////                                                              ////
32
//// This source is distributed in the hope that it will be       ////
33
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
34
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
35
//// PURPOSE.  See the GNU Lesser General Public License for more ////
36
//// details.                                                     ////
37
////                                                              ////
38
//// You should have received a copy of the GNU Lesser General    ////
39
//// Public License along with this source; if not, download it   ////
40
//// from http://www.opencores.org/lgpl.shtml                     ////
41
////                                                              ////
42
//////////////////////////////////////////////////////////////////////
43
//
44
// CVS Revision History
45
//
46
// $Log: not supported by cvs2svn $
47
//
48
 
49
// synopsys translate_off
50
`include "timescale.v"
51
// synopsys translate_on
52
 
53
module audio_wb_if (
54
        rstn,
55
        clk,
56
        wb_dat_i,
57
        wb_dat_o,
58
        wb_adr_i,
59
        wb_sel_i,
60
        wb_we_i,
61
        wb_cyc_i,
62
        wb_stb_i,
63
        wb_ack_o,
64
        wb_err_o,
65
 
66
        fifo_dat_o,
67
        fifo_clk_o,
68
        fifo_wr_en,
69
        fifo_full,
70
        fifo_empty,
71
        fifo_almost_full,
72
        fifo_almost_empty,
73
        simon,
74
        igor
75
);
76
 
77
parameter fifo_width = 16;
78
 
79
input           rstn;
80
input           clk;
81
input [31:0]     wb_dat_i;
82
output [31:0]    wb_dat_o;
83
input [31:0]     wb_adr_i;
84
input [3:0]      wb_sel_i;
85
input           wb_we_i;
86
input           wb_cyc_i;
87
input           wb_stb_i;
88
output          wb_ack_o;
89
output          wb_err_o;
90
 
91
output [fifo_width-1:0]  fifo_dat_o;
92
output          fifo_clk_o;
93
output          fifo_wr_en;
94
input           fifo_full;
95
input           fifo_empty;
96
input           fifo_almost_full;
97
input           fifo_almost_empty;
98
 
99
input simon;
100
input igor;
101
 
102
reg [3:0]        fifo_status;
103
reg             f_wr_en;
104
 
105
always @(posedge clk or negedge rstn)
106
if (!rstn) fifo_status <= 4'b0;
107
else
108
   fifo_status <= #1 { fifo_full, fifo_empty,
109
                        fifo_almost_full, fifo_almost_empty };
110
 
111
assign fifo_dat_o = wb_dat_i[fifo_width-1:0];
112
assign wb_dat_o = { simon, igor, 26'b0, fifo_status };
113
//assign wb_ack_o = wb_cyc_i & !fifo_almost_full;
114
assign wb_err_o = 1'b0;
115
assign fifo_clk_o = clk;
116
 
117
always @(posedge clk or negedge rstn)
118
begin
119
  if(!rstn)
120
    f_wr_en <= 1'b0;
121
  else
122
  if(wb_cyc_i & wb_we_i & !fifo_almost_full & ~f_wr_en)
123
    f_wr_en  <= #1 1'b1;
124
        else
125
          f_wr_en <= #1 1'b0;
126
end
127
 
128
assign fifo_wr_en = f_wr_en;
129
//assign wb_ack_o = f_wr_en;
130
assign wb_ack_o = f_wr_en | (wb_cyc_i & wb_stb_i & ~wb_we_i);
131
 
132
endmodule

powered by: WebSVN 2.1.0

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