Skip to content

Commit b9708b4

Browse files
committed
Add axi_xslv
Signed-off-by: Nils Wistoff <nwistoff@iis.ee.ethz.ch>
1 parent ab99153 commit b9708b4

File tree

4 files changed

+358
-0
lines changed

4 files changed

+358
-0
lines changed

Bender.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ sources:
9494
- src/axi_xp.sv
9595
- src/autocc_axi_xbar_pkg.sv
9696
- src/axi_xbar_superwrap.sv
97+
- src/axi_xslv_superwrap.sv
9798

9899
- target: synth_test
99100
files:

src/axi_xslv.sv

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
// Copyright (c) 2024 ETH Zurich and University of Bologna.
2+
// Copyright and related rights are licensed under the Solderpad Hardware
3+
// License, Version 0.51 (the "License"); you may not use this file except in
4+
// compliance with the License. You may obtain a copy of the License at
5+
// http://solderpad.org/licenses/SHL-0.51. Unless required by applicable law
6+
// or agreed to in writing, software, hardware and materials distributed under
7+
// this License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
8+
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
9+
// specific language governing permissions and limitations under the License.
10+
//
11+
// Authors:
12+
// - Nils Wistoff <nwistoff@iis.ee.ethz.ch>
13+
14+
module axi_xslv
15+
import cf_math_pkg::idx_width;
16+
#(
17+
parameter axi_pkg::xbar_cfg_t Cfg = '0,
18+
parameter bit ATOPs = 1'b1,
19+
parameter bit [Cfg.NoSlvPorts-1:0][Cfg.NoMstPorts-1:0] Connectivity = '1,
20+
parameter type slv_aw_chan_t = logic,
21+
parameter type mst_aw_chan_t = logic,
22+
parameter type w_chan_t = logic,
23+
parameter type slv_b_chan_t = logic,
24+
parameter type mst_b_chan_t = logic,
25+
parameter type slv_ar_chan_t = logic,
26+
parameter type mst_ar_chan_t = logic,
27+
parameter type slv_r_chan_t = logic,
28+
parameter type mst_r_chan_t = logic,
29+
parameter type slv_req_t = logic,
30+
parameter type slv_resp_t = logic,
31+
parameter type mst_req_t = logic,
32+
parameter type mst_resp_t = logic,
33+
parameter type rule_t = axi_pkg::xbar_rule_64_t
34+
) (
35+
/// Clock, positive edge triggered.
36+
input logic clk_i,
37+
/// Asynchronous reset, active low.
38+
input logic rst_ni,
39+
/// Testmode enable, active high.
40+
input logic test_i,
41+
/*AUTOSVA
42+
slv_port_r_req_0: slv_port_r_req_0 --IN> slv_port_r_resp_0
43+
slv_port_r_req_0_val = slv_ports_req_i[0].ar_valid
44+
slv_port_r_req_0_rdy = slv_ports_resp_o[0].ar_ready
45+
slv_port_r_req_0_transid = slv_ports_req_i[0].ar.id
46+
slv_port_r_resp_0_val = slv_ports_resp_o[0].r_valid
47+
slv_port_r_resp_0_rdy = slv_ports_req_i[0].r_ready
48+
slv_port_r_resp_0_transid = slv_ports_resp_o[0].r.id
49+
slv_port_r_req_1: slv_port_r_req_1 --IN> slv_port_r_resp_1
50+
slv_port_r_req_1_val = slv_ports_req_i[1].ar_valid
51+
slv_port_r_req_1_rdy = slv_ports_resp_o[1].ar_ready
52+
slv_port_r_req_1_transid = slv_ports_req_i[1].ar.id
53+
slv_port_r_resp_1_val = slv_ports_resp_o[1].r_valid
54+
slv_port_r_resp_1_rdy = slv_ports_req_i[1].r_ready
55+
slv_port_r_resp_1_transid = slv_ports_resp_o[1].r.id
56+
slv_port_w_req_0: slv_port_w_req_0 --IN> slv_port_w_resp_0
57+
slv_port_w_req_0_val = slv_ports_req_i[0].aw_valid
58+
slv_port_w_req_0_rdy = slv_ports_resp_o[0].aw_ready
59+
slv_port_w_req_0_transid = slv_ports_req_i[0].aw.id
60+
slv_port_w_resp_0_val = slv_ports_resp_o[0].b_valid
61+
slv_port_w_resp_0_rdy = slv_ports_req_i[0].b_ready
62+
slv_port_w_resp_0_transid = slv_ports_resp_o[0].b.id
63+
slv_port_w_req_1: slv_port_w_req_1 --IN> slv_port_w_resp_1
64+
slv_port_w_req_1_val = slv_ports_req_i[1].aw_valid
65+
slv_port_w_req_1_rdy = slv_ports_resp_o[1].aw_ready
66+
slv_port_w_req_1_transid = slv_ports_req_i[1].aw.id
67+
slv_port_w_resp_1_val = slv_ports_resp_o[1].b_valid
68+
slv_port_w_resp_1_rdy = slv_ports_req_i[1].b_ready
69+
slv_port_w_resp_1_transid = slv_ports_resp_o[1].b.id
70+
*/
71+
/// AXI4+ATOP requests to the slave ports.
72+
input slv_req_t [Cfg.NoSlvPorts-1:0] slv_ports_req_i,
73+
/// AXI4+ATOP responses of the slave ports.
74+
output slv_resp_t [Cfg.NoSlvPorts-1:0] slv_ports_resp_o,
75+
/// Address map array input for the crossbar. This map is global for the whole module.
76+
/// It is used for routing the transactions to the respective master ports.
77+
/// Each master port can have multiple different rules.
78+
input rule_t [Cfg.NoAddrRules-1:0] addr_map_i,
79+
/// Enable default master port.
80+
input logic [Cfg.NoSlvPorts-1:0] en_default_mst_port_i,
81+
`ifdef VCS
82+
/// Enables a default master port for each slave port. When this is enabled unmapped
83+
/// transactions get issued at the master port given by `default_mst_port_i`.
84+
/// When not used, tie to `'0`.
85+
input logic [Cfg.NoSlvPorts-1:0][MstPortsIdxWidth-1:0] default_mst_port_i
86+
`else
87+
/// Enables a default master port for each slave port. When this is enabled unmapped
88+
/// transactions get issued at the master port given by `default_mst_port_i`.
89+
/// When not used, tie to `'0`.
90+
input logic [Cfg.NoSlvPorts-1:0][idx_width(Cfg.NoMstPorts)-1:0] default_mst_port_i
91+
`endif
92+
);
93+
94+
95+
// =========
96+
// Testbench
97+
// =========
98+
99+
mst_req_t [Cfg.NoMstPorts-1:0] mst_ports_req;
100+
mst_resp_t [Cfg.NoMstPorts-1:0] mst_ports_resp;
101+
102+
axi_xbar #(
103+
.Cfg(Cfg),
104+
.ATOPs(ATOPs),
105+
.Connectivity(Connectivity),
106+
.slv_aw_chan_t(slv_aw_chan_t),
107+
.mst_aw_chan_t(mst_aw_chan_t),
108+
.w_chan_t(w_chan_t),
109+
.slv_b_chan_t(slv_b_chan_t),
110+
.mst_b_chan_t(mst_b_chan_t),
111+
.slv_ar_chan_t(slv_ar_chan_t),
112+
.mst_ar_chan_t(mst_ar_chan_t),
113+
.slv_r_chan_t(slv_r_chan_t),
114+
.mst_r_chan_t(mst_r_chan_t),
115+
.slv_req_t(slv_req_t),
116+
.slv_resp_t(slv_resp_t),
117+
.mst_req_t(mst_req_t),
118+
.mst_resp_t(mst_resp_t),
119+
.rule_t(rule_t)
120+
) i_axi_xbar (
121+
.clk_i(clk_i),
122+
.rst_ni(rst_ni),
123+
.test_i(test_i),
124+
.slv_ports_req_i(slv_ports_req_i),
125+
.slv_ports_resp_o(slv_ports_resp_o),
126+
.mst_ports_req_o(mst_ports_req),
127+
.mst_ports_resp_i(mst_ports_resp),
128+
.addr_map_i(addr_map_i),
129+
.en_default_mst_port_i(en_default_mst_port_i),
130+
.default_mst_port_i(default_mst_port_i)
131+
);
132+
133+
for (genvar i = 0; i < Cfg.NoSlvPorts; i++) begin : gen_zero_mems
134+
axi_zero_mem #(
135+
.axi_req_t(mst_req_t),
136+
.axi_resp_t(mst_resp_t),
137+
.AddrWidth($bits(mst_ports_req[0].ar.addr)),
138+
.DataWidth($bits(mst_ports_req[0].w.data)),
139+
.IdWidth($bits(mst_ports_req[0].ar.id)),
140+
.NumBanks(1),
141+
.BufDepth(1)
142+
) i_axi_zero_mem (
143+
.clk_i,
144+
.rst_ni,
145+
.busy_o(),
146+
.axi_req_i(mst_ports_req[i]),
147+
.axi_resp_o(mst_ports_resp[i])
148+
);
149+
end
150+
151+
endmodule

src/axi_xslv_superwrap.sv

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// Copyright (c) 2024 ETH Zurich and University of Bologna.
2+
// Copyright and related rights are licensed under the Solderpad Hardware
3+
// License, Version 0.51 (the "License"); you may not use this file except in
4+
// compliance with the License. You may obtain a copy of the License at
5+
// http://solderpad.org/licenses/SHL-0.51. Unless required by applicable law
6+
// or agreed to in writing, software, hardware and materials distributed under
7+
// this License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
8+
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
9+
// specific language governing permissions and limitations under the License.
10+
//
11+
// Authors:
12+
// - Nils Wistoff <nwistoff@iis.ee.ethz.ch>
13+
14+
module axi_xslv_superwrap
15+
import cf_math_pkg::idx_width;
16+
import autocc_axi_xbar_pkg::*;
17+
#(
18+
parameter ASSERT_INPUTS = 0
19+
) (
20+
/// Clock, positive edge triggered.
21+
input logic clk_i,
22+
/// Asynchronous reset, active low.
23+
input logic rst_ni,
24+
/// Testmode enable, active high.
25+
input logic test_i,
26+
/// AXI4+ATOP requests to the slave ports.
27+
input slv_req_t [Cfg.NoSlvPorts-1:0] slv_ports_req_i_2,
28+
input slv_req_t [Cfg.NoSlvPorts-1:0] slv_ports_req_i,
29+
/// AXI4+ATOP responses of the slave ports.
30+
output slv_resp_t [Cfg.NoSlvPorts-1:0] slv_ports_resp_o_2,
31+
output slv_resp_t [Cfg.NoSlvPorts-1:0] slv_ports_resp_o,
32+
/// Address map array input for the crossbar. This map is global for the whole module.
33+
/// It is used for routing the transactions to the respective master ports.
34+
/// Each master port can have multiple different rules.
35+
input rule_t [Cfg.NoAddrRules-1:0] addr_map_i,
36+
/// Enable default master port.
37+
input logic [Cfg.NoSlvPorts-1:0] en_default_mst_port_i,
38+
`ifdef VCS
39+
/// Enables a default master port for each slave port. When this is enabled unmapped
40+
/// transactions get issued at the master port given by `default_mst_port_i`.
41+
/// When not used, tie to `'0`.
42+
input logic [Cfg.NoSlvPorts-1:0][MstPortsIdxWidth-1:0] default_mst_port_i
43+
`else
44+
/// Enables a default master port for each slave port. When this is enabled unmapped
45+
/// transactions get issued at the master port given by `default_mst_port_i`.
46+
/// When not used, tie to `'0`.
47+
input logic [Cfg.NoSlvPorts-1:0][idx_width(Cfg.NoMstPorts)-1:0] default_mst_port_i
48+
`endif
49+
);
50+
51+
52+
// =========
53+
// Testbench
54+
// =========
55+
56+
axi_xslv_wrap #(
57+
.Cfg(Cfg),
58+
.ATOPs(ATOPs),
59+
.Connectivity(Connectivity),
60+
.slv_aw_chan_t(slv_aw_chan_t),
61+
.mst_aw_chan_t(mst_aw_chan_t),
62+
.w_chan_t(slv_w_chan_t),
63+
.slv_b_chan_t(slv_b_chan_t),
64+
.mst_b_chan_t(mst_b_chan_t),
65+
.slv_ar_chan_t(slv_ar_chan_t),
66+
.mst_ar_chan_t(mst_ar_chan_t),
67+
.slv_r_chan_t(slv_r_chan_t),
68+
.mst_r_chan_t(mst_r_chan_t),
69+
.slv_req_t(slv_req_t),
70+
.slv_resp_t(slv_resp_t),
71+
.mst_req_t(mst_req_t),
72+
.mst_resp_t(mst_resp_t),
73+
.rule_t(rule_t)
74+
) i_axi_xslv_wrap (
75+
.clk_i(clk_i),
76+
.rst_ni(rst_ni),
77+
.test_i(test_i),
78+
.slv_ports_req_i_2(slv_ports_req_i_2),
79+
.slv_ports_req_i(slv_ports_req_i),
80+
.slv_ports_resp_o_2(slv_ports_resp_o_2),
81+
.slv_ports_resp_o(slv_ports_resp_o),
82+
.addr_map_i(addr_map_i),
83+
.en_default_mst_port_i(en_default_mst_port_i),
84+
.default_mst_port_i(default_mst_port_i)
85+
);
86+
87+
endmodule

src/axi_xslv_wrap.sv

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// This property file was autogenerated by AutoCC on 2024-11-22
2+
// to check the behavior of the original RTL module, whose interface is described below:
3+
4+
module axi_xslv_wrap
5+
import cf_math_pkg::idx_width;
6+
#(
7+
parameter ASSERT_INPUTS = 0,
8+
parameter axi_pkg::xbar_cfg_t Cfg = '0,
9+
parameter bit ATOPs = 1'b1,
10+
parameter bit [Cfg.NoSlvPorts-1:0][Cfg.NoMstPorts-1:0] Connectivity = '1,
11+
parameter type slv_aw_chan_t = logic,
12+
parameter type mst_aw_chan_t = logic,
13+
parameter type w_chan_t = logic,
14+
parameter type slv_b_chan_t = logic,
15+
parameter type mst_b_chan_t = logic,
16+
parameter type slv_ar_chan_t = logic,
17+
parameter type mst_ar_chan_t = logic,
18+
parameter type slv_r_chan_t = logic,
19+
parameter type mst_r_chan_t = logic,
20+
parameter type slv_req_t = logic,
21+
parameter type slv_resp_t = logic,
22+
parameter type mst_req_t = logic,
23+
parameter type mst_resp_t = logic,
24+
parameter type rule_t = axi_pkg::xbar_rule_64_t
25+
) (
26+
/// Clock, positive edge triggered.
27+
input logic clk_i,
28+
/// Asynchronous reset, active low.
29+
input logic rst_ni,
30+
/// Testmode enable, active high.
31+
input logic test_i,
32+
/// AXI4+ATOP requests to the slave ports.
33+
input slv_req_t [Cfg.NoSlvPorts-1:0] slv_ports_req_i_2,
34+
input slv_req_t [Cfg.NoSlvPorts-1:0] slv_ports_req_i,
35+
/// AXI4+ATOP responses of the slave ports.
36+
output slv_resp_t [Cfg.NoSlvPorts-1:0] slv_ports_resp_o_2,
37+
output slv_resp_t [Cfg.NoSlvPorts-1:0] slv_ports_resp_o,
38+
/// Address map array input for the crossbar. This map is global for the whole module.
39+
/// It is used for routing the transactions to the respective master ports.
40+
/// Each master port can have multiple different rules.
41+
input rule_t [Cfg.NoAddrRules-1:0] addr_map_i,
42+
/// Enable default master port.
43+
input logic [Cfg.NoSlvPorts-1:0] en_default_mst_port_i,
44+
`ifdef VCS
45+
/// Enables a default master port for each slave port. When this is enabled unmapped
46+
/// transactions get issued at the master port given by `default_mst_port_i`.
47+
/// When not used, tie to `'0`.
48+
input logic [Cfg.NoSlvPorts-1:0][MstPortsIdxWidth-1:0] default_mst_port_i
49+
`else
50+
/// Enables a default master port for each slave port. When this is enabled unmapped
51+
/// transactions get issued at the master port given by `default_mst_port_i`.
52+
/// When not used, tie to `'0`.
53+
input logic [Cfg.NoSlvPorts-1:0][idx_width(Cfg.NoMstPorts)-1:0] default_mst_port_i
54+
`endif
55+
);
56+
57+
//==============================================================================
58+
// Instance Modules
59+
//==============================================================================
60+
61+
axi_xslv #(
62+
.Cfg(Cfg),
63+
.ATOPs(ATOPs),
64+
.Connectivity(Connectivity),
65+
.slv_aw_chan_t(slv_aw_chan_t),
66+
.mst_aw_chan_t(mst_aw_chan_t),
67+
.w_chan_t(w_chan_t),
68+
.slv_b_chan_t(slv_b_chan_t),
69+
.mst_b_chan_t(mst_b_chan_t),
70+
.slv_ar_chan_t(slv_ar_chan_t),
71+
.mst_ar_chan_t(mst_ar_chan_t),
72+
.slv_r_chan_t(slv_r_chan_t),
73+
.mst_r_chan_t(mst_r_chan_t),
74+
.slv_req_t(slv_req_t),
75+
.slv_resp_t(slv_resp_t),
76+
.mst_req_t(mst_req_t),
77+
.mst_resp_t(mst_resp_t),
78+
.rule_t(rule_t)
79+
) u_axi_xslv (
80+
.clk_i(clk_i),
81+
.rst_ni(rst_ni),
82+
.test_i(test_i),
83+
.slv_ports_req_i(slv_ports_req_i),
84+
.slv_ports_resp_o(slv_ports_resp_o),
85+
.addr_map_i(addr_map_i),
86+
.en_default_mst_port_i(en_default_mst_port_i),
87+
.default_mst_port_i(default_mst_port_i)
88+
);
89+
90+
axi_xslv #(
91+
.Cfg(Cfg),
92+
.ATOPs(ATOPs),
93+
.Connectivity(Connectivity),
94+
.slv_aw_chan_t(slv_aw_chan_t),
95+
.mst_aw_chan_t(mst_aw_chan_t),
96+
.w_chan_t(w_chan_t),
97+
.slv_b_chan_t(slv_b_chan_t),
98+
.mst_b_chan_t(mst_b_chan_t),
99+
.slv_ar_chan_t(slv_ar_chan_t),
100+
.mst_ar_chan_t(mst_ar_chan_t),
101+
.slv_r_chan_t(slv_r_chan_t),
102+
.mst_r_chan_t(mst_r_chan_t),
103+
.slv_req_t(slv_req_t),
104+
.slv_resp_t(slv_resp_t),
105+
.mst_req_t(mst_req_t),
106+
.mst_resp_t(mst_resp_t),
107+
.rule_t(rule_t)
108+
) u_axi_xslv2 (
109+
.clk_i(clk_i),
110+
.rst_ni(rst_ni),
111+
.test_i(test_i),
112+
.slv_ports_req_i(slv_ports_req_i_2),
113+
.slv_ports_resp_o(slv_ports_resp_o_2),
114+
.addr_map_i(addr_map_i),
115+
.en_default_mst_port_i(en_default_mst_port_i),
116+
.default_mst_port_i(default_mst_port_i)
117+
);
118+
119+
endmodule

0 commit comments

Comments
 (0)