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

Subversion Repositories ahb_master

[/] [ahb_master/] [trunk/] [src/] [base/] [axi2ahb_cmd.v] - Blame information for rev 13

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

Line No. Rev Author Line
1 10 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 2 eyalhoc
 
30 10 eyalhoc
OUTFILE PREFIX_cmd.v
31 2 eyalhoc
 
32
INCLUDE def_axi2ahb.txt
33
 
34 10 eyalhoc
module  PREFIX_cmd (PORTS);
35 2 eyalhoc
 
36
   input                  clk;
37
   input                  reset;
38
 
39
   port                   AWGROUP_AXI_A;
40
   port                   ARGROUP_AXI_A;
41
   input                  GROUP_AHB;
42
 
43
   input                  ahb_finish;
44
   output                 cmd_empty;
45
   output                 cmd_read;
46
   output [ID_BITS-1:0]   cmd_id;
47
   output [ADDR_BITS-1:0] cmd_addr;
48
   output [3:0]           cmd_len;
49
   output [1:0]           cmd_size;
50
   output                 cmd_err;
51
 
52
 
53
   wire                   AGROUP_AXI_A;
54
 
55
   wire                   cmd_push;
56
   wire                   cmd_pop;
57
   wire                   cmd_empty;
58
   wire                   cmd_full;
59
   reg                    read;
60
   wire                   err;
61
 
62
 
63
   wire                   wreq, rreq;
64
   wire                   wack, rack;
65
   wire                   AERR;
66
 
67
   assign                 wreq = AWVALID;
68
   assign                 rreq = ARVALID;
69
   assign                 wack = AWVALID & AWREADY;
70
   assign                 rack = ARVALID & ARREADY;
71
 
72
   always @(posedge clk or posedge reset)
73
     if (reset)
74
       read <= #FFD 1'b1;
75
     else if (wreq & (rack | (~rreq)))
76
       read <= #FFD 1'b0;
77
     else if (rreq & (wack | (~wreq)))
78
       read <= #FFD 1'b1;
79
 
80
        //command mux
81
        assign AGROUP_AXI_A = read ? ARGROUP_AXI_A : AWGROUP_AXI_A;
82
 
83
   assign ARREADY = (~cmd_full) & read;
84
   assign AWREADY = (~cmd_full) & (~read);
85
 
86
   assign err =
87
          ((ALEN != 4'd0) &
88
           (ALEN != 4'd3) &
89
           (ALEN != 4'd7) &
90
           (ALEN != 4'd15)) |
91
          (((ASIZE == 2'b01) & (AADDR[0] != 1'b0)) |
92
           ((ASIZE == 2'b10) & (AADDR[1:0] != 2'b00)) |
93
           ((ASIZE == 2'b11) & (AADDR[2:0] != 3'b000)));
94
 
95
 
96
 
97
    assign                    cmd_push  = AVALID & AREADY;
98
    assign                    cmd_pop   = ahb_finish;
99
 
100
CREATE prgen_fifo.v DEFCMD(SWAP CONST(#FFD) #FFD)
101
   prgen_fifo #(ID_BITS+ADDR_BITS+4+2+1+1, CMD_DEPTH)
102
   cmd_fifo(
103
            .clk(clk),
104
            .reset(reset),
105
            .push(cmd_push),
106
            .pop(cmd_pop),
107
            .din({
108
                  AID,
109
                  AADDR,
110
                  ALEN,
111
                  ASIZE,
112
                  read,
113
                  err
114
                  }
115
                 ),
116
            .dout({
117
                   cmd_id,
118
                   cmd_addr,
119
                   cmd_len,
120
                   cmd_size,
121
                   cmd_read,
122
                   cmd_err
123
                   }
124
                  ),
125
            .empty(cmd_empty),
126
            .full(cmd_full)
127
            );
128
 
129
 
130
 
131
endmodule
132
 
133
 

powered by: WebSVN 2.1.0

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