|
13 | 13 | // - Andreas Kurth <[email protected]> |
14 | 14 | // - Florian Zaruba <[email protected]> |
15 | 15 |
|
16 | | -// axi_xbar: Fully-connected AXI4+ATOP crossbar with an arbitrary number of slave and master ports. |
17 | | -// See `doc/axi_xbar.md` for the documentation, including the definition of parameters and ports. |
| 16 | +/// axi_xbar: Fully-connected AXI4+ATOP crossbar with an arbitrary number of slave and master ports. |
| 17 | +/// See `doc/axi_xbar.md` for the documentation, including the definition of parameters and ports. |
18 | 18 | module axi_xbar |
19 | 19 | import cf_math_pkg::idx_width; |
20 | 20 | #( |
| 21 | + /// Configuration struct for the crossbar see `axi_pkg` for fields and definitions. |
21 | 22 | parameter axi_pkg::xbar_cfg_t Cfg = '0, |
| 23 | + /// Enable atomic operations support. |
22 | 24 | parameter bit ATOPs = 1'b1, |
| 25 | + /// Connectivity matrix |
23 | 26 | parameter bit [Cfg.NoSlvPorts-1:0][Cfg.NoMstPorts-1:0] Connectivity = '1, |
| 27 | + /// AXI4+ATOP AW channel struct type for the slave ports. |
24 | 28 | parameter type slv_aw_chan_t = logic, |
| 29 | + /// AXI4+ATOP AW channel struct type for the master ports. |
25 | 30 | parameter type mst_aw_chan_t = logic, |
| 31 | + /// AXI4+ATOP W channel struct type for all ports. |
26 | 32 | parameter type w_chan_t = logic, |
| 33 | + /// AXI4+ATOP B channel struct type for the slave ports. |
27 | 34 | parameter type slv_b_chan_t = logic, |
| 35 | + /// AXI4+ATOP B channel struct type for the master ports. |
28 | 36 | parameter type mst_b_chan_t = logic, |
| 37 | + /// AXI4+ATOP AR channel struct type for the slave ports. |
29 | 38 | parameter type slv_ar_chan_t = logic, |
| 39 | + /// AXI4+ATOP AR channel struct type for the master ports. |
30 | 40 | parameter type mst_ar_chan_t = logic, |
| 41 | + /// AXI4+ATOP R channel struct type for the slave ports. |
31 | 42 | parameter type slv_r_chan_t = logic, |
| 43 | + /// AXI4+ATOP R channel struct type for the master ports. |
32 | 44 | parameter type mst_r_chan_t = logic, |
| 45 | + /// AXI4+ATOP request struct type for the slave ports. |
33 | 46 | parameter type slv_req_t = logic, |
| 47 | + /// AXI4+ATOP response struct type for the slave ports. |
34 | 48 | parameter type slv_resp_t = logic, |
| 49 | + /// AXI4+ATOP request struct type for the master ports. |
35 | 50 | parameter type mst_req_t = logic, |
| 51 | + /// AXI4+ATOP response struct type for the master ports |
36 | 52 | parameter type mst_resp_t = logic, |
| 53 | + /// Address rule type for the address decoders from `common_cells:addr_decode`. |
| 54 | + /// Example types are provided in `axi_pkg`. |
| 55 | + /// Required struct fields: |
| 56 | + /// ``` |
| 57 | + /// typedef struct packed { |
| 58 | + /// int unsigned idx; |
| 59 | + /// axi_addr_t start_addr; |
| 60 | + /// axi_addr_t end_addr; |
| 61 | + /// } rule_t; |
| 62 | + /// ``` |
37 | 63 | parameter type rule_t = axi_pkg::xbar_rule_64_t |
38 | 64 | `ifdef VCS |
39 | 65 | , localparam int unsigned MstPortsIdxWidth = |
40 | 66 | (Cfg.NoMstPorts == 32'd1) ? 32'd1 : unsigned'($clog2(Cfg.NoMstPorts)) |
41 | 67 | `endif |
42 | 68 | ) ( |
| 69 | + /// Clock, positive edge triggered. |
43 | 70 | input logic clk_i, |
| 71 | + /// Asynchronous reset, active low. |
44 | 72 | input logic rst_ni, |
| 73 | + /// Testmode enable, active high. |
45 | 74 | input logic test_i, |
| 75 | + /// AXI4+ATOP requests to the slave ports. |
46 | 76 | input slv_req_t [Cfg.NoSlvPorts-1:0] slv_ports_req_i, |
| 77 | + /// AXI4+ATOP responses of the slave ports. |
47 | 78 | output slv_resp_t [Cfg.NoSlvPorts-1:0] slv_ports_resp_o, |
| 79 | + /// AXI4+ATOP requests of the master ports. |
48 | 80 | output mst_req_t [Cfg.NoMstPorts-1:0] mst_ports_req_o, |
| 81 | + /// AXI4+ATOP responses to the master ports. |
49 | 82 | input mst_resp_t [Cfg.NoMstPorts-1:0] mst_ports_resp_i, |
| 83 | + /// Address map array input for the crossbar. This map is global for the whole module. |
| 84 | + /// It is used for routing the transactions to the respective master ports. |
| 85 | + /// Each master port can have multiple different rules. |
50 | 86 | input rule_t [Cfg.NoAddrRules-1:0] addr_map_i, |
| 87 | + /// Enable default master port. |
51 | 88 | input logic [Cfg.NoSlvPorts-1:0] en_default_mst_port_i, |
52 | 89 | `ifdef VCS |
| 90 | + /// Enables a default master port for each slave port. When this is enabled unmapped |
| 91 | + /// transactions get issued at the master port given by `default_mst_port_i`. |
| 92 | + /// When not used, tie to `'0`. |
53 | 93 | input logic [Cfg.NoSlvPorts-1:0][MstPortsIdxWidth-1:0] default_mst_port_i |
54 | 94 | `else |
| 95 | + /// Enables a default master port for each slave port. When this is enabled unmapped |
| 96 | + /// transactions get issued at the master port given by `default_mst_port_i`. |
| 97 | + /// When not used, tie to `'0`. |
55 | 98 | input logic [Cfg.NoSlvPorts-1:0][idx_width(Cfg.NoMstPorts)-1:0] default_mst_port_i |
56 | 99 | `endif |
57 | 100 | ); |
58 | 101 |
|
59 | | - typedef logic [Cfg.AxiAddrWidth-1:0] addr_t; |
| 102 | + // Address tpye for inidvidual address signals |
| 103 | + typedef logic [Cfg.AxiAddrWidth-1:0] addr_t; |
60 | 104 | // to account for the decoding error slave |
61 | 105 | `ifdef VCS |
62 | 106 | localparam int unsigned MstPortsIdxWidthOne = |
@@ -204,8 +248,23 @@ import cf_math_pkg::idx_width; |
204 | 248 | for (genvar i = 0; i < Cfg.NoSlvPorts; i++) begin : gen_xbar_slv_cross |
205 | 249 | for (genvar j = 0; j < Cfg.NoMstPorts; j++) begin : gen_xbar_mst_cross |
206 | 250 | if (Connectivity[i][j]) begin : gen_connection |
207 | | - assign mst_reqs[j][i] = slv_reqs[i][j]; |
208 | | - assign slv_resps[i][j] = mst_resps[j][i]; |
| 251 | + axi_multicut #( |
| 252 | + .NoCuts ( Cfg.PipelineStages ), |
| 253 | + .aw_chan_t ( slv_aw_chan_t ), |
| 254 | + .w_chan_t ( w_chan_t ), |
| 255 | + .b_chan_t ( slv_b_chan_t ), |
| 256 | + .ar_chan_t ( slv_ar_chan_t ), |
| 257 | + .r_chan_t ( slv_r_chan_t ), |
| 258 | + .axi_req_t ( slv_req_t ), |
| 259 | + .axi_resp_t ( slv_resp_t ) |
| 260 | + ) i_axi_multicut_xbar_pipeline ( |
| 261 | + .clk_i, |
| 262 | + .rst_ni, |
| 263 | + .slv_req_i ( slv_reqs[i][j] ), |
| 264 | + .slv_resp_o ( slv_resps[i][j] ), |
| 265 | + .mst_req_o ( mst_reqs[j][i] ), |
| 266 | + .mst_resp_i ( mst_resps[j][i] ) |
| 267 | + ); |
209 | 268 |
|
210 | 269 | end else begin : gen_no_connection |
211 | 270 | assign mst_reqs[j][i] = '0; |
|
0 commit comments