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

Subversion Repositories robust_axi2apb

[/] [robust_axi2apb/] [trunk/] [src/] [base/] [axi2apb_cmd.v] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 eyalhoc
<##//////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  Author: Eyal Hochberg                                      ////
4
////          eyal@provartec.com                                 ////
5
////                                                             ////
6
////  Downloaded from: http://www.opencores.org                  ////
7
/////////////////////////////////////////////////////////////////////
8
////                                                             ////
9
//// Copyright (C) 2010 Provartec LTD                            ////
10
//// www.provartec.com                                           ////
11
//// info@provartec.com                                          ////
12
////                                                             ////
13
//// This source file may be used and distributed without        ////
14
//// restriction provided that this copyright statement is not   ////
15
//// removed from the file and that any derivative work contains ////
16
//// the original copyright notice and the associated disclaimer.////
17
////                                                             ////
18
//// This source file is free software; you can redistribute it  ////
19
//// and/or modify it under the terms of the GNU Lesser General  ////
20
//// Public License as published by the Free Software Foundation.////
21
////                                                             ////
22
//// This source is distributed in the hope that it will be      ////
23
//// useful, but WITHOUT ANY WARRANTY; without even the implied  ////
24
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR     ////
25
//// PURPOSE.  See the GNU Lesser General Public License for more////
26
//// details. http://www.gnu.org/licenses/lgpl.html              ////
27
////                                                             ////
28
//////////////////////////////////////////////////////////////////##>
29 4 eyalhoc
 
30 2 eyalhoc
INCLUDE def_axi2apb.txt
31 8 eyalhoc
OUTFILE PREFIX_cmd.v
32 2 eyalhoc
 
33 8 eyalhoc
module  PREFIX_cmd (PORTS);
34 2 eyalhoc
 
35
   input                          clk;
36
   input                          reset;
37
 
38
   port                   AWGROUP_APB_AXI_A;
39
   port                   ARGROUP_APB_AXI_A;
40
   input                  finish_wr;
41
   input                  finish_rd;
42
 
43
   output                 cmd_empty;
44
   output                 cmd_read;
45
   output [ID_BITS-1:0]   cmd_id;
46
   output [ADDR_BITS-1:0] cmd_addr;
47
   output                 cmd_err;
48
 
49
 
50
   wire                   AGROUP_APB_AXI_A;
51
 
52
   wire                   cmd_push;
53
   wire                   cmd_pop;
54 6 eyalhoc
   wire                   cmd_empty;
55
   wire                   cmd_full;
56 2 eyalhoc
   reg                    read;
57
 
58 6 eyalhoc
   wire                   wreq, rreq;
59
   wire                   wack, rack;
60
   wire                   AERR;
61 2 eyalhoc
 
62 6 eyalhoc
 
63 2 eyalhoc
   assign                 wreq = AWVALID;
64
   assign                 rreq = ARVALID;
65
   assign                 wack = AWVALID & AWREADY;
66
   assign                 rack = ARVALID & ARREADY;
67
 
68
   always @(posedge clk or posedge reset)
69
     if (reset)
70
       read <= #FFD 1'b1;
71
     else if (wreq & (rack | (~rreq)))
72
       read <= #FFD 1'b0;
73
     else if (rreq & (wack | (~wreq)))
74
       read <= #FFD 1'b1;
75
 
76
        //command mux
77
        assign AGROUP_APB_AXI_A = read ? ARGROUP_APB_AXI_A : AWGROUP_APB_AXI_A;
78
        assign AERR   = (ASIZE != 'd2) | (ALEN != 'd0); //support only 32 bit single AXI commands
79
 
80
   assign ARREADY = (~cmd_full) & read;
81
   assign AWREADY = (~cmd_full) & (~read);
82
 
83
    assign                    cmd_push  = AVALID & AREADY;
84
    assign                    cmd_pop   = cmd_read ? finish_rd : finish_wr;
85
 
86
CREATE prgen_fifo.v DEFCMD(SWAP CONST(#FFD) #FFD)
87
   prgen_fifo #(ID_BITS+ADDR_BITS+2, CMD_DEPTH)
88
   cmd_fifo(
89
            .clk(clk),
90
            .reset(reset),
91
            .push(cmd_push),
92
            .pop(cmd_pop),
93
            .din({
94
                        AID,
95
                        AADDR,
96
                        AERR,
97
                        read
98
                        }
99
                 ),
100
            .dout({
101
                        cmd_id,
102
                        cmd_addr,
103
                        cmd_err,
104
                        cmd_read
105
                        }
106
                  ),
107
            .empty(cmd_empty),
108
            .full(cmd_full)
109
            );
110
 
111
 
112
 
113
endmodule
114
 
115
 

powered by: WebSVN 2.1.0

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