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

Subversion Repositories apb_mstr

[/] [apb_mstr/] [trunk/] [src/] [base/] [axi2apb_cmd.v] - Diff between revs 5 and 12

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

Rev 5 Rev 12
<##//////////////////////////////////////////////////////////////////
<##//////////////////////////////////////////////////////////////////
////                                                             ////
////                                                             ////
////  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              ////
////                                                             ////
////                                                             ////
//////////////////////////////////////////////////////////////////##>
//////////////////////////////////////////////////////////////////##>
 
 
INCLUDE def_axi2apb.txt
INCLUDE def_axi2apb.txt
OUTFILE PREFIX_cmd.v
OUTFILE PREFIX_cmd.v
 
 
module  PREFIX_cmd (PORTS);
module  PREFIX_cmd (PORTS);
 
 
   input                          clk;
   input                          clk;
   input                          reset;
   input                          reset;
 
 
   port                   AWGROUP_APB_AXI_A;
   port                   AWGROUP_APB_AXI_A;
   port                   ARGROUP_APB_AXI_A;
   port                   ARGROUP_APB_AXI_A;
   input                  finish_wr;
   input                  finish_wr;
   input                  finish_rd;
   input                  finish_rd;
 
 
   output                 cmd_empty;
   output                 cmd_empty;
   output                 cmd_read;
   output                 cmd_read;
   output [ID_BITS-1:0]   cmd_id;
   output [ID_BITS-1:0]   cmd_id;
   output [ADDR_BITS-1:0] cmd_addr;
   output [ADDR_BITS-1:0] cmd_addr;
   output                 cmd_err;
   output                 cmd_err;
 
 
 
 
   wire                   AGROUP_APB_AXI_A;
   wire                   AGROUP_APB_AXI_A;
 
 
   wire                   cmd_push;
   wire                   cmd_push;
   wire                   cmd_pop;
   wire                   cmd_pop;
   wire                   cmd_empty;
   wire                   cmd_empty;
   wire                   cmd_full;
   wire                   cmd_full;
   reg                    read;
   reg                    read;
 
 
   wire                   wreq, rreq;
   wire                   wreq, rreq;
   wire                   wack, rack;
   wire                   wack, rack;
   wire                   AERR;
   wire                   AERR;
 
 
 
 
   assign                 wreq = AWVALID;
   assign                 wreq = AWVALID;
   assign                 rreq = ARVALID;
   assign                 rreq = ARVALID;
   assign                 wack = AWVALID & AWREADY;
   assign                 wack = AWVALID & AWREADY;
   assign                 rack = ARVALID & ARREADY;
   assign                 rack = ARVALID & ARREADY;
 
 
   always @(posedge clk or posedge reset)
   always @(posedge clk or posedge reset)
     if (reset)
     if (reset)
       read <= #FFD 1'b1;
       read <= #FFD 1'b1;
     else if (wreq & (rack | (~rreq)))
     else if (wreq & (rack | (~rreq)))
       read <= #FFD 1'b0;
       read <= #FFD 1'b0;
     else if (rreq & (wack | (~wreq)))
     else if (rreq & (wack | (~wreq)))
       read <= #FFD 1'b1;
       read <= #FFD 1'b1;
 
 
        //command mux
        //command mux
        assign AGROUP_APB_AXI_A = read ? ARGROUP_APB_AXI_A : AWGROUP_APB_AXI_A;
        assign AGROUP_APB_AXI_A = read ? ARGROUP_APB_AXI_A : AWGROUP_APB_AXI_A;
        assign AERR   = (ASIZE != 'd2) | (ALEN != 'd0); //support only 32 bit single AXI commands
        assign AERR   = (ASIZE != 'd2) | (ALEN != 'd0); //support only 32 bit single AXI commands
 
 
   assign ARREADY = (~cmd_full) & read;
   assign ARREADY = (~cmd_full) & read;
   assign AWREADY = (~cmd_full) & (~read);
   assign AWREADY = (~cmd_full) & (~read);
 
 
    assign                    cmd_push  = AVALID & AREADY;
    assign                    cmd_push  = AVALID & AREADY;
    assign                    cmd_pop   = cmd_read ? finish_rd : finish_wr;
    assign                    cmd_pop   = cmd_read ? finish_rd : finish_wr;
 
 
CREATE prgen_fifo.v DEFCMD(SWAP CONST(#FFD) #FFD)
CREATE prgen_fifo.v DEFCMD(SWAP CONST(#FFD) #FFD)
   prgen_fifo #(ID_BITS+ADDR_BITS+2, CMD_DEPTH)
   prgen_fifo #(ID_BITS+ADDR_BITS+2, CMD_DEPTH)
   cmd_fifo(
   cmd_fifo(
            .clk(clk),
            .clk(clk),
            .reset(reset),
            .reset(reset),
            .push(cmd_push),
            .push(cmd_push),
            .pop(cmd_pop),
            .pop(cmd_pop),
            .din({
            .din({
                        AID,
                        AID,
                        AADDR,
                        AADDR,
                        AERR,
                        AERR,
                        read
                        read
                        }
                        }
                 ),
                 ),
            .dout({
            .dout({
                        cmd_id,
                        cmd_id,
                        cmd_addr,
                        cmd_addr,
                        cmd_err,
                        cmd_err,
                        cmd_read
                        cmd_read
                        }
                        }
                  ),
                  ),
            .empty(cmd_empty),
            .empty(cmd_empty),
            .full(cmd_full)
            .full(cmd_full)
            );
            );
 
 
 
 
 
 
endmodule
endmodule
 
 
 
 
 
 

powered by: WebSVN 2.1.0

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