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

Subversion Repositories axi_slave

[/] [axi_slave/] [trunk/] [src/] [base/] [axi_slave_cmd_fifo.v] - Diff between revs 2 and 10

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 2 Rev 10
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
////                                                             ////
////                                                             ////
////  Author: Eyal Hochberg                                      ////
////  Author: Eyal Hochberg                                      ////
////          eyal@provartec.com                                 ////
////          eyal@provartec.com                                 ////
////                                                             ////
////                                                             ////
////  Downloaded from: http://www.opencores.org                  ////
////  Downloaded from: http://www.opencores.org                  ////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
////                                                             ////
////                                                             ////
//// Copyright (C) 2010 Provartec LTD                            ////
//// Copyright (C) 2010 Provartec LTD                            ////
//// www.provartec.com                                           ////
//// www.provartec.com                                           ////
//// info@provartec.com                                          ////
//// info@provartec.com                                          ////
////                                                             ////
////                                                             ////
//// This source file may be used and distributed without        ////
//// This source file may be used and distributed without        ////
//// restriction provided that this copyright statement is not   ////
//// restriction provided that this copyright statement is not   ////
//// removed from the file and that any derivative work contains ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// the original copyright notice and the associated disclaimer.////
////                                                             ////
////                                                             ////
//// This source file is free software; you can redistribute it  ////
//// This source file is free software; you can redistribute it  ////
//// and/or modify it under the terms of the GNU Lesser General  ////
//// and/or modify it under the terms of the GNU Lesser General  ////
//// Public License as published by the Free Software Foundation.////
//// Public License as published by the Free Software Foundation.////
////                                                             ////
////                                                             ////
//// This source is distributed in the hope that it will be      ////
//// This source is distributed in the hope that it will be      ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied  ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied  ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR     ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR     ////
//// PURPOSE.  See the GNU Lesser General Public License for more////
//// PURPOSE.  See the GNU Lesser General Public License for more////
//// details. http://www.gnu.org/licenses/lgpl.html              ////
//// details. http://www.gnu.org/licenses/lgpl.html              ////
////                                                             ////
////                                                             ////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
 
 
OUTFILE PREFIX_cmd_fifo.v
OUTFILE PREFIX_cmd_fifo.v
 
 
INCLUDE def_axi_slave.txt
INCLUDE def_axi_slave.txt
 
 
module PREFIX_cmd_fifo (PORTS);
module PREFIX_cmd_fifo (PORTS);
 
 
   parameter                  DEPTH = 8;
   parameter                  DEPTH = 8;
 
 
   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 :
                              (DEPTH <= 256) ? 8 :
                              (DEPTH <= 512) ? 9 : 0; //0 is ilegal
                              (DEPTH <= 512) ? 9 : 0; //0 is ilegal
 
 
 
 
   input                      clk;
   input                      clk;
   input                      reset;
   input                      reset;
 
 
   input [ADDR_BITS-1:0]      AADDR;
   input [ADDR_BITS-1:0]      AADDR;
   input [ID_BITS-1:0]         AID;
   input [ID_BITS-1:0]         AID;
   input [1:0]                 ASIZE;
   input [1:0]                 ASIZE;
   input [LEN_BITS-1:0]       ALEN;
   input [LEN_BITS-1:0]       ALEN;
   input                      AVALID;
   input                      AVALID;
   input                      AREADY;
   input                      AREADY;
 
 
   input                      VALID;
   input                      VALID;
   input                      READY;
   input                      READY;
   input                      LAST;
   input                      LAST;
 
 
   output [ADDR_BITS-1:0]     cmd_addr;
   output [ADDR_BITS-1:0]     cmd_addr;
   output [ID_BITS-1:0]       cmd_id;
   output [ID_BITS-1:0]       cmd_id;
   output [1:0]        cmd_size;
   output [SIZE_BITS-1:0]              cmd_size;
   output [LEN_BITS-1:0]      cmd_len;
   output [LEN_BITS-1:0]      cmd_len;
   output [1:0]        cmd_resp;
   output [1:0]        cmd_resp;
   output                     cmd_timeout;
   output                     cmd_timeout;
   output                     cmd_ready;
   output                     cmd_ready;
   output                     cmd_empty;
   output                     cmd_empty;
   output                     cmd_full;
   output                     cmd_full;
 
 
 
 
 
 
   wire                       push;
   wire                       push;
   wire                       pop;
   wire                       pop;
   wire                       empty;
   wire                       empty;
   wire                       full;
   wire                       full;
   wire [DEPTH_BITS:0]        fullness;
   wire [DEPTH_BITS:0]        fullness;
 
 
 
 
   wire [1:0]                  resp_in;
   wire [1:0]                  resp_in;
   wire                       timeout_in;
   wire                       timeout_in;
   wire                       timeout_out;
   wire                       timeout_out;
   reg [ADDR_BITS-1:0]         SLVERR_addr = {ADDR_BITS{1'b1}};
   reg [ADDR_BITS-1:0]         SLVERR_addr = {ADDR_BITS{1'b1}};
   reg [ADDR_BITS-1:0]         DECERR_addr = {ADDR_BITS{1'b1}};
   reg [ADDR_BITS-1:0]         DECERR_addr = {ADDR_BITS{1'b1}};
   reg [ADDR_BITS-1:0]         TIMEOUT_addr = {ADDR_BITS{1'b1}};
   reg [ADDR_BITS-1:0]         TIMEOUT_addr = {ADDR_BITS{1'b1}};
 
 
 
 
 
 
   parameter                  RESP_SLVERR = 2'b10;
   parameter                  RESP_SLVERR = 2'b10;
   parameter                  RESP_DECERR = 2'b11;
   parameter                  RESP_DECERR = 2'b11;
 
 
 
 
 
 
   assign                     resp_in =
   assign                     resp_in =
                              push & (SLVERR_addr == AADDR) ? RESP_SLVERR :
                              push & (SLVERR_addr == AADDR) ? RESP_SLVERR :
                              push & (DECERR_addr == AADDR) ? RESP_DECERR : 2'b00;
                              push & (DECERR_addr == AADDR) ? RESP_DECERR : 2'b00;
 
 
   assign                     timeout_in  = push & (TIMEOUT_addr == AADDR);
   assign                     timeout_in  = push & (TIMEOUT_addr == AADDR);
   assign                     cmd_timeout = timeout_out & (TIMEOUT_addr != 0);
   assign                     cmd_timeout = timeout_out & (TIMEOUT_addr != 0);
 
 
 
 
   assign                     cmd_full   = full | (DEPTH == fullness);
   assign                     cmd_full   = full | (DEPTH == fullness);
   assign                     cmd_empty  = empty;
   assign                     cmd_empty  = empty;
   assign                     cmd_ready  = ~empty;
   assign                     cmd_ready  = ~empty;
 
 
   assign                     push = AVALID & AREADY;
   assign                     push = AVALID & AREADY;
   assign                     pop  = VALID & READY & LAST;
   assign                     pop  = VALID & READY & LAST;
 
 
 
 
CREATE prgen_fifo.v DEFCMD(DEFINE STUB)
CREATE prgen_fifo.v DEFCMD(DEFINE STUB)
   prgen_fifo_stub #(ADDR_BITS+ID_BITS+LEN_BITS+2+2+1, DEPTH)
   prgen_fifo_stub #(ADDR_BITS+ID_BITS+SIZE_BITS+LEN_BITS+2+1, DEPTH)
   cmd_fifo(
   cmd_fifo(
            .clk(clk),
            .clk(clk),
            .reset(reset),
            .reset(reset),
            .push(push),
            .push(push),
            .pop(pop),
            .pop(pop),
            .din({AADDR,
            .din({AADDR,
                  AID,
                  AID,
                  ASIZE,
                  ASIZE,
                  ALEN,
                  ALEN,
                  resp_in,
                  resp_in,
                  timeout_in
                  timeout_in
                  }
                  }
                 ),
                 ),
            .dout({cmd_addr,
            .dout({cmd_addr,
                   cmd_id,
                   cmd_id,
                   cmd_size,
                   cmd_size,
                   cmd_len,
                   cmd_len,
                   cmd_resp,
                   cmd_resp,
                   timeout_out
                   timeout_out
                   }
                   }
                  ),
                  ),
            .fullness(fullness),
            .fullness(fullness),
            .empty(empty),
            .empty(empty),
            .full(full)
            .full(full)
            );
            );
 
 
 
 
 
 
 
 
endmodule
endmodule
 
 
 
 
 
 

powered by: WebSVN 2.1.0

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