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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 746 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
// Revision 1.1.1.1  2001/11/04 19:00:08  lampret
48
// First import.
49
//
50
//
51
 
52
// synopsys translate_off
53
`include "timescale.v"
54
// synopsys translate_on
55
 
56
module audio_wb_if (
57
        rstn,
58
        clk,
59
        wb_dat_i,
60
        wb_dat_o,
61
        wb_adr_i,
62
        wb_sel_i,
63
        wb_we_i,
64
        wb_cyc_i,
65
        wb_stb_i,
66
        wb_ack_o,
67
        wb_err_o,
68
 
69
        fifo_dat_o,
70
        fifo_clk_o,
71
        fifo_wr_en,
72
        fifo_full,
73
        fifo_empty,
74
        fifo_almost_full,
75
        fifo_almost_empty
76
);
77
 
78
parameter fifo_width = 16;
79
 
80
input           rstn;
81
input           clk;
82
input [31:0]     wb_dat_i;
83
output [31:0]    wb_dat_o;
84
input [31:0]     wb_adr_i;
85
input [3:0]      wb_sel_i;
86
input           wb_we_i;
87
input           wb_cyc_i;
88
input           wb_stb_i;
89
output          wb_ack_o;
90
output          wb_err_o;
91
 
92
output [fifo_width-1:0]  fifo_dat_o;
93
output          fifo_clk_o;
94
output          fifo_wr_en;
95
input           fifo_full;
96
input           fifo_empty;
97
input           fifo_almost_full;
98
input           fifo_almost_empty;
99
 
100
reg [3:0]        fifo_status;
101
reg             f_wr_en;
102
 
103
always @(posedge clk or negedge rstn)
104
if (!rstn) fifo_status <= 4'b0;
105
else
106
   fifo_status <= #1 { fifo_full, fifo_empty,
107
                        fifo_almost_full, fifo_almost_empty };
108
 
109
assign fifo_dat_o = wb_dat_i[fifo_width-1:0];
110
assign wb_dat_o = { 28'b0, fifo_status };
111
//assign wb_ack_o = wb_cyc_i & !fifo_almost_full;
112
assign wb_err_o = 1'b0;
113
assign fifo_clk_o = clk;
114
 
115
always @(posedge clk or negedge rstn)
116
begin
117
  if(!rstn)
118
    f_wr_en <= 1'b0;
119
  else
120
  if(wb_cyc_i & wb_we_i & !fifo_almost_full & ~f_wr_en)
121
    f_wr_en  <= #1 1'b1;
122
        else
123
          f_wr_en <= #1 1'b0;
124
end
125
 
126
assign fifo_wr_en = f_wr_en;
127
//assign wb_ack_o = f_wr_en;
128
assign wb_ack_o = f_wr_en | (wb_cyc_i & wb_stb_i & ~wb_we_i);
129
 
130
endmodule

powered by: WebSVN 2.1.0

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