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

Subversion Repositories axi_slave

[/] [axi_slave/] [trunk/] [src/] [base/] [axi_slave_wresp_fifo.v] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 eyalhoc
<##//////////////////////////////////////////////////////////////////
2 2 eyalhoc
////                                                             ////
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 13 eyalhoc
//////////////////////////////////////////////////////////////////##>
29 2 eyalhoc
 
30
OUTFILE PREFIX_wresp_fifo.v
31
 
32
INCLUDE def_axi_slave.txt
33
 
34
module PREFIX_wresp_fifo (PORTS);
35
 
36
   parameter                  DEPTH = 8;
37
 
38
   parameter                  DEPTH_BITS =
39
                              (DEPTH <= 2)   ? 1 :
40
                              (DEPTH <= 4)   ? 2 :
41
                              (DEPTH <= 8)   ? 3 :
42
                              (DEPTH <= 16)  ? 4 :
43
                              (DEPTH <= 32)  ? 5 :
44
                              (DEPTH <= 64)  ? 6 :
45
                              (DEPTH <= 128) ? 7 :
46
                              (DEPTH <= 256) ? 8 :
47
                              (DEPTH <= 512) ? 9 : 0; //0 is ilegal
48
 
49
   input                      clk;
50
   input                      reset;
51
 
52
   input                      AWVALID;
53
   input                      AWREADY;
54
   input [ADDR_BITS-1:0]      AWADDR;
55
   input                      WVALID;
56
   input                      WREADY;
57
   input [ID_BITS-1:0]         WID;
58
   input                      WLAST;
59
 
60
   output [ID_BITS-1:0]       BID;
61
   output [1:0]        BRESP;
62
   input                      BVALID;
63
   input                      BREADY;
64
 
65
   output                     empty;
66
   output                     pending;
67
   output                     timeout;
68
 
69
 
70
   wire                       timeout_in;
71
   wire                       timeout_out;
72
   wire [1:0]                  resp_in;
73
   reg [ADDR_BITS-1:0]         SLVERR_addr  = {ADDR_BITS{1'b1}};
74
   reg [ADDR_BITS-1:0]         DECERR_addr  = {ADDR_BITS{1'b1}};
75
   reg [ADDR_BITS-1:0]         TIMEOUT_addr = {ADDR_BITS{1'b1}};
76
 
77
 
78
   wire                       push;
79
   wire                       push1;
80
   wire                       pop;
81
   wire                       empty;
82
   wire                       full;
83
   wire [DEPTH_BITS:0]        fullness;
84
 
85
 
86
   reg                        pending;
87
 
88
   parameter                  RESP_SLVERR = 2'b10;
89
   parameter                  RESP_DECERR = 2'b11;
90
 
91
 
92
   assign                     resp_in =
93
                              push1 & (SLVERR_addr == AWADDR) ? RESP_SLVERR :
94
                              push1 & (DECERR_addr == AWADDR) ? RESP_DECERR : 2'b00;
95
 
96
   assign                     timeout_in = push1 & (TIMEOUT_addr == AWADDR);
97
   assign                     timeout    = timeout_out & (TIMEOUT_addr != 0);
98
 
99
 
100
   always @(posedge clk or posedge reset)
101
     if (reset)
102
       pending <= #1 1'b0;
103
     else if (BVALID & BREADY)
104
       pending <= #1 1'b0;
105
     else if (BVALID & (~BREADY))
106
       pending <= #1 1'b1;
107
 
108
 
109
 
110
   assign                     push1 = AWVALID & AWREADY;
111
   assign                     push  = WVALID & WREADY & WLAST;
112
   assign                     pop   = BVALID & BREADY;
113
 
114
 
115
   prgen_fifo_stub #(ID_BITS, DEPTH)
116
   wresp_fifo(
117
              .clk(clk),
118
              .reset(reset),
119
              .push(push),
120
              .pop(pop),
121
              .din({WID
122
                    }
123
                   ),
124
              .dout({BID
125
                     }
126
                    ),
127
              .fullness(fullness),
128
              .empty(empty),
129
              .full(full)
130
              );
131
 
132
   prgen_fifo_stub #(2+1, DEPTH*2)
133
   wresp_fifo1(
134
              .clk(clk),
135
              .reset(reset),
136
              .push(push1),
137
              .pop(pop),
138
              .din({resp_in,
139
                    timeout_in
140
                    }
141
                   ),
142
              .dout({BRESP,
143
                     timeout_out
144
                     }
145
                    ),
146
              .fullness(),
147
              .empty(),
148
              .full()
149
              );
150
 
151
 
152
 
153
 
154
endmodule
155
 
156
 

powered by: WebSVN 2.1.0

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