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

Subversion Repositories dma_axi

[/] [dma_axi/] [trunk/] [src/] [dma_axi64/] [prgen_fifo.v] - Diff between revs 2 and 4

Only display areas with differences | Details | Blame | View Log

Rev 2 Rev 4
 
/////////////////////////////////////////////////////////////////////
 
////                                                             ////
 
////  Author: Eyal Hochberg                                      ////
 
////          eyal@provartec.com                                 ////
 
////                                                             ////
 
////  Downloaded from: http://www.opencores.org                  ////
 
/////////////////////////////////////////////////////////////////////
 
////                                                             ////
 
//// Copyright (C) 2010 Provartec LTD                            ////
 
//// www.provartec.com                                           ////
 
//// info@provartec.com                                          ////
 
////                                                             ////
 
//// This source file may be used and distributed without        ////
 
//// restriction provided that this copyright statement is not   ////
 
//// removed from the file and that any derivative work contains ////
 
//// the original copyright notice and the associated disclaimer.////
 
////                                                             ////
 
//// This source file is free software; you can redistribute it  ////
 
//// and/or modify it under the terms of the GNU Lesser General  ////
 
//// Public License as published by the Free Software Foundation.////
 
////                                                             ////
 
//// This source is distributed in the hope that it will be      ////
 
//// useful, but WITHOUT ANY WARRANTY; without even the implied  ////
 
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR     ////
 
//// PURPOSE.  See the GNU Lesser General Public License for more////
 
//// details. http://www.gnu.org/licenses/lgpl.html              ////
 
////                                                             ////
 
/////////////////////////////////////////////////////////////////////
//---------------------------------------------------------
//---------------------------------------------------------
//-- File generated by RobustVerilog parser
//-- File generated by RobustVerilog parser
//-- Version: 1.0
//-- Version: 1.0
//-- Invoked Fri Mar 25 23:36:54 2011
//-- Invoked Fri Mar 25 23:36:54 2011
//--
//--
//-- Source file: prgen_fifo.v
//-- Source file: prgen_fifo.v
//---------------------------------------------------------
//---------------------------------------------------------
 
 
 
 
 
 
module prgen_fifo(clk,reset,push,pop,din,dout,empty,full);
module prgen_fifo(clk,reset,push,pop,din,dout,empty,full);
 
 
   parameter                  WIDTH      = 8;
   parameter                  WIDTH      = 8;
   parameter                  DEPTH_FULL = 8;
   parameter                  DEPTH_FULL = 8;
 
 
   parameter               SINGLE     = DEPTH_FULL == 1;
   parameter               SINGLE     = DEPTH_FULL == 1;
   parameter               DEPTH      = SINGLE ? 1 : DEPTH_FULL -1;
   parameter               DEPTH      = SINGLE ? 1 : DEPTH_FULL -1;
   parameter               DEPTH_BITS =
   parameter               DEPTH_BITS =
                  (DEPTH <= 2)   ? 1 :
                  (DEPTH <= 2)   ? 1 :
                  (DEPTH <= 4)   ? 2 :
                  (DEPTH <= 4)   ? 2 :
                  (DEPTH <= 8)   ? 3 :
                  (DEPTH <= 8)   ? 3 :
                  (DEPTH <= 16)  ? 4 :
                  (DEPTH <= 16)  ? 4 :
                  (DEPTH <= 32)  ? 5 :
                  (DEPTH <= 32)  ? 5 :
                  (DEPTH <= 64)  ? 6 :
                  (DEPTH <= 64)  ? 6 :
                  (DEPTH <= 128) ? 7 :
                  (DEPTH <= 128) ? 7 :
                  (DEPTH <= 256) ? 8 : 0; //0 is ilegal
                  (DEPTH <= 256) ? 8 : 0; //0 is ilegal
 
 
   parameter               LAST_LINE  = DEPTH-1;
   parameter               LAST_LINE  = DEPTH-1;
 
 
 
 
 
 
   input                      clk;
   input                      clk;
   input                      reset;
   input                      reset;
 
 
   input               push;
   input               push;
   input               pop;
   input               pop;
   input [WIDTH-1:0]           din;
   input [WIDTH-1:0]           din;
   output [WIDTH-1:0]           dout;
   output [WIDTH-1:0]           dout;
   //output               next;
   //output               next;
   output               empty;
   output               empty;
   output               full;
   output               full;
 
 
 
 
   wire               reg_push;
   wire               reg_push;
   wire               reg_pop;
   wire               reg_pop;
   wire               fifo_push;
   wire               fifo_push;
   wire               fifo_pop;
   wire               fifo_pop;
 
 
   reg [DEPTH-1:0]           fullness_in;
   reg [DEPTH-1:0]           fullness_in;
   reg [DEPTH-1:0]           fullness_out;
   reg [DEPTH-1:0]           fullness_out;
   reg [DEPTH-1:0]           fullness;
   reg [DEPTH-1:0]           fullness;
   reg [WIDTH-1:0]           fifo [DEPTH-1:0];
   reg [WIDTH-1:0]           fifo [DEPTH-1:0];
   wire               fifo_empty;
   wire               fifo_empty;
   wire               next;
   wire               next;
   reg [WIDTH-1:0]           dout;
   reg [WIDTH-1:0]           dout;
   reg                   dout_empty;
   reg                   dout_empty;
   reg [DEPTH_BITS-1:0]       ptr_in;
   reg [DEPTH_BITS-1:0]       ptr_in;
   reg [DEPTH_BITS-1:0]       ptr_out;
   reg [DEPTH_BITS-1:0]       ptr_out;
 
 
 
 
 
 
 
 
   assign               reg_push  = push & fifo_empty & (dout_empty | pop);
   assign               reg_push  = push & fifo_empty & (dout_empty | pop);
   assign               reg_pop   = pop & fifo_empty;
   assign               reg_pop   = pop & fifo_empty;
   assign               fifo_push = !SINGLE & push & (~reg_push);
   assign               fifo_push = !SINGLE & push & (~reg_push);
   assign               fifo_pop  = !SINGLE & pop & (~reg_pop);
   assign               fifo_pop  = !SINGLE & pop & (~reg_pop);
 
 
 
 
   always @(posedge clk or posedge reset)
   always @(posedge clk or posedge reset)
     if (reset)
     if (reset)
       begin
       begin
      dout       <= #1 {WIDTH{1'b0}};
      dout       <= #1 {WIDTH{1'b0}};
      dout_empty <= #1 1'b1;
      dout_empty <= #1 1'b1;
       end
       end
     else if (reg_push)
     else if (reg_push)
       begin
       begin
      dout       <= #1 din;
      dout       <= #1 din;
      dout_empty <= #1 1'b0;
      dout_empty <= #1 1'b0;
       end
       end
     else if (reg_pop)
     else if (reg_pop)
       begin
       begin
      dout       <= #1 {WIDTH{1'b0}};
      dout       <= #1 {WIDTH{1'b0}};
      dout_empty <= #1 1'b1;
      dout_empty <= #1 1'b1;
       end
       end
     else if (fifo_pop)
     else if (fifo_pop)
       begin
       begin
      dout       <= #1 fifo[ptr_out];
      dout       <= #1 fifo[ptr_out];
      dout_empty <= #1 1'b0;
      dout_empty <= #1 1'b0;
       end
       end
 
 
   always @(posedge clk or posedge reset)
   always @(posedge clk or posedge reset)
     if (reset)
     if (reset)
       ptr_in <= #1 {DEPTH_BITS{1'b0}};
       ptr_in <= #1 {DEPTH_BITS{1'b0}};
     else if (fifo_push)
     else if (fifo_push)
       ptr_in <= #1 ptr_in == LAST_LINE ? 0 : ptr_in + 1'b1;
       ptr_in <= #1 ptr_in == LAST_LINE ? 0 : ptr_in + 1'b1;
 
 
   always @(posedge clk or posedge reset)
   always @(posedge clk or posedge reset)
     if (reset)
     if (reset)
       ptr_out <= #1 {DEPTH_BITS{1'b0}};
       ptr_out <= #1 {DEPTH_BITS{1'b0}};
     else if (fifo_pop)
     else if (fifo_pop)
       ptr_out <= #1 ptr_out == LAST_LINE ? 0 : ptr_out + 1'b1;
       ptr_out <= #1 ptr_out == LAST_LINE ? 0 : ptr_out + 1'b1;
 
 
   always @(posedge clk)
   always @(posedge clk)
     if (fifo_push)
     if (fifo_push)
       fifo[ptr_in] <= #1 din;
       fifo[ptr_in] <= #1 din;
 
 
 
 
   always @(/*AUTOSENSE*/fifo_push or ptr_in)
   always @(/*AUTOSENSE*/fifo_push or ptr_in)
     begin
     begin
    fullness_in = {DEPTH{1'b0}};
    fullness_in = {DEPTH{1'b0}};
    fullness_in[ptr_in] = fifo_push;
    fullness_in[ptr_in] = fifo_push;
     end
     end
 
 
   always @(/*AUTOSENSE*/fifo_pop or ptr_out)
   always @(/*AUTOSENSE*/fifo_pop or ptr_out)
     begin
     begin
    fullness_out = {DEPTH{1'b0}};
    fullness_out = {DEPTH{1'b0}};
    fullness_out[ptr_out] = fifo_pop;
    fullness_out[ptr_out] = fifo_pop;
     end
     end
 
 
   always @(posedge clk or posedge reset)
   always @(posedge clk or posedge reset)
     if (reset)
     if (reset)
       fullness <= #1 {DEPTH{1'b0}};
       fullness <= #1 {DEPTH{1'b0}};
     else if (fifo_push | fifo_pop)
     else if (fifo_push | fifo_pop)
       fullness <= #1 (fullness & (~fullness_out)) | fullness_in;
       fullness <= #1 (fullness & (~fullness_out)) | fullness_in;
 
 
 
 
   assign next       = |fullness;
   assign next       = |fullness;
   assign fifo_empty = ~next;
   assign fifo_empty = ~next;
   assign empty      = fifo_empty & dout_empty;
   assign empty      = fifo_empty & dout_empty;
   assign full       = SINGLE ? !dout_empty : &fullness;
   assign full       = SINGLE ? !dout_empty : &fullness;
 
 
 
 
 
 
 
 
endmodule
endmodule
 
 
 
 
 
 
 
 
 
 

powered by: WebSVN 2.1.0

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