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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [axi4_lib/] [src/] [axi4_register_slice.sv] - Blame information for rev 31

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 29 qaztronic
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// Copyright (C) 2015 Authors and OPENCORES.ORG                 ////
4
////                                                              ////
5
//// This source file may be used and distributed without         ////
6
//// restriction provided that this copyright statement is not    ////
7
//// removed from the file and that any derivative work contains  ////
8
//// the original copyright notice and the associated disclaimer. ////
9
////                                                              ////
10
//// This source file is free software; you can redistribute it   ////
11
//// and/or modify it under the terms of the GNU Lesser General   ////
12
//// Public License as published by the Free Software Foundation; ////
13
//// either version 2.1 of the License, or (at your option) any   ////
14
//// later version.                                               ////
15
////                                                              ////
16
//// This source is distributed in the hope that it will be       ////
17
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
18
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
19
//// PURPOSE.  See the GNU Lesser General Public License for more ////
20
//// details.                                                     ////
21
////                                                              ////
22
//// You should have received a copy of the GNU Lesser General    ////
23
//// Public License along with this source; if not, download it   ////
24
//// from http://www.opencores.org/lgpl.shtml                     ////
25
////                                                              ////
26
//////////////////////////////////////////////////////////////////////
27
 
28
module
29
  axi4_register_slice
30
  #(
31
    A = 32, // address bus width
32
    N = 8,  // data bus width in bytes
33
    I = 1,  // ID width
34
    USE_ADVANCED_PROTOCOL = 0
35
  )
36
  (
37
    axi4_if axi4_s,
38
    axi4_if axi4_m,
39
    input   aclk,
40
    input   aresetn
41
  );
42
 
43
  // --------------------------------------------------------------------
44
  //
45
  wire ar_rd_empty;
46
  wire ar_rd_en = axi4_m.arvalid & axi4_m.arready;
47
  wire r_wr_full;
48
  wire r_wr_en = axi4_m.rvalid & axi4_m.rready;
49
 
50
  axi4_if #(.A(A), .N(N), .I(I))
51
    axi4_read_fifo(.*);
52
 
53
 
54
  // --------------------------------------------------------------------
55
  //
56 31 qaztronic
  axi4_s_to_read_fifos
57 29 qaztronic
    #(
58
      .A(A),
59
      .N(N),
60
      .I(I),
61 31 qaztronic
      .R_D(2),
62
      .AR_D(2),
63 29 qaztronic
      .USE_ADVANCED_PROTOCOL(USE_ADVANCED_PROTOCOL)
64
    )
65 31 qaztronic
    axi4_s_to_read_fifos_i(.*);
66 29 qaztronic
 
67
 
68
  // --------------------------------------------------------------------
69
  //
70
  assign axi4_m.arid    = axi4_read_fifo.arid;
71
  assign axi4_m.araddr  = axi4_read_fifo.araddr;
72
  assign axi4_m.arburst = axi4_read_fifo.arburst;
73
  assign axi4_m.arlen   = axi4_read_fifo.arlen;
74
  assign axi4_m.arsize  = axi4_read_fifo.arsize;
75
  assign axi4_m.arvalid = ~ar_rd_empty;
76
 
77
  generate
78
    begin: ar_assign_gen
79
      if(USE_ADVANCED_PROTOCOL)
80
      begin
81
        assign axi4_m.arcache   = axi4_read_fifo.arcache;
82
        assign axi4_m.arlock    = axi4_read_fifo.arlock;
83
        assign axi4_m.arprot    = axi4_read_fifo.arprot;
84
        assign axi4_m.arqos     = axi4_read_fifo.arqos;
85
        assign axi4_m.arregion  = axi4_read_fifo.arregion;
86
      end
87
      else
88
      begin
89
        assign axi4_m.arcache   = 0;
90
        assign axi4_m.arlock    = 0;
91
        assign axi4_m.arprot    = 0;
92
        assign axi4_m.arqos     = 0;
93
        assign axi4_m.arregion  = 0;
94
      end
95
    end
96
  endgenerate
97
 
98
 
99
  // --------------------------------------------------------------------
100
  //
101
  assign axi4_m.rready        = ~r_wr_full;
102
  assign axi4_read_fifo.rdata = axi4_m.rdata;
103
  assign axi4_read_fifo.rid   = axi4_m.rid;
104
  assign axi4_read_fifo.rlast = axi4_m.rlast;
105
  assign axi4_read_fifo.rresp = axi4_m.rresp;
106
 
107
 
108
  // --------------------------------------------------------------------
109
  //
110
  wire aw_rd_empty;
111
  wire aw_rd_en = axi4_m.awvalid & axi4_m.awready;
112
  wire w_rd_empty;
113
  wire w_rd_en = axi4_m.wvalid & axi4_m.wready;
114
  wire b_wr_full;
115
  wire b_wr_en = axi4_m.bvalid & axi4_m.bready;
116
 
117
  axi4_if #(.A(A), .N(N), .I(I))
118
    axi4_write_fifo(.*);
119
 
120
 
121
  // --------------------------------------------------------------------
122
  //
123 31 qaztronic
  axi4_s_to_write_fifos
124 29 qaztronic
    #(
125
      .A(A),
126
      .N(N),
127
      .I(I),
128 31 qaztronic
      .W_D(2),
129
      .B_D(2),
130
      .AW_D(2),
131 29 qaztronic
      .USE_ADVANCED_PROTOCOL(USE_ADVANCED_PROTOCOL)
132
    )
133 31 qaztronic
    axi4_s_to_write_fifos_i(.*);
134 29 qaztronic
 
135
 
136
  // --------------------------------------------------------------------
137
  //
138
  assign axi4_m.awid    = axi4_write_fifo.awid;
139
  assign axi4_m.awaddr  = axi4_write_fifo.awaddr;
140
  assign axi4_m.awburst = axi4_write_fifo.awburst;
141
  assign axi4_m.awlen   = axi4_write_fifo.awlen;
142
  assign axi4_m.awsize  = axi4_write_fifo.awsize;
143
  assign axi4_m.awvalid = ~aw_rd_empty;
144
 
145
  generate
146
    begin: aw_assign_gen
147
      if(USE_ADVANCED_PROTOCOL)
148
      begin
149
        assign axi4_m.awcache   = axi4_write_fifo.awcache;
150
        assign axi4_m.awlock    = axi4_write_fifo.awlock;
151
        assign axi4_m.awprot    = axi4_write_fifo.awprot;
152
        assign axi4_m.awqos     = axi4_write_fifo.awqos;
153
        assign axi4_m.awregion  = axi4_write_fifo.awregion;
154
      end
155
      else
156
      begin
157
        assign axi4_m.awcache   = 0;
158
        assign axi4_m.awlock    = 0;
159
        assign axi4_m.awprot    = 0;
160
        assign axi4_m.awqos     = 0;
161
        assign axi4_m.awregion  = 0;
162
      end
163
    end
164
  endgenerate
165
 
166
 
167
  // --------------------------------------------------------------------
168
  //
169
  assign axi4_m.wvalid  = ~w_rd_empty;
170
  assign axi4_m.wdata   = axi4_write_fifo.wdata;
171
  assign axi4_m.wid     = axi4_write_fifo.wid;
172
  assign axi4_m.wlast   = axi4_write_fifo.wlast;
173
  assign axi4_m.wstrb   = axi4_write_fifo.wstrb;
174
 
175
 
176
  // --------------------------------------------------------------------
177
  //
178
  assign axi4_m.bready        = ~b_wr_full;
179
  assign axi4_write_fifo.bid   = axi4_m.bid;
180
  assign axi4_write_fifo.bresp = axi4_m.bresp;
181
 
182
 
183
// --------------------------------------------------------------------
184
//
185
 
186
endmodule
187
 

powered by: WebSVN 2.1.0

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