Skip to content

Commit 95171ee

Browse files
add 'mparam' field
(refs: #9)
1 parent 004f49e commit 95171ee

15 files changed

+130
-61
lines changed

pzcorebus_1_to_m_switch/pzcorebus_1_to_m_switch.sv

+7-14
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,17 @@ module pzcorebus_1_to_m_switch
2929
parameter int DATA_DEPTH = 2,
3030
parameter int RESPONSE_DEPTH = 2,
3131
parameter bit ALIGN_OUT = 0,
32-
parameter int MINFO_WIDTH = get_request_info_width(BUS_CONFIG, 1),
3332
parameter bit SVA_CHECKER = 1,
3433
parameter bit REQUEST_SVA_CHECKER = SVA_CHECKER,
3534
parameter bit RESPONSE_SVA_CHECKER = SVA_CHECKER
3635
)(
37-
input var i_clk,
38-
input var i_rst_n,
39-
input var pzbcm_arbiter_config i_arbiter_config,
40-
output var pzcorebus_command_type o_mcmd,
41-
output var [BUS_CONFIG.id_width-1:0] o_mid,
42-
output var [BUS_CONFIG.address_width-1:0] o_maddr,
43-
output var [MINFO_WIDTH-1:0] o_minfo,
44-
input var [SELECT_WIDTH-1:0] i_select,
45-
pzcorebus_if.slave slave_if,
46-
pzcorebus_if.master master_if[MASTERS]
36+
input var i_clk,
37+
input var i_rst_n,
38+
input var pzbcm_arbiter_config i_arbiter_config,
39+
output var pzcorebus_command o_mcmd,
40+
input var [SELECT_WIDTH-1:0] i_select,
41+
pzcorebus_if.slave slave_if,
42+
pzcorebus_if.master master_if[MASTERS]
4743
);
4844
pzcorebus_if #(BUS_CONFIG) bus_if[1+MASTERS]();
4945

@@ -89,9 +85,6 @@ module pzcorebus_1_to_m_switch
8985
.i_clk (i_clk ),
9086
.i_rst_n (i_rst_n ),
9187
.o_mcmd (o_mcmd ),
92-
.o_mid (o_mid ),
93-
.o_maddr (o_maddr ),
94-
.o_minfo (o_minfo ),
9588
.i_select (i_select ),
9689
.slave_if (bus_if[0] ),
9790
.master_if (bus_if[1:MASTERS] )

pzcorebus_1_to_m_switch/pzcorebus_request_1_to_m_switch.sv

+8-18
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,14 @@ module pzcorebus_request_1_to_m_switch
2222
parameter int COMMAND_DEPTH = 2,
2323
parameter int DATA_DEPTH = 2,
2424
parameter bit ALIGN_OUT = 0,
25-
parameter int MINFO_WIDTH = get_request_info_width(BUS_CONFIG, 1),
2625
parameter bit SVA_CHECKER = 1
2726
)(
28-
input var i_clk,
29-
input var i_rst_n,
30-
output var pzcorebus_command_type o_mcmd,
31-
output var [BUS_CONFIG.id_width-1:0] o_mid,
32-
output var [BUS_CONFIG.address_width-1:0] o_maddr,
33-
output var [MINFO_WIDTH-1:0] o_minfo,
34-
input var [SELECT_WIDTH-1:0] i_select,
35-
interface.request_slave slave_if,
36-
interface.request_master master_if[MASTERS]
27+
input var i_clk,
28+
input var i_rst_n,
29+
output var pzcorebus_command o_mcmd,
30+
input var [SELECT_WIDTH-1:0] i_select,
31+
interface.request_slave slave_if,
32+
interface.request_master master_if[MASTERS]
3733
);
3834
localparam bit BROADCAST = is_csr_profile(BUS_CONFIG) && ENABLE_BROADCAST;
3935

@@ -95,10 +91,7 @@ module pzcorebus_request_1_to_m_switch
9591

9692
if (EXTERNAL_DECODE) begin : g_command_select
9793
always_comb begin
98-
o_mcmd = aligner_if.mcmd;
99-
o_mid = aligner_if.mid;
100-
o_maddr = aligner_if.maddr;
101-
o_minfo = aligner_if.minfo;
94+
o_mcmd = aligner_if.get_command();
10295
end
10396

10497
always_comb begin
@@ -107,10 +100,7 @@ module pzcorebus_request_1_to_m_switch
107100
end
108101
else begin : g_command_select
109102
always_comb begin
110-
o_mcmd = pzcorebus_command_type'(0);
111-
o_mid = '0;
112-
o_maddr = '0;
113-
o_minfo = '0;
103+
o_mcmd = '0;
114104
end
115105

116106
always_comb begin

pzcorebus_axi_bridge/pzcorebus_axi2corebus_simple_bridge.sv

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ module pzcorebus_axi2corebus_simple_bridge
102102
read_bus_if.mid = axi_if.arid;
103103
read_bus_if.maddr = get_maddr(axi_if.araddr, axi_if.arlen, axi_if.arsize);
104104
read_bus_if.mlength = get_mlength(axi_if.araddr, axi_if.arlen, axi_if.arsize);
105+
read_bus_if.mparam = '0;
105106
read_bus_if.minfo = '0;
106107
end
107108

@@ -201,6 +202,7 @@ module pzcorebus_axi2corebus_simple_bridge
201202
write_bus_if.mid = axi_if.awid;
202203
write_bus_if.maddr = get_maddr(axi_if.awaddr, axi_if.awlen, axi_if.awsize);
203204
write_bus_if.mlength = get_mlength(axi_if.awaddr, axi_if.awlen, axi_if.awsize);
205+
write_bus_if.mparam = '0;
204206
write_bus_if.minfo = '0;
205207
end
206208

pzcorebus_common/pzcorebus_base_address_remover.sv

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module pzcorebus_base_address_remover
2121
master_if.mid = slave_if.mid;
2222
master_if.maddr = slave_if.maddr & (~i_base_mask);
2323
master_if.mlength = slave_if.mlength;
24+
master_if.mparam = slave_if.mparam;
2425
master_if.minfo = slave_if.minfo;
2526
end
2627

pzcorebus_common/pzcorebus_broadcast_forcer.sv

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ module pzcorebus_broadcast_forcer
2020
master_if.mid = slave_if.mid;
2121
master_if.maddr = slave_if.maddr;
2222
master_if.mlength = slave_if.mlength;
23+
master_if.mparam = slave_if.mparam;
2324
master_if.minfo = slave_if.minfo;
2425
end
2526

pzcorebus_common/pzcorebus_id_assigner.sv

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ module pzcorebus_id_assigner
3737
master_if.mid = get_mid(i_base_id, slave_if.mid);
3838
master_if.maddr = slave_if.maddr;
3939
master_if.mlength = slave_if.mlength;
40+
master_if.mparam = slave_if.mparam;
4041
master_if.minfo = slave_if.minfo;
4142
end
4243

@@ -100,6 +101,7 @@ module pzcorebus_request_id_assigner
100101
master_if.mid = get_mid(i_base_id, slave_if.mid);
101102
master_if.maddr = slave_if.maddr;
102103
master_if.mlength = slave_if.mlength;
104+
master_if.mparam = slave_if.mparam;
103105
master_if.minfo = slave_if.minfo;
104106
end
105107

pzcorebus_common/pzcorebus_if.sv

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ interface pzcorebus_if
5555
output mid,
5656
output maddr,
5757
output mlength,
58+
output mparam,
5859
output minfo,
5960
input sdata_accept,
6061
output mdata_valid,
@@ -123,6 +124,7 @@ interface pzcorebus_if
123124
input mcmd,
124125
input mid,
125126
input maddr,
127+
input mparam,
126128
input mlength,
127129
input minfo,
128130
output sdata_accept,
@@ -193,6 +195,7 @@ interface pzcorebus_if
193195
input mid,
194196
input maddr,
195197
input mlength,
198+
input mparam,
196199
input minfo,
197200
input sdata_accept,
198201
input mdata_valid,
@@ -262,6 +265,7 @@ interface pzcorebus_if
262265
output mid,
263266
output maddr,
264267
output mlength,
268+
output mparam,
265269
output minfo,
266270
output mdata_valid,
267271
output sdata_accept,

pzcorebus_common/pzcorebus_if_internal_macros.svh

+43-21
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ typedef logic [BUS_CONFIG.address_width-1:0] pzcorebus_addrss
1313
typedef logic [get_length_width(BUS_CONFIG, 1)-1:0] pzcorebus_length; \
1414
typedef logic [get_unpacked_length_width(BUS_CONFIG)-1:0] pzcorebus_unpacked_length; \
1515
typedef logic [get_burst_length_width(BUS_CONFIG)-1:0] pzcorebus_burst_length; \
16+
typedef logic [get_request_param_width(BUS_CONFIG, 1)-1:0] pzcorebus_request_param; \
1617
typedef logic [get_request_info_width(BUS_CONFIG, 1)-1:0] pzcorebus_request_info; \
1718
typedef logic [get_response_info_width(BUS_CONFIG, 1)-1:0] pzcorebus_response_info; \
1819
typedef logic [BUS_CONFIG.data_width-1:0] pzcorebus_data; \
@@ -34,6 +35,7 @@ pzcorebus_command_type mcmd; \
3435
pzcorebus_id mid; \
3536
pzcorebus_addrss maddr; \
3637
pzcorebus_length mlength; \
38+
pzcorebus_request_param mparam; \
3739
pzcorebus_request_info minfo; \
3840
logic sdata_accept; \
3941
logic mdata_valid; \
@@ -69,6 +71,9 @@ function automatic pzcorebus_packed_command get_packed_command(); \
6971
if (COMMAND_POSITION_LIST.mlength.width > 0) begin \
7072
`pzcorebus_if_get_packer(packer, COMMAND_POSITION_LIST.mlength) = mlength; \
7173
end \
74+
if (COMMAND_POSITION_LIST.mparam.width > 0) begin \
75+
`pzcorebus_if_get_packer(packer, COMMAND_POSITION_LIST.mparam) = mparam; \
76+
end \
7277
if (COMMAND_POSITION_LIST.minfo.width > 0) begin \
7378
`pzcorebus_if_get_packer(packer, COMMAND_POSITION_LIST.minfo) = minfo; \
7479
end \
@@ -93,7 +98,13 @@ function automatic void put_packed_command(pzcorebus_packed_command command); \
9398
else begin \
9499
mlength = '0; \
95100
end \
96-
if (BUS_CONFIG.request_info_width > 0) begin \
101+
if (COMMAND_POSITION_LIST.mparam.width > 0) begin \
102+
mparam = `pzcorebus_if_get_packer(packer, COMMAND_POSITION_LIST.mparam); \
103+
end \
104+
else begin \
105+
mparam = '0; \
106+
end \
107+
if (COMMAND_POSITION_LIST.minfo.width > 0) begin \
97108
minfo = `pzcorebus_if_get_packer(packer, COMMAND_POSITION_LIST.minfo); \
98109
end \
99110
else begin \
@@ -121,7 +132,13 @@ function automatic pzcorebus_command get_command(); \
121132
else begin \
122133
command.length = '0; \
123134
end \
124-
if (BUS_CONFIG.request_info_width > 0) begin \
135+
if (COMMAND_POSITION_LIST.mparam.width > 0) begin \
136+
command.param = mparam; \
137+
end \
138+
else begin \
139+
command.param = '0; \
140+
end \
141+
if (COMMAND_POSITION_LIST.minfo.width > 0) begin \
125142
command.info = minfo; \
126143
end \
127144
else begin \
@@ -152,7 +169,13 @@ function automatic void put_command(pzcorebus_command command); \
152169
else begin \
153170
mlength = '0; \
154171
end \
155-
if (BUS_CONFIG.request_info_width > 0) begin \
172+
if (COMMAND_POSITION_LIST.mparam.width > 0) begin \
173+
mparam = command.param; \
174+
end \
175+
else begin \
176+
mparam = '0; \
177+
end \
178+
if (COMMAND_POSITION_LIST.minfo.width > 0) begin \
156179
minfo = command.info; \
157180
end \
158181
else begin \
@@ -392,25 +415,18 @@ endfunction \
392415
localparam int DATA_SIZE = BUS_CONFIG.data_width / BUS_CONFIG.unit_data_width; \
393416
localparam int LENGTH_OFFSET_LSB = $clog2(BUS_CONFIG.unit_data_width / 8); \
394417
localparam int LENGTH_OFFSET_WIDTH = (DATA_SIZE > 1) ? $clog2(DATA_SIZE) : 1; \
395-
localparam int BURST_OFFSET = DATA_SIZE - 1; \
396-
localparam int BURST_SHIFT = $clog2(DATA_SIZE); \
397418
\
398419
function automatic pzcorebus_unpacked_length get_length(); \
399420
case (1'b1) \
400421
`pzcorebus_csr_profile(BUS_CONFIG): return pzcorebus_unpacked_length'(1); \
401-
is_atomic_command(): return pzcorebus_unpacked_length'(DATA_SIZE); \
402422
is_message_command(): return pzcorebus_unpacked_length'(0); \
403423
default: return unpack_length(); \
404424
endcase \
405425
endfunction \
406426
\
407427
function automatic pzcorebus_unpacked_length get_aligned_length(); \
408428
pzcorebus_unpacked_length offset; \
409-
logic no_offset; \
410-
no_offset = \
411-
(!`pzcorebus_memoy_h_profile(BUS_CONFIG)) || (DATA_SIZE == 1) || \
412-
is_atomic_command() || is_message_command(); \
413-
if (no_offset) begin \
429+
if ((DATA_SIZE == 1) || is_atomic_command() || is_message_command()) begin \
414430
offset = pzcorebus_unpacked_length'(0); \
415431
end \
416432
else begin \
@@ -420,20 +436,21 @@ function automatic pzcorebus_unpacked_length get_aligned_length(); \
420436
endfunction \
421437
\
422438
function automatic pzcorebus_burst_length get_burst_length(); \
423-
if (`pzcorebus_memoy_h_profile(BUS_CONFIG)) begin \
424-
pzcorebus_unpacked_length length; \
425-
length = get_aligned_length() + pzcorebus_unpacked_length'(BURST_OFFSET); \
426-
return pzcorebus_burst_length'(length >> BURST_SHIFT); \
439+
if ((DATA_SIZE == 1) || `pzcorebus_csr_profile(BUS_CONFIG)) begin \
440+
return pzcorebus_burst_length'(get_length()); \
427441
end \
428442
else begin \
429-
return pzcorebus_burst_length'(get_length()); \
443+
pzcorebus_unpacked_length length; \
444+
length = get_aligned_length() + pzcorebus_unpacked_length'(DATA_SIZE - 1); \
445+
return pzcorebus_burst_length'(length / DATA_SIZE); \
430446
end \
431447
endfunction \
432448
\
433449
function automatic pzcorebus_unpacked_length get_response_length(); \
434450
case (1'b1) \
435451
is_posted_command(): return pzcorebus_unpacked_length'(0); \
436-
is_read_command(): return unpack_length(); \
452+
is_read_command(), \
453+
is_atomic_command(): return unpack_length(); \
437454
default: return pzcorebus_unpacked_length'(DATA_SIZE); \
438455
endcase \
439456
endfunction
@@ -448,7 +465,7 @@ function automatic pzcorebus_packed_response get_packed_response(); \
448465
`pzcorebus_if_get_packer(packer, RESPONSE_POSITION_LIST.sid) = sid; \
449466
`pzcorebus_if_get_packer(packer, RESPONSE_POSITION_LIST.serror) = serror; \
450467
`pzcorebus_if_get_packer(packer, RESPONSE_POSITION_LIST.sdata) = sdata; \
451-
if (BUS_CONFIG.response_info_width > 0) begin \
468+
if (RESPONSE_POSITION_LIST.sinfo.width > 0) begin \
452469
`pzcorebus_if_get_packer(packer, RESPONSE_POSITION_LIST.sinfo) = sinfo; \
453470
end \
454471
if (`pzcorebus_memoy_h_profile(BUS_CONFIG)) begin \
@@ -467,7 +484,7 @@ function automatic void put_packed_response(pzcorebus_packed_response response);
467484
sid = `pzcorebus_if_get_packer(packer, RESPONSE_POSITION_LIST.sid); \
468485
serror = `pzcorebus_if_get_packer(packer, RESPONSE_POSITION_LIST.serror); \
469486
sdata = `pzcorebus_if_get_packer(packer, RESPONSE_POSITION_LIST.sdata); \
470-
if (BUS_CONFIG.response_info_width > 0) begin \
487+
if (RESPONSE_POSITION_LIST.sinfo.width > 0) begin \
471488
sinfo = `pzcorebus_if_get_packer(packer, RESPONSE_POSITION_LIST.sinfo); \
472489
end \
473490
else begin \
@@ -493,7 +510,7 @@ function automatic pzcorebus_response get_response(); \
493510
response.id = sid; \
494511
response.error = serror; \
495512
response.data = sdata; \
496-
response.info = (BUS_CONFIG.response_info_width > 0 ) ? sinfo : '0; \
513+
response.info = (RESPONSE_POSITION_LIST.sinfo.width > 0) ? sinfo : '0; \
497514
response.unit_enable = (`pzcorebus_memoy_h_profile(BUS_CONFIG)) ? sresp_uniten : '0; \
498515
response.last = (`pzcorebus_memoy_profile(BUS_CONFIG) ) ? sresp_last : '0; \
499516
return response; \
@@ -504,7 +521,7 @@ function automatic void put_response(pzcorebus_response response); \
504521
sid = response.id; \
505522
serror = response.error; \
506523
sdata = response.data; \
507-
if (BUS_CONFIG.response_info_width > 0) begin \
524+
if (RESPONSE_POSITION_LIST.sinfo.width > 0) begin \
508525
sinfo = response.info; \
509526
end \
510527
else begin \
@@ -552,6 +569,7 @@ modport request_master ( \
552569
output mid, \
553570
output maddr, \
554571
output mlength, \
572+
output mparam, \
555573
output minfo, \
556574
input sdata_accept, \
557575
output mdata_valid, \
@@ -604,6 +622,7 @@ modport command_master ( \
604622
output mcmd, \
605623
output mid, \
606624
output maddr, \
625+
output mparam, \
607626
output mlength, \
608627
output minfo, \
609628
import put_packed_command, \
@@ -659,6 +678,7 @@ modport request_slave ( \
659678
input mid, \
660679
input maddr, \
661680
input mlength, \
681+
input mparam, \
662682
input minfo, \
663683
output sdata_accept, \
664684
input mdata_valid, \
@@ -712,6 +732,7 @@ modport command_slave ( \
712732
input mid, \
713733
input maddr, \
714734
input mlength, \
735+
input mparam, \
715736
input minfo, \
716737
import get_packed_command, \
717738
import get_command, \
@@ -766,6 +787,7 @@ modport request_monitor ( \
766787
input mid, \
767788
input maddr, \
768789
input mlength, \
790+
input mparam, \
769791
input minfo, \
770792
input sdata_accept, \
771793
input mdata_valid, \

pzcorebus_common/pzcorebus_if_pkg.sv

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package pzcorebus_if_pkg;
1919
pzcorebus_if_position_info mid;
2020
pzcorebus_if_position_info maddr;
2121
pzcorebus_if_position_info mlength;
22+
pzcorebus_if_position_info mparam;
2223
pzcorebus_if_position_info minfo;
2324
pzcorebus_if_position_info mdata;
2425
pzcorebus_if_position_info mdata_byteen;
@@ -57,7 +58,9 @@ package pzcorebus_if_pkg;
5758
list.maddr.width = bus_config.address_width;
5859
list.mlength.lsb = calc_next_lsb(list.maddr);
5960
list.mlength.width = get_length_width(bus_config, 0);
60-
list.minfo.lsb = calc_next_lsb(list.mlength);
61+
list.mparam.lsb = calc_next_lsb(list.mlength);
62+
list.mparam.width = get_request_param_width(bus_config, 0);
63+
list.minfo.lsb = calc_next_lsb(list.mparam);
6164
list.minfo.width = get_request_info_width(bus_config, 0);
6265

6366
if (`pzcorebus_csr_profile(bus_config)) begin
@@ -137,6 +140,7 @@ package pzcorebus_if_pkg;
137140
width += list.mid.width;
138141
width += list.maddr.width;
139142
width += list.mlength.width;
143+
width += list.mparam.width;
140144
width += list.minfo.width;
141145
width += list.mdata.width;
142146
width += list.mdata_byteen.width;

0 commit comments

Comments
 (0)