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 4

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 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
 
30 2 eyalhoc
INCLUDE def_axi2apb.txt
31
OUTFILE PREFIX_axi2apb_cmd.v
32
 
33
module  PREFIX_axi2apb_cmd (PORTS);
34
 
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
   reg                    read;
55
 
56
 
57
   assign                 wreq = AWVALID;
58
   assign                 rreq = ARVALID;
59
   assign                 wack = AWVALID & AWREADY;
60
   assign                 rack = ARVALID & ARREADY;
61
 
62
   always @(posedge clk or posedge reset)
63
     if (reset)
64
       read <= #FFD 1'b1;
65
     else if (wreq & (rack | (~rreq)))
66
       read <= #FFD 1'b0;
67
     else if (rreq & (wack | (~wreq)))
68
       read <= #FFD 1'b1;
69
 
70
        //command mux
71
        assign AGROUP_APB_AXI_A = read ? ARGROUP_APB_AXI_A : AWGROUP_APB_AXI_A;
72
        assign AERR   = (ASIZE != 'd2) | (ALEN != 'd0); //support only 32 bit single AXI commands
73
 
74
   assign ARREADY = (~cmd_full) & read;
75
   assign AWREADY = (~cmd_full) & (~read);
76
 
77
    assign                    cmd_push  = AVALID & AREADY;
78
    assign                    cmd_pop   = cmd_read ? finish_rd : finish_wr;
79
 
80
CREATE prgen_fifo.v DEFCMD(SWAP CONST(#FFD) #FFD)
81
   prgen_fifo #(ID_BITS+ADDR_BITS+2, CMD_DEPTH)
82
   cmd_fifo(
83
            .clk(clk),
84
            .reset(reset),
85
            .push(cmd_push),
86
            .pop(cmd_pop),
87
            .din({
88
                        AID,
89
                        AADDR,
90
                        AERR,
91
                        read
92
                        }
93
                 ),
94
            .dout({
95
                        cmd_id,
96
                        cmd_addr,
97
                        cmd_err,
98
                        cmd_read
99
                        }
100
                  ),
101
            .empty(cmd_empty),
102
            .full(cmd_full)
103
            );
104
 
105
 
106
 
107
endmodule
108
 
109
 

powered by: WebSVN 2.1.0

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