@@ -76,17 +76,22 @@ module axi_id_prepend #(
76
76
);
77
77
78
78
// prepend the ID
79
- always_comb begin
80
- for (int unsigned i = 0 ; i < NoBus; i++ ) begin : gen_id_prepend
81
- mst_aw_chans_o[i] = slv_aw_chans_i[i];
82
- mst_aw_chans_o[i].id[AxiIdWidthSlvPort+ : PreIdWidth] = pre_id_i;
83
- mst_ar_chans_o[i] = slv_ar_chans_i[i];
84
- mst_ar_chans_o[i].id[AxiIdWidthSlvPort+ : PreIdWidth] = pre_id_i;
85
- // The ID is in the highest bits of the struct, so an assignment from a channel with a wide ID
86
- // to a channel with a shorter ID correctly cuts the prepended ID.
87
- slv_b_chans_o[i] = mst_b_chans_i[i];
88
- slv_r_chans_o[i] = mst_r_chans_i[i];
79
+ for (genvar i = 0 ; i < NoBus; i++ ) begin : gen_id_prepend
80
+ if (PreIdWidth == 0 ) begin : gen_no_prepend
81
+ assign mst_aw_chans_o[i] = slv_aw_chans_i[i];
82
+ assign mst_ar_chans_o[i] = slv_ar_chans_i[i];
83
+ end else begin : gen_prepend
84
+ always_comb begin
85
+ mst_aw_chans_o[i] = slv_aw_chans_i[i];
86
+ mst_ar_chans_o[i] = slv_ar_chans_i[i];
87
+ mst_aw_chans_o[i].id = { pre_id_i, slv_aw_chans_i[i].id[AxiIdWidthSlvPort- 1 : 0 ]} ;
88
+ mst_ar_chans_o[i].id = { pre_id_i, slv_ar_chans_i[i].id[AxiIdWidthSlvPort- 1 : 0 ]} ;
89
+ end
89
90
end
91
+ // The ID is in the highest bits of the struct, so an assignment from a channel with a wide ID
92
+ // to a channel with a shorter ID correctly cuts the prepended ID.
93
+ assign slv_b_chans_o[i] = mst_b_chans_i[i];
94
+ assign slv_r_chans_o[i] = mst_r_chans_i[i];
90
95
end
91
96
92
97
// assign the handshaking's and w channel
0 commit comments