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

Subversion Repositories ac97

[/] [ac97/] [trunk/] [rtl/] [verilog/] [ac97_in_fifo.v] - Diff between revs 10 and 12

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 10 Rev 12
Line 36... Line 36...
////                                                             ////
////                                                             ////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
 
 
//  CVS Log
//  CVS Log
//
//
//  $Id: ac97_in_fifo.v,v 1.2 2002-03-05 04:44:05 rudi Exp $
//  $Id: ac97_in_fifo.v,v 1.3 2002-03-11 03:21:22 rudi Exp $
//
//
//  $Date: 2002-03-05 04:44:05 $
//  $Date: 2002-03-11 03:21:22 $
//  $Revision: 1.2 $
//  $Revision: 1.3 $
//  $Author: rudi $
//  $Author: rudi $
//  $Locker:  $
//  $Locker:  $
//  $State: Exp $
//  $State: Exp $
//
//
// Change History:
// Change History:
//               $Log: not supported by cvs2svn $
//               $Log: not supported by cvs2svn $
 
//               Revision 1.2  2002/03/05 04:44:05  rudi
 
//
 
//               - Fixed the order of the thrash hold bits to match the spec.
 
//               - Many minor synthesis cleanup items ...
 
//
//               Revision 1.1  2001/08/03 06:54:50  rudi
//               Revision 1.1  2001/08/03 06:54:50  rudi
//
//
//
//
//               - Changed to new directory structure
//               - Changed to new directory structure
//
//
Line 60... Line 65...
//
//
//
//
 
 
`include "ac97_defines.v"
`include "ac97_defines.v"
 
 
 
`ifdef AC97_IN_FIFO_DEPTH_4
 
 
 
// 4 entry deep verion of the input FIFO
 
 
module ac97_in_fifo(clk, rst, en, mode, din, we, dout, re, status, full, empty);
module ac97_in_fifo(clk, rst, en, mode, din, we, dout, re, status, full, empty);
 
 
input           clk, rst;
input           clk, rst;
input           en;
input           en;
input   [1:0]    mode;
input   [1:0]    mode;
Line 113... Line 122...
        if(!en)         rp <= #1 3'h0;
        if(!en)         rp <= #1 3'h0;
        else
        else
        if(re)          rp <= #1 rp + 3'h1;
        if(re)          rp <= #1 rp + 3'h1;
 
 
always @(posedge clk)
always @(posedge clk)
        status <= #1 ((rp - wp[2:1]) - 2'h1);
        status <= #1 ((rp[1:0] - wp[2:1]) - 2'h1);
 
 
always @(posedge clk)
always @(posedge clk)
        empty <= #1 (wp[3:1] == rp[2:0]) & (m16b ? !wp[0] : 1'b0);
        empty <= #1 (wp[3:1] == rp[2:0]) & (m16b ? !wp[0] : 1'b0);
 
 
always @(posedge clk)
always @(posedge clk)
Line 131... Line 140...
always @(posedge clk)
always @(posedge clk)
        if(we & !wp[0])  din_tmp1 <= #1 din[19:4];
        if(we & !wp[0])  din_tmp1 <= #1 din[19:4];
 
 
always @(mode or din_tmp1 or din)
always @(mode or din_tmp1 or din)
        case(mode)      // synopsys parallel_case full_case
        case(mode)      // synopsys parallel_case full_case
           0: din_tmp = {din[19:4], din_tmp1};           // 16 Bit Output
           2'h0: din_tmp = {din[19:4], din_tmp1};       // 16 Bit Output
           1: din_tmp = {13'h0, din[17:0]};              // 18 bit Output
           2'h1: din_tmp = {13'h0, din[17:0]};           // 18 bit Output
           2: din_tmp = {11'h0, din[19:0]};              // 20 Bit Output
           2'h2: din_tmp = {11'h0, din[19:0]};           // 20 Bit Output
        endcase
        endcase
 
 
always @(posedge clk)
always @(posedge clk)
        if(we & (!m16b | (m16b & wp[0]) ) )      mem[ wp[2:1] ] <= #1 din_tmp;
        if(we & (!m16b | (m16b & wp[0]) ) )      mem[ wp[2:1] ] <= #1 din_tmp;
 
 
endmodule
endmodule
 
 
 No newline at end of file
 No newline at end of file
 
`endif
 
 
 
`ifdef AC97_IN_FIFO_DEPTH_8
 
 
 
// 8 entry deep verion of the input FIFO
 
 
 
module ac97_in_fifo(clk, rst, en, mode, din, we, dout, re, status, full, empty);
 
 
 
input           clk, rst;
 
input           en;
 
input   [1:0]    mode;
 
input   [19:0]   din;
 
input           we;
 
output  [31:0]   dout;
 
input           re;
 
output  [1:0]    status;
 
output          full;
 
output          empty;
 
 
 
 
 
////////////////////////////////////////////////////////////////////
 
//
 
// Local Wires
 
//
 
 
 
reg     [31:0]   mem[0:7];
 
reg     [31:0]   dout;
 
 
 
reg     [4:0]    wp;
 
reg     [3:0]    rp;
 
 
 
wire    [4:0]    wp_p1;
 
 
 
reg     [1:0]    status;
 
reg     [15:0]   din_tmp1;
 
reg     [31:0]   din_tmp;
 
wire            m16b;
 
reg             full, empty;
 
 
 
////////////////////////////////////////////////////////////////////
 
//
 
// Misc Logic
 
//
 
 
 
assign m16b = (mode == 2'h0);   // 16 Bit Mode
 
 
 
always @(posedge clk)
 
        if(!en)         wp <= #1 5'h0;
 
        else
 
        if(we)          wp <= #1 wp_p1;
 
 
 
assign wp_p1 = m16b ? (wp + 5'h1) : (wp + 5'h2);
 
 
 
always @(posedge clk)
 
        if(!en)         rp <= #1 4'h0;
 
        else
 
        if(re)          rp <= #1 rp + 4'h1;
 
 
 
always @(posedge clk)
 
        status <= #1 ((rp[2:1] - wp[3:2]) - 2'h1);
 
 
 
always @(posedge clk)
 
        empty <= #1 (wp[4:1] == rp[3:0]) & (m16b ? !wp[0] : 1'b0);
 
 
 
always @(posedge clk)
 
        full  <= #1 (wp[3:1] == rp[2:0]) & (wp[4] != rp[3]);
 
 
 
// Fifo Output
 
always @(posedge clk)
 
        dout <= #1 mem[ rp[2:0] ];
 
 
 
// Fifo Input Half Word Latch
 
always @(posedge clk)
 
        if(we & !wp[0])  din_tmp1 <= #1 din[19:4];
 
 
 
always @(mode or din_tmp1 or din)
 
        case(mode)      // synopsys parallel_case full_case
 
           2'h0: din_tmp = {din[19:4], din_tmp1};       // 16 Bit Output
 
           2'h1: din_tmp = {13'h0, din[17:0]};           // 18 bit Output
 
           2'h2: din_tmp = {11'h0, din[19:0]};           // 20 Bit Output
 
        endcase
 
 
 
always @(posedge clk)
 
        if(we & (!m16b | (m16b & wp[0]) ) )      mem[ wp[3:1] ] <= #1 din_tmp;
 
 
 
endmodule
 
 
 
`endif
 
 
 
 
 
`ifdef AC97_IN_FIFO_DEPTH_16
 
 
 
// 16 entry deep verion of the input FIFO
 
 
 
module ac97_in_fifo(clk, rst, en, mode, din, we, dout, re, status, full, empty);
 
 
 
input           clk, rst;
 
input           en;
 
input   [1:0]    mode;
 
input   [19:0]   din;
 
input           we;
 
output  [31:0]   dout;
 
input           re;
 
output  [1:0]    status;
 
output          full;
 
output          empty;
 
 
 
 
 
////////////////////////////////////////////////////////////////////
 
//
 
// Local Wires
 
//
 
 
 
reg     [31:0]   mem[0:15];
 
reg     [31:0]   dout;
 
 
 
reg     [5:0]    wp;
 
reg     [4:0]    rp;
 
 
 
wire    [5:0]    wp_p1;
 
 
 
reg     [1:0]    status;
 
reg     [15:0]   din_tmp1;
 
reg     [31:0]   din_tmp;
 
wire            m16b;
 
reg             full, empty;
 
 
 
////////////////////////////////////////////////////////////////////
 
//
 
// Misc Logic
 
//
 
 
 
assign m16b = (mode == 2'h0);   // 16 Bit Mode
 
 
 
always @(posedge clk)
 
        if(!en)         wp <= #1 6'h0;
 
        else
 
        if(we)          wp <= #1 wp_p1;
 
 
 
assign wp_p1 = m16b ? (wp + 6'h1) : (wp + 6'h2);
 
 
 
always @(posedge clk)
 
        if(!en)         rp <= #1 5'h0;
 
        else
 
        if(re)          rp <= #1 rp + 5'h1;
 
 
 
always @(posedge clk)
 
        status <= #1 ((rp[3:2] - wp[4:3]) - 2'h1);
 
 
 
always @(posedge clk)
 
        empty <= #1 (wp[5:1] == rp[4:0]) & (m16b ? !wp[0] : 1'b0);
 
 
 
always @(posedge clk)
 
        full  <= #1 (wp[4:1] == rp[3:0]) & (wp[5] != rp[4]);
 
 
 
// Fifo Output
 
always @(posedge clk)
 
        dout <= #1 mem[ rp[3:0] ];
 
 
 
// Fifo Input Half Word Latch
 
always @(posedge clk)
 
        if(we & !wp[0])  din_tmp1 <= #1 din[19:4];
 
 
 
always @(mode or din_tmp1 or din)
 
        case(mode)      // synopsys parallel_case full_case
 
           2'h0: din_tmp = {din[19:4], din_tmp1};       // 16 Bit Output
 
           2'h1: din_tmp = {13'h0, din[17:0]};           // 18 bit Output
 
           2'h2: din_tmp = {11'h0, din[19:0]};           // 20 Bit Output
 
        endcase
 
 
 
always @(posedge clk)
 
        if(we & (!m16b | (m16b & wp[0]) ) )      mem[ wp[4:1] ] <= #1 din_tmp;
 
 
 
endmodule
 
 
 
`endif
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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