Add files using upload-large-folder tool
Browse files- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_mesh_router.sv +211 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_mesh_router_buffered.sv +201 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_mesh_router_decoder_dor.sv +291 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_mesh_stitch.sv +67 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_mesh_to_ring_stitch.sv +0 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_noc_repeater_node.sv +74 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_wormhole_concentrator.sv +121 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_wormhole_router.sv +268 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_wormhole_router.svh +46 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_wormhole_router_adapter_in.sv +75 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_wormhole_router_adapter_out.sv +95 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_wormhole_router_output_control.sv +67 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_wormhole_router_pkg.sv +145 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_tag/README +7 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_tag/bsg_tag.svh +59 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_tag/bsg_tag_bitbang.sv +75 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_tag/bsg_tag_client_unsync.sv +109 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_tag/bsg_tag_master.sv +260 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_tag/bsg_tag_master_decentralized.sv +276 -0
- snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_tag/bsg_tag_pkg.sv +15 -0
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_mesh_router.sv
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* bsg_mesh_router.sv
|
| 3 |
+
*
|
| 4 |
+
*
|
| 5 |
+
* dims_p network
|
| 6 |
+
* ------------------------
|
| 7 |
+
* 1 1-D mesh
|
| 8 |
+
* 2 2-D mesh
|
| 9 |
+
* 3 2-D mesh + half ruche x
|
| 10 |
+
* 4 2-D mesh + full ruche
|
| 11 |
+
*
|
| 12 |
+
* ruche_factor_X/Y_p determines the number of hops that ruche links extend in the direction.
|
| 13 |
+
*
|
| 14 |
+
* Currently only tested for
|
| 15 |
+
* - 2-D mesh
|
| 16 |
+
* - 2-D mesh + half ruche x
|
| 17 |
+
*
|
| 18 |
+
* In theory, we could drop data bits (e.g. the X coordinate) as we switch to different dimensions, but the code would be a little complicated.
|
| 19 |
+
*/
|
| 20 |
+
|
| 21 |
+
`include "bsg_defines.sv"
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
module bsg_mesh_router
|
| 25 |
+
import bsg_noc_pkg::*;
|
| 26 |
+
import bsg_mesh_router_pkg::*;
|
| 27 |
+
#(parameter `BSG_INV_PARAM(width_p )
|
| 28 |
+
, parameter `BSG_INV_PARAM(x_cord_width_p )
|
| 29 |
+
, parameter `BSG_INV_PARAM(y_cord_width_p )
|
| 30 |
+
, parameter ruche_factor_X_p = 0
|
| 31 |
+
, parameter ruche_factor_Y_p = 0
|
| 32 |
+
, parameter dims_p = 2
|
| 33 |
+
, parameter dirs_lp = (2*dims_p)+1
|
| 34 |
+
, parameter XY_order_p = 1
|
| 35 |
+
, parameter depopulated_p = 1
|
| 36 |
+
, parameter bit [dirs_lp-1:0][dirs_lp-1:0] routing_matrix_p =
|
| 37 |
+
(dims_p == 2) ? (XY_order_p ? StrictXY : StrictYX) : (
|
| 38 |
+
(dims_p == 3) ? (depopulated_p ? (XY_order_p ? HalfRucheX_StrictXY : HalfRucheX_StrictYX)
|
| 39 |
+
: (XY_order_p ? HalfRucheX_FullyPopulated_StrictXY : HalfRucheX_FullyPopulated_StrictYX)) : (
|
| 40 |
+
(dims_p == 4) ? (depopulated_p ? (XY_order_p ? FullRuche_StrictXY : FullRuche_StrictYX)
|
| 41 |
+
: (XY_order_p ? FullRuche_FullyPopulated_StrictXY : FullRuche_FullyPopulated_StrictYX))
|
| 42 |
+
: "inv"))
|
| 43 |
+
|
| 44 |
+
, parameter debug_p = 0
|
| 45 |
+
)
|
| 46 |
+
(
|
| 47 |
+
input clk_i
|
| 48 |
+
, input reset_i
|
| 49 |
+
|
| 50 |
+
, input [dirs_lp-1:0][width_p-1:0] data_i
|
| 51 |
+
, input [dirs_lp-1:0] v_i
|
| 52 |
+
, output logic [dirs_lp-1:0] yumi_o
|
| 53 |
+
|
| 54 |
+
, input [dirs_lp-1:0] ready_and_i
|
| 55 |
+
, output [dirs_lp-1:0][width_p-1:0] data_o
|
| 56 |
+
, output logic [dirs_lp-1:0] v_o
|
| 57 |
+
|
| 58 |
+
// node's x and y coord
|
| 59 |
+
, input [x_cord_width_p-1:0] my_x_i
|
| 60 |
+
, input [y_cord_width_p-1:0] my_y_i
|
| 61 |
+
);
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
// input x,y coords
|
| 65 |
+
logic [dirs_lp-1:0][x_cord_width_p-1:0] x_dirs;
|
| 66 |
+
logic [dirs_lp-1:0][y_cord_width_p-1:0] y_dirs;
|
| 67 |
+
|
| 68 |
+
for (genvar i = 0; i < dirs_lp; i++) begin
|
| 69 |
+
assign x_dirs[i] = data_i[i][0+:x_cord_width_p];
|
| 70 |
+
assign y_dirs[i] = data_i[i][x_cord_width_p+:y_cord_width_p];
|
| 71 |
+
end
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
// dimension-ordered routing logic
|
| 75 |
+
logic [dirs_lp-1:0][dirs_lp-1:0] req, req_t;
|
| 76 |
+
|
| 77 |
+
for (genvar i = 0; i < dirs_lp; i++) begin: dor
|
| 78 |
+
logic [dirs_lp-1:0] temp_req;
|
| 79 |
+
|
| 80 |
+
bsg_mesh_router_decoder_dor #(
|
| 81 |
+
.x_cord_width_p(x_cord_width_p)
|
| 82 |
+
,.y_cord_width_p(y_cord_width_p)
|
| 83 |
+
,.ruche_factor_X_p(ruche_factor_X_p)
|
| 84 |
+
,.ruche_factor_Y_p(ruche_factor_Y_p)
|
| 85 |
+
,.dims_p(dims_p)
|
| 86 |
+
,.XY_order_p(XY_order_p)
|
| 87 |
+
,.from_p((dirs_lp)'(1 << i))
|
| 88 |
+
,.depopulated_p(depopulated_p)
|
| 89 |
+
,.debug_p(debug_p)
|
| 90 |
+
) dor_decoder (
|
| 91 |
+
.clk_i(clk_i)
|
| 92 |
+
,.reset_i(reset_i)
|
| 93 |
+
,.x_dirs_i(x_dirs[i])
|
| 94 |
+
,.y_dirs_i(y_dirs[i])
|
| 95 |
+
,.my_x_i(my_x_i)
|
| 96 |
+
,.my_y_i(my_y_i)
|
| 97 |
+
|
| 98 |
+
,.req_o(temp_req)
|
| 99 |
+
);
|
| 100 |
+
|
| 101 |
+
assign req[i] = {dirs_lp{v_i[i]}} & temp_req;
|
| 102 |
+
end
|
| 103 |
+
|
| 104 |
+
bsg_transpose #(
|
| 105 |
+
.width_p(dirs_lp)
|
| 106 |
+
,.els_p(dirs_lp)
|
| 107 |
+
) req_tp (
|
| 108 |
+
.i(req)
|
| 109 |
+
,.o(req_t)
|
| 110 |
+
);
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
// Instantiate crossbars for each output direction
|
| 115 |
+
logic [dirs_lp-1:0][dirs_lp-1:0] yumi_lo, yumi_lo_t;
|
| 116 |
+
|
| 117 |
+
for (genvar i = 0; i < dirs_lp; i++) begin: xbar
|
| 118 |
+
|
| 119 |
+
localparam input_els_lp = `BSG_COUNTONES_SYNTH(routing_matrix_p[i]);
|
| 120 |
+
|
| 121 |
+
logic [input_els_lp-1:0][width_p-1:0] conc_data;
|
| 122 |
+
logic [input_els_lp-1:0] conc_req;
|
| 123 |
+
logic [input_els_lp-1:0] grants;
|
| 124 |
+
|
| 125 |
+
bsg_array_concentrate_static #(
|
| 126 |
+
.pattern_els_p(routing_matrix_p[i])
|
| 127 |
+
,.width_p(width_p)
|
| 128 |
+
) conc0 (
|
| 129 |
+
.i(data_i)
|
| 130 |
+
,.o(conc_data)
|
| 131 |
+
);
|
| 132 |
+
|
| 133 |
+
bsg_concentrate_static #(
|
| 134 |
+
.pattern_els_p(routing_matrix_p[i])
|
| 135 |
+
) conc1 (
|
| 136 |
+
.i(req_t[i])
|
| 137 |
+
,.o(conc_req)
|
| 138 |
+
);
|
| 139 |
+
|
| 140 |
+
assign v_o[i] = |conc_req;
|
| 141 |
+
|
| 142 |
+
bsg_arb_round_robin #(
|
| 143 |
+
.width_p(input_els_lp)
|
| 144 |
+
) rr (
|
| 145 |
+
.clk_i(clk_i)
|
| 146 |
+
,.reset_i(reset_i)
|
| 147 |
+
|
| 148 |
+
,.reqs_i(conc_req)
|
| 149 |
+
,.grants_o(grants)
|
| 150 |
+
,.yumi_i(v_o[i] & ready_and_i[i])
|
| 151 |
+
);
|
| 152 |
+
|
| 153 |
+
bsg_mux_one_hot #(
|
| 154 |
+
.els_p(input_els_lp)
|
| 155 |
+
,.width_p(width_p)
|
| 156 |
+
) data_mux (
|
| 157 |
+
.data_i(conc_data)
|
| 158 |
+
,.sel_one_hot_i(grants)
|
| 159 |
+
,.data_o(data_o[i])
|
| 160 |
+
);
|
| 161 |
+
|
| 162 |
+
bsg_unconcentrate_static #(
|
| 163 |
+
.pattern_els_p(routing_matrix_p[i])
|
| 164 |
+
,.unconnected_val_p(1'b0)
|
| 165 |
+
) unconc0 (
|
| 166 |
+
.i(grants & {input_els_lp{ready_and_i[i]}})
|
| 167 |
+
,.o(yumi_lo[i])
|
| 168 |
+
);
|
| 169 |
+
|
| 170 |
+
end
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
bsg_transpose #(
|
| 174 |
+
.width_p(dirs_lp)
|
| 175 |
+
,.els_p(dirs_lp)
|
| 176 |
+
) yumi_tp (
|
| 177 |
+
.i(yumi_lo)
|
| 178 |
+
,.o(yumi_lo_t)
|
| 179 |
+
);
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
for (genvar i = 0; i < dirs_lp; i++) begin
|
| 183 |
+
assign yumi_o[i] = |yumi_lo_t[i];
|
| 184 |
+
end
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 189 |
+
if (debug_p) begin
|
| 190 |
+
always_ff @ (negedge clk_i) begin
|
| 191 |
+
|
| 192 |
+
if (~reset_i) begin
|
| 193 |
+
for (integer i = 0; i < dirs_lp; i++) begin
|
| 194 |
+
assert($countones(yumi_lo_t[i]) < 2)
|
| 195 |
+
else $error("multiple yumi detected. i=%d, %b", i, yumi_lo_t[i]);
|
| 196 |
+
end
|
| 197 |
+
end
|
| 198 |
+
|
| 199 |
+
end
|
| 200 |
+
end
|
| 201 |
+
`endif
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
endmodule
|
| 210 |
+
|
| 211 |
+
`BSG_ABSTRACT_MODULE(bsg_mesh_router)
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_mesh_router_buffered.sv
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* bsg_mesh_router_buffered.sv
|
| 3 |
+
*
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
`include "bsg_defines.sv"
|
| 8 |
+
`include "bsg_noc_links.svh"
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
module bsg_mesh_router_buffered
|
| 12 |
+
import bsg_mesh_router_pkg::*;
|
| 13 |
+
#(parameter `BSG_INV_PARAM(width_p )
|
| 14 |
+
, parameter `BSG_INV_PARAM(x_cord_width_p )
|
| 15 |
+
, parameter `BSG_INV_PARAM(y_cord_width_p )
|
| 16 |
+
, parameter debug_p = 0
|
| 17 |
+
, parameter ruche_factor_X_p = 0
|
| 18 |
+
, parameter ruche_factor_Y_p = 0
|
| 19 |
+
, parameter dims_p = 2
|
| 20 |
+
, parameter dirs_lp = (2*dims_p)+1
|
| 21 |
+
, parameter stub_p = { dirs_lp {1'b0}} // SNEWP
|
| 22 |
+
, parameter XY_order_p = 1
|
| 23 |
+
, parameter depopulated_p = 1
|
| 24 |
+
, parameter bsg_ready_and_link_sif_width_lp=`bsg_ready_and_link_sif_width(width_p)
|
| 25 |
+
// select whether to buffer the output
|
| 26 |
+
, parameter repeater_output_p = { dirs_lp {1'b0}} // SNEWP
|
| 27 |
+
// credit interface
|
| 28 |
+
, parameter use_credits_p = {dirs_lp{1'b0}}
|
| 29 |
+
, parameter int fifo_els_p[dirs_lp-1:0] = '{2,2,2,2,2}
|
| 30 |
+
)
|
| 31 |
+
(
|
| 32 |
+
input clk_i
|
| 33 |
+
, input reset_i
|
| 34 |
+
|
| 35 |
+
, input [dirs_lp-1:0][bsg_ready_and_link_sif_width_lp-1:0] link_i
|
| 36 |
+
, output [dirs_lp-1:0][bsg_ready_and_link_sif_width_lp-1:0] link_o
|
| 37 |
+
|
| 38 |
+
, input [x_cord_width_p-1:0] my_x_i
|
| 39 |
+
, input [y_cord_width_p-1:0] my_y_i
|
| 40 |
+
);
|
| 41 |
+
|
| 42 |
+
`declare_bsg_ready_and_link_sif_s(width_p,bsg_ready_and_link_sif_s);
|
| 43 |
+
|
| 44 |
+
bsg_ready_and_link_sif_s [dirs_lp-1:0] link_i_cast, link_o_cast;
|
| 45 |
+
|
| 46 |
+
assign link_i_cast =link_i;
|
| 47 |
+
assign link_o = link_o_cast;
|
| 48 |
+
|
| 49 |
+
logic [dirs_lp-1:0] fifo_valid;
|
| 50 |
+
logic [dirs_lp-1:0][width_p-1:0] fifo_data;
|
| 51 |
+
logic [dirs_lp-1:0] fifo_yumi;
|
| 52 |
+
|
| 53 |
+
genvar i;
|
| 54 |
+
|
| 55 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 56 |
+
if (debug_p)
|
| 57 |
+
for (i = 0; i < dirs_lp;i=i+1)
|
| 58 |
+
begin
|
| 59 |
+
always_ff @(negedge clk_i)
|
| 60 |
+
$display("%m x=%d y=%d SNEWP[%d] v_i=%b ready_o=%b v_o=%b ready_i=%b %b"
|
| 61 |
+
,my_x_i,my_y_i,i,link_i_cast[i].v,link_o_cast[i].ready_and_rev,
|
| 62 |
+
link_o_cast[i].v,link_i_cast[i].ready_and_rev,link_i[i]);
|
| 63 |
+
end
|
| 64 |
+
`endif
|
| 65 |
+
|
| 66 |
+
for (i = 0; i < dirs_lp; i=i+1) begin: rof
|
| 67 |
+
if (stub_p[i]) begin: fi
|
| 68 |
+
assign fifo_data [i] = width_p ' (0);
|
| 69 |
+
assign fifo_valid [i] = 1'b0;
|
| 70 |
+
|
| 71 |
+
// accept no data from outside of stubbed port
|
| 72 |
+
assign link_o_cast[i].ready_and_rev = 1'b0;
|
| 73 |
+
|
| 74 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 75 |
+
always @(negedge clk_i)
|
| 76 |
+
assert (reset_i !== '0 || ~link_o_cast[i].v) else
|
| 77 |
+
$warning("## stubbed port %x received word %x",i,link_i_cast[i].data);
|
| 78 |
+
`endif
|
| 79 |
+
end
|
| 80 |
+
else begin: fi
|
| 81 |
+
logic fifo_ready_lo;
|
| 82 |
+
|
| 83 |
+
bsg_fifo_1r1w_small #(
|
| 84 |
+
.width_p(width_p)
|
| 85 |
+
,.els_p(fifo_els_p[i])
|
| 86 |
+
) fifo (
|
| 87 |
+
.clk_i(clk_i)
|
| 88 |
+
,.reset_i(reset_i)
|
| 89 |
+
|
| 90 |
+
,.v_i (link_i_cast[i].v )
|
| 91 |
+
,.data_i (link_i_cast[i].data )
|
| 92 |
+
,.ready_param_o (fifo_ready_lo)
|
| 93 |
+
|
| 94 |
+
,.v_o (fifo_valid[i])
|
| 95 |
+
,.data_o (fifo_data [i])
|
| 96 |
+
,.yumi_i (fifo_yumi [i])
|
| 97 |
+
);
|
| 98 |
+
|
| 99 |
+
if (use_credits_p[i]) begin: cr
|
| 100 |
+
bsg_dff_reset #(
|
| 101 |
+
.width_p(1)
|
| 102 |
+
,.reset_val_p(0)
|
| 103 |
+
) dff0 (
|
| 104 |
+
.clk_i(clk_i)
|
| 105 |
+
,.reset_i(reset_i)
|
| 106 |
+
,.data_i(fifo_yumi[i])
|
| 107 |
+
,.data_o(link_o_cast[i].ready_and_rev)
|
| 108 |
+
);
|
| 109 |
+
|
| 110 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 111 |
+
always_ff @ (negedge clk_i) begin
|
| 112 |
+
if (~reset_i) begin
|
| 113 |
+
if (link_i_cast[i].v) begin
|
| 114 |
+
assert(fifo_ready_lo)
|
| 115 |
+
else $error("Trying to enque when there is no space in FIFO, while using credit interface. i =%d", i);
|
| 116 |
+
end
|
| 117 |
+
end
|
| 118 |
+
end
|
| 119 |
+
`endif
|
| 120 |
+
|
| 121 |
+
end
|
| 122 |
+
else begin
|
| 123 |
+
assign link_o_cast[i].ready_and_rev = fifo_ready_lo;
|
| 124 |
+
end
|
| 125 |
+
|
| 126 |
+
end
|
| 127 |
+
end
|
| 128 |
+
|
| 129 |
+
// router does not have symmetric interfaces;
|
| 130 |
+
// so we do not use bsg_ready_and_link_sif
|
| 131 |
+
// and manually convert. support for arrays
|
| 132 |
+
// of interfaces in systemverilog would
|
| 133 |
+
// fix this.
|
| 134 |
+
|
| 135 |
+
logic [dirs_lp-1:0] valid_lo;
|
| 136 |
+
logic [dirs_lp-1:0][width_p-1:0] data_lo;
|
| 137 |
+
logic [dirs_lp-1:0] ready_li;
|
| 138 |
+
|
| 139 |
+
for (i = 0; i < dirs_lp; i=i+1)
|
| 140 |
+
begin: rof2
|
| 141 |
+
assign link_o_cast[i].v = valid_lo[i];
|
| 142 |
+
|
| 143 |
+
if (repeater_output_p[i] & ~stub_p[i])
|
| 144 |
+
begin : macro
|
| 145 |
+
wire [width_p-1:0] tmp;
|
| 146 |
+
|
| 147 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 148 |
+
initial
|
| 149 |
+
begin
|
| 150 |
+
$display("%m with buffers on %d",i);
|
| 151 |
+
end
|
| 152 |
+
`endif
|
| 153 |
+
bsg_inv #(.width_p(width_p),.vertical_p(i < 3)) data_lo_inv
|
| 154 |
+
(.i (data_lo[i] )
|
| 155 |
+
,.o(tmp)
|
| 156 |
+
);
|
| 157 |
+
|
| 158 |
+
bsg_inv #(.width_p(width_p),.vertical_p(i < 3)) data_lo_rep
|
| 159 |
+
(.i (tmp)
|
| 160 |
+
,.o(link_o_cast[i].data)
|
| 161 |
+
);
|
| 162 |
+
|
| 163 |
+
end
|
| 164 |
+
else
|
| 165 |
+
assign link_o_cast[i].data = data_lo [i];
|
| 166 |
+
|
| 167 |
+
assign ready_li[i] = link_i_cast[i].ready_and_rev;
|
| 168 |
+
end
|
| 169 |
+
|
| 170 |
+
bsg_mesh_router #( .width_p (width_p )
|
| 171 |
+
,.x_cord_width_p(x_cord_width_p)
|
| 172 |
+
,.y_cord_width_p(y_cord_width_p)
|
| 173 |
+
,.ruche_factor_X_p(ruche_factor_X_p)
|
| 174 |
+
,.ruche_factor_Y_p(ruche_factor_Y_p)
|
| 175 |
+
,.dims_p (dims_p)
|
| 176 |
+
,.XY_order_p (XY_order_p )
|
| 177 |
+
,.depopulated_p (depopulated_p )
|
| 178 |
+
) bmr
|
| 179 |
+
(.clk_i
|
| 180 |
+
,.reset_i
|
| 181 |
+
,.v_i (fifo_valid)
|
| 182 |
+
,.data_i (fifo_data )
|
| 183 |
+
,.yumi_o (fifo_yumi )
|
| 184 |
+
|
| 185 |
+
,.v_o (valid_lo)
|
| 186 |
+
,.data_o(data_lo)
|
| 187 |
+
|
| 188 |
+
// this will be hardwired to 1 by inside of this module
|
| 189 |
+
// if port is stubbed
|
| 190 |
+
|
| 191 |
+
,.ready_and_i(ready_li)
|
| 192 |
+
|
| 193 |
+
,.my_x_i
|
| 194 |
+
,.my_y_i
|
| 195 |
+
);
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
endmodule
|
| 199 |
+
|
| 200 |
+
`BSG_ABSTRACT_MODULE(bsg_mesh_router_buffered)
|
| 201 |
+
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_mesh_router_decoder_dor.sv
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* bsg_mesh_router_decoder_dor.sv
|
| 3 |
+
*
|
| 4 |
+
* Dimension ordered routing decoder
|
| 5 |
+
*
|
| 6 |
+
* depopulated ruche router.
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
`include "bsg_defines.sv"
|
| 10 |
+
|
| 11 |
+
module bsg_mesh_router_decoder_dor
|
| 12 |
+
import bsg_noc_pkg::*;
|
| 13 |
+
import bsg_mesh_router_pkg::*;
|
| 14 |
+
#(parameter `BSG_INV_PARAM(x_cord_width_p )
|
| 15 |
+
, parameter `BSG_INV_PARAM(y_cord_width_p )
|
| 16 |
+
, parameter dims_p = 2
|
| 17 |
+
, parameter dirs_lp = (2*dims_p)+1
|
| 18 |
+
, parameter ruche_factor_X_p=0
|
| 19 |
+
, parameter ruche_factor_Y_p=0
|
| 20 |
+
// XY_order_p = 1 : X then Y
|
| 21 |
+
// XY_order_p = 0 : Y then X
|
| 22 |
+
, parameter XY_order_p = 1
|
| 23 |
+
, parameter depopulated_p = 1
|
| 24 |
+
, parameter from_p = {dirs_lp{1'b0}} // one-hot, indicates which direction is the input coming from.
|
| 25 |
+
|
| 26 |
+
, parameter debug_p = 1
|
| 27 |
+
)
|
| 28 |
+
(
|
| 29 |
+
input clk_i // debug only
|
| 30 |
+
, input reset_i // debug only
|
| 31 |
+
|
| 32 |
+
//, input v_i
|
| 33 |
+
|
| 34 |
+
, input [x_cord_width_p-1:0] x_dirs_i
|
| 35 |
+
, input [y_cord_width_p-1:0] y_dirs_i
|
| 36 |
+
|
| 37 |
+
, input [x_cord_width_p-1:0] my_x_i
|
| 38 |
+
, input [y_cord_width_p-1:0] my_y_i
|
| 39 |
+
|
| 40 |
+
, output [dirs_lp-1:0] req_o
|
| 41 |
+
);
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
// check parameters
|
| 45 |
+
|
| 46 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 47 |
+
initial begin
|
| 48 |
+
if (ruche_factor_X_p > 0) begin
|
| 49 |
+
assert(dims_p > 2) else $fatal(1, "ruche in X direction requires dims_p greater than 2.");
|
| 50 |
+
end
|
| 51 |
+
|
| 52 |
+
if (ruche_factor_Y_p > 0) begin
|
| 53 |
+
assert(dims_p > 3) else $fatal(1, "ruche in Y direction requires dims_p greater than 3.");
|
| 54 |
+
end
|
| 55 |
+
|
| 56 |
+
assert($countones(from_p) == 1) else $fatal(1, "Must define from_p as one-hot value.");
|
| 57 |
+
|
| 58 |
+
assert(ruche_factor_X_p < (1<<x_cord_width_p)) else $fatal(1, "ruche factor in X direction is too large");
|
| 59 |
+
assert(ruche_factor_Y_p < (1<<y_cord_width_p)) else $fatal(1, "ruche factor in Y direction is too large");
|
| 60 |
+
end
|
| 61 |
+
`endif
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
// compare coordinates
|
| 67 |
+
wire x_eq = (x_dirs_i == my_x_i);
|
| 68 |
+
wire y_eq = (y_dirs_i == my_y_i);
|
| 69 |
+
wire x_gt = x_dirs_i > my_x_i;
|
| 70 |
+
wire y_gt = y_dirs_i > my_y_i;
|
| 71 |
+
wire x_lt = ~x_gt & ~x_eq;
|
| 72 |
+
wire y_lt = ~y_gt & ~y_eq;
|
| 73 |
+
|
| 74 |
+
// valid signal
|
| 75 |
+
logic [dirs_lp-1:0] req;
|
| 76 |
+
assign req_o = req;
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
// P-port
|
| 80 |
+
assign req[P] = x_eq & y_eq;
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
if (ruche_factor_X_p > 0) begin
|
| 84 |
+
|
| 85 |
+
if (XY_order_p) begin
|
| 86 |
+
// make sure there is no under/overflow.
|
| 87 |
+
wire [x_cord_width_p:0] re_cord = (x_cord_width_p+1)'(my_x_i + ruche_factor_X_p);
|
| 88 |
+
wire send_rw, send_re;
|
| 89 |
+
|
| 90 |
+
if (depopulated_p) begin
|
| 91 |
+
assign send_rw = (my_x_i > (x_cord_width_p)'(ruche_factor_X_p)) && (x_dirs_i < (my_x_i - (x_cord_width_p)'(ruche_factor_X_p)));
|
| 92 |
+
assign send_re = !re_cord[x_cord_width_p] && (x_dirs_i > re_cord[0+:x_cord_width_p]);
|
| 93 |
+
end
|
| 94 |
+
else begin
|
| 95 |
+
assign send_rw = (my_x_i >= (x_cord_width_p)'(ruche_factor_X_p)) && (x_dirs_i <= (my_x_i - (x_cord_width_p)'(ruche_factor_X_p)));
|
| 96 |
+
assign send_re = !re_cord[x_cord_width_p] && (x_dirs_i >= re_cord[0+:x_cord_width_p]); // check no overflow
|
| 97 |
+
end
|
| 98 |
+
|
| 99 |
+
assign req[W] = x_lt & ~send_rw;
|
| 100 |
+
assign req[RW] = send_rw;
|
| 101 |
+
assign req[E] = x_gt & ~send_re;
|
| 102 |
+
assign req[RE] = send_re;
|
| 103 |
+
end
|
| 104 |
+
else begin
|
| 105 |
+
|
| 106 |
+
wire [x_cord_width_p-1:0] dxp = (x_cord_width_p)'((x_dirs_i - my_x_i) % ruche_factor_X_p);
|
| 107 |
+
wire [x_cord_width_p-1:0] dxn = (x_cord_width_p)'((my_x_i - x_dirs_i) % ruche_factor_X_p);
|
| 108 |
+
|
| 109 |
+
if (from_p[S] | from_p[N] | from_p[P]) begin
|
| 110 |
+
if (depopulated_p) begin
|
| 111 |
+
assign req[W] = y_eq & x_lt;
|
| 112 |
+
assign req[RW] = 1'b0;
|
| 113 |
+
assign req[E] = y_eq & x_gt;
|
| 114 |
+
assign req[RE] = 1'b0;
|
| 115 |
+
end
|
| 116 |
+
else begin
|
| 117 |
+
assign req[W] = y_eq & x_lt & (dxn != '0);
|
| 118 |
+
assign req[RW] = y_eq & x_lt & (dxn == '0);
|
| 119 |
+
assign req[E] = y_eq & x_gt & (dxp != '0);
|
| 120 |
+
assign req[RE] = y_eq & x_gt & (dxp == '0);
|
| 121 |
+
end
|
| 122 |
+
end
|
| 123 |
+
else if(from_p[W]) begin
|
| 124 |
+
assign req[RE] = y_eq & x_gt & (dxp == '0);
|
| 125 |
+
assign req[E] = y_eq & x_gt & (dxp != '0);
|
| 126 |
+
assign req[RW] = 1'b0;
|
| 127 |
+
assign req[W] = 1'b0;
|
| 128 |
+
end
|
| 129 |
+
else if (from_p[E]) begin
|
| 130 |
+
assign req[RE] = 1'b0;
|
| 131 |
+
assign req[E] = 1'b0;
|
| 132 |
+
assign req[RW] = y_eq & x_lt & (dxn == '0);
|
| 133 |
+
assign req[W] = y_eq & x_lt & (dxn != '0);
|
| 134 |
+
end
|
| 135 |
+
else if (from_p[RW]) begin
|
| 136 |
+
assign req[RE] = y_eq & x_gt;
|
| 137 |
+
assign req[E] = 1'b0;
|
| 138 |
+
assign req[RW] = 1'b0;
|
| 139 |
+
assign req[W] = 1'b0;
|
| 140 |
+
end
|
| 141 |
+
else if (from_p[RE]) begin
|
| 142 |
+
assign req[RE] = 1'b0;
|
| 143 |
+
assign req[E] = 1'b0;
|
| 144 |
+
assign req[RW] = y_eq & x_lt;
|
| 145 |
+
assign req[W] = 1'b0;
|
| 146 |
+
end
|
| 147 |
+
else if (from_p[RN] | from_p[RS]) begin
|
| 148 |
+
if (depopulated_p) begin
|
| 149 |
+
// If depopulated, there wouldn't be these paths.
|
| 150 |
+
assign req[RE] = 1'b0;
|
| 151 |
+
assign req[E] = 1'b0;
|
| 152 |
+
assign req[RW] = 1'b0;
|
| 153 |
+
assign req[W] = 1'b0;
|
| 154 |
+
end
|
| 155 |
+
else begin
|
| 156 |
+
assign req[W] = y_eq & x_lt & (dxn != '0);
|
| 157 |
+
assign req[RW] = y_eq & x_lt & (dxn == '0);
|
| 158 |
+
assign req[E] = y_eq & x_gt & (dxp != '0);
|
| 159 |
+
assign req[RE] = y_eq & x_gt & (dxp == '0);
|
| 160 |
+
end
|
| 161 |
+
end
|
| 162 |
+
end
|
| 163 |
+
end
|
| 164 |
+
else begin
|
| 165 |
+
if (XY_order_p) begin
|
| 166 |
+
assign req[W] = x_lt;
|
| 167 |
+
assign req[E] = x_gt;
|
| 168 |
+
end
|
| 169 |
+
else begin
|
| 170 |
+
assign req[W] = y_eq & x_lt;
|
| 171 |
+
assign req[E] = y_eq & x_gt;
|
| 172 |
+
end
|
| 173 |
+
end
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
if (ruche_factor_Y_p > 0) begin
|
| 178 |
+
if (XY_order_p == 0) begin
|
| 179 |
+
// make sure there is no under/overflow.
|
| 180 |
+
wire [y_cord_width_p:0] rs_cord = (y_cord_width_p+1)'(my_y_i + ruche_factor_Y_p);
|
| 181 |
+
wire send_rn, send_rs;
|
| 182 |
+
|
| 183 |
+
if (depopulated_p) begin
|
| 184 |
+
assign send_rn = (my_y_i > (y_cord_width_p)'(ruche_factor_Y_p)) && (y_dirs_i < (my_y_i - (y_cord_width_p)'(ruche_factor_Y_p)));
|
| 185 |
+
assign send_rs = !rs_cord[y_cord_width_p] && (y_dirs_i > rs_cord[0+:y_cord_width_p]);
|
| 186 |
+
end
|
| 187 |
+
else begin
|
| 188 |
+
assign send_rn = (my_y_i >= (y_cord_width_p)'(ruche_factor_Y_p)) && (y_dirs_i <= (my_y_i - (y_cord_width_p)'(ruche_factor_Y_p)));
|
| 189 |
+
assign send_rs = !rs_cord[y_cord_width_p] && (y_dirs_i >= rs_cord[0+:y_cord_width_p]);
|
| 190 |
+
end
|
| 191 |
+
|
| 192 |
+
assign req[N] = y_lt & ~send_rn;
|
| 193 |
+
assign req[RN] = send_rn;
|
| 194 |
+
assign req[S] = y_gt & ~send_rs;
|
| 195 |
+
assign req[RS] = send_rs;
|
| 196 |
+
end
|
| 197 |
+
else begin
|
| 198 |
+
|
| 199 |
+
wire [y_cord_width_p-1:0] dyp = (y_cord_width_p)'((y_dirs_i - my_y_i) % ruche_factor_Y_p);
|
| 200 |
+
wire [y_cord_width_p-1:0] dyn = (y_cord_width_p)'((my_y_i - y_dirs_i) % ruche_factor_Y_p);
|
| 201 |
+
|
| 202 |
+
if (from_p[E] | from_p[W] | from_p[P]) begin
|
| 203 |
+
if (depopulated_p) begin
|
| 204 |
+
assign req[N] = x_eq & y_lt;
|
| 205 |
+
assign req[RN] = 1'b0;
|
| 206 |
+
assign req[S] = x_eq & y_gt;
|
| 207 |
+
assign req[RS] = 1'b0;
|
| 208 |
+
end
|
| 209 |
+
else begin
|
| 210 |
+
assign req[N] = x_eq & y_lt & (dyn != '0);
|
| 211 |
+
assign req[RN] = x_eq & y_lt & (dyn == '0);
|
| 212 |
+
assign req[S] = x_eq & y_gt & (dyp != '0);
|
| 213 |
+
assign req[RS] = x_eq & y_gt & (dyp == '0);
|
| 214 |
+
end
|
| 215 |
+
end
|
| 216 |
+
else if (from_p[N]) begin
|
| 217 |
+
assign req[RS] = x_eq & y_gt & (dyp == '0);
|
| 218 |
+
assign req[S] = x_eq & y_gt & (dyp != '0);
|
| 219 |
+
assign req[RN] = 1'b0;
|
| 220 |
+
assign req[N] = 1'b0;
|
| 221 |
+
end
|
| 222 |
+
else if (from_p[S]) begin
|
| 223 |
+
assign req[RS] = 1'b0;
|
| 224 |
+
assign req[S] = 1'b0;
|
| 225 |
+
assign req[RN] = x_eq & y_lt & (dyn == '0);
|
| 226 |
+
assign req[N] = x_eq & y_lt & (dyn != '0);
|
| 227 |
+
end
|
| 228 |
+
else if (from_p[RN]) begin
|
| 229 |
+
assign req[RS] = x_eq & y_gt;
|
| 230 |
+
assign req[S] = 1'b0;
|
| 231 |
+
assign req[RN] = 1'b0;
|
| 232 |
+
assign req[N] = 1'b0;
|
| 233 |
+
end
|
| 234 |
+
else if (from_p[RS]) begin
|
| 235 |
+
assign req[RS] = 1'b0;
|
| 236 |
+
assign req[S] = 1'b0;
|
| 237 |
+
assign req[RN] = x_eq & y_lt;
|
| 238 |
+
assign req[N] = 1'b0;
|
| 239 |
+
end
|
| 240 |
+
else if (from_p[RW] | from_p[RE]) begin
|
| 241 |
+
if (depopulated_p) begin
|
| 242 |
+
// If depopulated, there wouldn't be these paths.
|
| 243 |
+
assign req[RS] = 1'b0;
|
| 244 |
+
assign req[S] = 1'b0;
|
| 245 |
+
assign req[RN] = 1'b0;
|
| 246 |
+
assign req[N] = 1'b0;
|
| 247 |
+
end
|
| 248 |
+
else begin
|
| 249 |
+
assign req[N] = x_eq & y_lt & (dyn != '0);
|
| 250 |
+
assign req[RN] = x_eq & y_lt & (dyn == '0);
|
| 251 |
+
assign req[S] = x_eq & y_gt & (dyp != '0);
|
| 252 |
+
assign req[RS] = x_eq & y_gt & (dyp == '0);
|
| 253 |
+
end
|
| 254 |
+
end
|
| 255 |
+
end
|
| 256 |
+
|
| 257 |
+
end
|
| 258 |
+
else begin
|
| 259 |
+
if (XY_order_p == 0) begin
|
| 260 |
+
assign req[N] = y_lt;
|
| 261 |
+
assign req[S] = y_gt;
|
| 262 |
+
end
|
| 263 |
+
else begin
|
| 264 |
+
assign req[N] = x_eq & y_lt;
|
| 265 |
+
assign req[S] = x_eq & y_gt;
|
| 266 |
+
end
|
| 267 |
+
end
|
| 268 |
+
|
| 269 |
+
|
| 270 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 271 |
+
if (debug_p) begin
|
| 272 |
+
always_ff @ (negedge clk_i) begin
|
| 273 |
+
if (~reset_i) begin
|
| 274 |
+
assert($countones(req_o) < 2)
|
| 275 |
+
else $fatal(1, "multiple req_o detected. %b", req_o);
|
| 276 |
+
end
|
| 277 |
+
end
|
| 278 |
+
end
|
| 279 |
+
else begin
|
| 280 |
+
wire unused0 = clk_i;
|
| 281 |
+
wire unused1 = reset_i;
|
| 282 |
+
end
|
| 283 |
+
`endif
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
endmodule
|
| 289 |
+
|
| 290 |
+
`BSG_ABSTRACT_MODULE(bsg_mesh_router_decoder_dor)
|
| 291 |
+
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_mesh_stitch.sv
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// bsg_mesh_stitch
|
| 2 |
+
//
|
| 3 |
+
// MBT 5-26-16
|
| 4 |
+
//
|
| 5 |
+
// stitches together wires according to a mesh topology; edges
|
| 6 |
+
// are returned in hor and ver arrays.
|
| 7 |
+
//
|
| 8 |
+
|
| 9 |
+
`include "bsg_defines.sv"
|
| 10 |
+
|
| 11 |
+
module bsg_mesh_stitch
|
| 12 |
+
import bsg_noc_pkg::*; // P=0, W, E, N, S
|
| 13 |
+
#(parameter `BSG_INV_PARAM(width_p ) // data width
|
| 14 |
+
, x_max_p = "inv"
|
| 15 |
+
, y_max_p = "inv"
|
| 16 |
+
, nets_p = 1 // optional parameter that allows for multiple networks to be routed together
|
| 17 |
+
)
|
| 18 |
+
(input [y_max_p-1:0][x_max_p-1:0][nets_p-1:0][S:W][width_p-1:0] outs_i // for each node, each direction
|
| 19 |
+
, output [y_max_p-1:0][x_max_p-1:0][nets_p-1:0][S:W][width_p-1:0] ins_o
|
| 20 |
+
|
| 21 |
+
// these are the edge of the greater tile
|
| 22 |
+
, input [E:W][y_max_p-1:0][nets_p-1:0][width_p-1:0] hor_i
|
| 23 |
+
, output [E:W][y_max_p-1:0][nets_p-1:0][width_p-1:0] hor_o
|
| 24 |
+
, input [S:N][x_max_p-1:0][nets_p-1:0][width_p-1:0] ver_i
|
| 25 |
+
, output [S:N][x_max_p-1:0][nets_p-1:0][width_p-1:0] ver_o
|
| 26 |
+
);
|
| 27 |
+
|
| 28 |
+
genvar r,c,net;
|
| 29 |
+
|
| 30 |
+
for (net = 0; net < nets_p; net=net+1)
|
| 31 |
+
begin: _n
|
| 32 |
+
|
| 33 |
+
for (r = 0; r < y_max_p; r=r+1)
|
| 34 |
+
begin: _r
|
| 35 |
+
assign hor_o[E][r][net] = outs_i[r][x_max_p-1][net][E];
|
| 36 |
+
assign hor_o[W][r][net] = outs_i[r][0 ][net][W];
|
| 37 |
+
|
| 38 |
+
for (c = 0; c < x_max_p; c=c+1)
|
| 39 |
+
begin: _c
|
| 40 |
+
assign ins_o[r][c][net][S] = (r == y_max_p-1)
|
| 41 |
+
? ver_i[S][c][net]
|
| 42 |
+
: outs_i[(r == y_max_p-1) ? r : r+1][c][net][N]; // ?: for warning
|
| 43 |
+
assign ins_o[r][c][net][N] = (r == 0)
|
| 44 |
+
? ver_i[N][c][net]
|
| 45 |
+
: outs_i[r ? r-1: 0][c][net][S]; // ?: to eliminate warning
|
| 46 |
+
assign ins_o[r][c][net][E] = (c == x_max_p-1)
|
| 47 |
+
? hor_i[E][r][net]
|
| 48 |
+
: outs_i[r][(c == x_max_p-1) ? c : (c+1)][net][W]; // ?: for warning
|
| 49 |
+
assign ins_o[r][c][net][W] = (c == 0)
|
| 50 |
+
? hor_i[W][r][net]
|
| 51 |
+
: outs_i[r][c ? (c-1) :0][net][E]; // ?: to eliminate warning
|
| 52 |
+
end // block: c
|
| 53 |
+
end // block: r
|
| 54 |
+
|
| 55 |
+
for (c = 0; c < x_max_p; c=c+1)
|
| 56 |
+
begin: _c
|
| 57 |
+
assign ver_o[S][c][net] = outs_i[y_max_p-1][c][net][S];
|
| 58 |
+
assign ver_o[N][c][net] = outs_i[0 ][c][net][N];
|
| 59 |
+
end
|
| 60 |
+
end // block: _n
|
| 61 |
+
|
| 62 |
+
endmodule
|
| 63 |
+
|
| 64 |
+
`BSG_ABSTRACT_MODULE(bsg_mesh_stitch)
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_mesh_to_ring_stitch.sv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_noc_repeater_node.sv
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// This module instantiates num_nodes_p two-element-fifos in chains
|
| 3 |
+
// It supports multiple bsg_noc_links in parallel
|
| 4 |
+
//
|
| 5 |
+
// Insert this module into long routings on chip, which can become critical path
|
| 6 |
+
//
|
| 7 |
+
// Node that side_A_reset_i signal shoule be close to side A
|
| 8 |
+
// If reset happens to be close to side B, please swap side A and side B connection,
|
| 9 |
+
// since side A and side B are symmetric, functionality will not be affected.
|
| 10 |
+
//
|
| 11 |
+
|
| 12 |
+
`include "bsg_defines.sv"
|
| 13 |
+
`include "bsg_noc_links.svh"
|
| 14 |
+
|
| 15 |
+
module bsg_noc_repeater_node
|
| 16 |
+
|
| 17 |
+
#(parameter `BSG_INV_PARAM(width_p )
|
| 18 |
+
, parameter bsg_ready_and_link_sif_width_lp = `bsg_ready_and_link_sif_width(width_p)
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
( input clk_i
|
| 22 |
+
, input reset_i
|
| 23 |
+
|
| 24 |
+
, input [bsg_ready_and_link_sif_width_lp-1:0] side_A_links_i
|
| 25 |
+
, output [bsg_ready_and_link_sif_width_lp-1:0] side_A_links_o
|
| 26 |
+
|
| 27 |
+
, input [bsg_ready_and_link_sif_width_lp-1:0] side_B_links_i
|
| 28 |
+
, output [bsg_ready_and_link_sif_width_lp-1:0] side_B_links_o
|
| 29 |
+
);
|
| 30 |
+
|
| 31 |
+
// declare the bsg_ready_and_link_sif_s struct
|
| 32 |
+
`declare_bsg_ready_and_link_sif_s(width_p, bsg_ready_and_link_sif_s);
|
| 33 |
+
|
| 34 |
+
// noc links
|
| 35 |
+
bsg_ready_and_link_sif_s links_A_cast_i, links_B_cast_i;
|
| 36 |
+
bsg_ready_and_link_sif_s links_A_cast_o, links_B_cast_o;
|
| 37 |
+
|
| 38 |
+
assign links_A_cast_i = side_A_links_i;
|
| 39 |
+
assign links_B_cast_i = side_B_links_i;
|
| 40 |
+
|
| 41 |
+
assign side_A_links_o = links_A_cast_o;
|
| 42 |
+
assign side_B_links_o = links_B_cast_o;
|
| 43 |
+
|
| 44 |
+
bsg_two_fifo #(.width_p(width_p))
|
| 45 |
+
A_to_B
|
| 46 |
+
(.clk_i ( clk_i )
|
| 47 |
+
,.reset_i ( reset_i )
|
| 48 |
+
|
| 49 |
+
,.v_i ( links_A_cast_i.v )
|
| 50 |
+
,.data_i ( links_A_cast_i.data )
|
| 51 |
+
,.ready_param_o ( links_A_cast_o.ready_and_rev )
|
| 52 |
+
|
| 53 |
+
,.v_o ( links_B_cast_o.v )
|
| 54 |
+
,.data_o ( links_B_cast_o.data )
|
| 55 |
+
,.yumi_i ( links_B_cast_i.ready_and_rev & links_B_cast_o.v )
|
| 56 |
+
);
|
| 57 |
+
|
| 58 |
+
bsg_two_fifo #(.width_p(width_p))
|
| 59 |
+
B_to_A
|
| 60 |
+
(.clk_i ( clk_i )
|
| 61 |
+
,.reset_i ( reset_i )
|
| 62 |
+
|
| 63 |
+
,.v_i ( links_B_cast_i.v )
|
| 64 |
+
,.data_i ( links_B_cast_i.data )
|
| 65 |
+
,.ready_param_o ( links_B_cast_o.ready_and_rev )
|
| 66 |
+
|
| 67 |
+
,.v_o ( links_A_cast_o.v )
|
| 68 |
+
,.data_o ( links_A_cast_o.data )
|
| 69 |
+
,.yumi_i ( links_A_cast_i.ready_and_rev & links_A_cast_o.v )
|
| 70 |
+
);
|
| 71 |
+
|
| 72 |
+
endmodule
|
| 73 |
+
|
| 74 |
+
`BSG_ABSTRACT_MODULE(bsg_noc_repeater_node)
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_wormhole_concentrator.sv
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// bsg_wormhole_concentrator.sv
|
| 3 |
+
//
|
| 4 |
+
// 08/2019
|
| 5 |
+
//
|
| 6 |
+
// This is an adapter between 1 concentrated wormhole link and N unconcentrated wormhole links.
|
| 7 |
+
// Extra bits (cid) are used in wormhole header to indicate wormhole packet destination.
|
| 8 |
+
//
|
| 9 |
+
// From implementation perspective this is a simplified version bsg_wormhole_router.
|
| 10 |
+
// Wormhole_router relies on 2D routing_matrix, while wormhole_concentrator has fixed 1-to-n
|
| 11 |
+
// and n-to-1 routing. This concentrator reuses most of the building blocks of wormhole_router,
|
| 12 |
+
// concentrator header struct is defined in bsg_wormhole_router.svh.
|
| 13 |
+
//
|
| 14 |
+
// This concentrator has 1-cycle delay from input wormhole link(s) to output wormhole link(s).
|
| 15 |
+
// It has zero bubble between wormhole packets.
|
| 16 |
+
//
|
| 17 |
+
//
|
| 18 |
+
|
| 19 |
+
`include "bsg_defines.sv"
|
| 20 |
+
`include "bsg_noc_links.svh"
|
| 21 |
+
`include "bsg_wormhole_router.svh"
|
| 22 |
+
|
| 23 |
+
module bsg_wormhole_concentrator
|
| 24 |
+
|
| 25 |
+
#(parameter `BSG_INV_PARAM(flit_width_p)
|
| 26 |
+
,parameter `BSG_INV_PARAM(len_width_p)
|
| 27 |
+
,parameter `BSG_INV_PARAM(cid_width_p)
|
| 28 |
+
,parameter `BSG_INV_PARAM(cord_width_p)
|
| 29 |
+
,parameter num_in_p = 1
|
| 30 |
+
,parameter debug_lp = 0
|
| 31 |
+
,parameter link_width_lp = `bsg_ready_and_link_sif_width(flit_width_p)
|
| 32 |
+
// Hold on valid sets the arbitration policy such that once an output tag is selected, it
|
| 33 |
+
// remains selected until it is acked, then the round-robin scheduler continues cycling
|
| 34 |
+
// from the selected tag. This is consistent with BaseJump STL handshake assumptions.
|
| 35 |
+
// Notably, this parameter is required to work with bsg_parallel_in_serial_out_passthrough.
|
| 36 |
+
// This policy has a slight throughput degradation but effectively arbitrates based on age,
|
| 37 |
+
// so minimizes worst case latency.
|
| 38 |
+
,parameter hold_on_valid_p = 0
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
(input clk_i
|
| 42 |
+
,input reset_i
|
| 43 |
+
|
| 44 |
+
// unconcentrated multiple links
|
| 45 |
+
,input [num_in_p-1:0][link_width_lp-1:0] links_i
|
| 46 |
+
,output [num_in_p-1:0][link_width_lp-1:0] links_o
|
| 47 |
+
|
| 48 |
+
// concentrated single link
|
| 49 |
+
,input [link_width_lp-1:0] concentrated_link_i
|
| 50 |
+
,output [link_width_lp-1:0] concentrated_link_o
|
| 51 |
+
);
|
| 52 |
+
|
| 53 |
+
`declare_bsg_ready_and_link_sif_s(flit_width_p,bsg_ready_and_link_sif_s);
|
| 54 |
+
|
| 55 |
+
bsg_ready_and_link_sif_s [num_in_p-1:0] links_i_cast, links_o_cast;
|
| 56 |
+
bsg_ready_and_link_sif_s [num_in_p-1:0] links_o_stubbed_v, links_o_stubbed_ready;
|
| 57 |
+
|
| 58 |
+
bsg_ready_and_link_sif_s concentrated_link_i_cast, concentrated_link_o_cast;
|
| 59 |
+
bsg_ready_and_link_sif_s concentrated_link_o_stubbed_v, concentrated_link_o_stubbed_ready;
|
| 60 |
+
|
| 61 |
+
assign links_i_cast = links_i;
|
| 62 |
+
assign links_o = links_o_cast;
|
| 63 |
+
|
| 64 |
+
assign concentrated_link_i_cast = concentrated_link_i;
|
| 65 |
+
assign concentrated_link_o = concentrated_link_o_cast;
|
| 66 |
+
|
| 67 |
+
for (genvar i = 0; i < num_in_p; i++)
|
| 68 |
+
begin : cast
|
| 69 |
+
assign links_o_cast[i].data = links_o_stubbed_ready[i].data;
|
| 70 |
+
assign links_o_cast[i].v = links_o_stubbed_ready[i].v;
|
| 71 |
+
assign links_o_cast[i].ready_and_rev = links_o_stubbed_v[i].ready_and_rev;
|
| 72 |
+
end
|
| 73 |
+
|
| 74 |
+
assign concentrated_link_o_cast.data = concentrated_link_o_stubbed_ready.data;
|
| 75 |
+
assign concentrated_link_o_cast.v = concentrated_link_o_stubbed_ready.v;
|
| 76 |
+
assign concentrated_link_o_cast.ready_and_rev = concentrated_link_o_stubbed_v.ready_and_rev;
|
| 77 |
+
|
| 78 |
+
bsg_wormhole_concentrator_in
|
| 79 |
+
#(.flit_width_p(flit_width_p)
|
| 80 |
+
,.len_width_p(len_width_p)
|
| 81 |
+
,.cid_width_p(cid_width_p)
|
| 82 |
+
,.num_in_p(num_in_p)
|
| 83 |
+
,.cord_width_p(cord_width_p)
|
| 84 |
+
,.debug_lp(debug_lp)
|
| 85 |
+
,.hold_on_valid_p(hold_on_valid_p)
|
| 86 |
+
)
|
| 87 |
+
concentrator_in
|
| 88 |
+
(.clk_i(clk_i)
|
| 89 |
+
,.reset_i(reset_i)
|
| 90 |
+
|
| 91 |
+
,.links_i(links_i)
|
| 92 |
+
,.links_o(links_o_stubbed_v)
|
| 93 |
+
|
| 94 |
+
,.concentrated_link_i(concentrated_link_i)
|
| 95 |
+
,.concentrated_link_o(concentrated_link_o_stubbed_ready)
|
| 96 |
+
);
|
| 97 |
+
|
| 98 |
+
bsg_wormhole_concentrator_out
|
| 99 |
+
#(.flit_width_p(flit_width_p)
|
| 100 |
+
,.len_width_p(len_width_p)
|
| 101 |
+
,.cid_width_p(cid_width_p)
|
| 102 |
+
,.num_in_p(num_in_p)
|
| 103 |
+
,.cord_width_p(cord_width_p)
|
| 104 |
+
,.debug_lp(debug_lp)
|
| 105 |
+
,.hold_on_valid_p(hold_on_valid_p)
|
| 106 |
+
)
|
| 107 |
+
concentrator_out
|
| 108 |
+
(.clk_i(clk_i)
|
| 109 |
+
,.reset_i(reset_i)
|
| 110 |
+
|
| 111 |
+
,.links_i(links_i)
|
| 112 |
+
,.links_o(links_o_stubbed_ready)
|
| 113 |
+
|
| 114 |
+
,.concentrated_link_i(concentrated_link_i)
|
| 115 |
+
,.concentrated_link_o(concentrated_link_o_stubbed_v)
|
| 116 |
+
);
|
| 117 |
+
|
| 118 |
+
endmodule
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
`BSG_ABSTRACT_MODULE(bsg_wormhole_concentrator)
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_wormhole_router.sv
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`include "bsg_defines.sv"
|
| 2 |
+
`include "bsg_noc_links.svh"
|
| 3 |
+
`include "bsg_wormhole_router.svh"
|
| 4 |
+
|
| 5 |
+
module bsg_wormhole_router
|
| 6 |
+
import bsg_wormhole_router_pkg::StrictXY;
|
| 7 |
+
import bsg_wormhole_router_pkg::StrictX;
|
| 8 |
+
#(parameter `BSG_INV_PARAM(flit_width_p)
|
| 9 |
+
,parameter dims_p = 2 // 1
|
| 10 |
+
,parameter dirs_lp = dims_p*2+1
|
| 11 |
+
|
| 12 |
+
// this list determines the range of bit values used to determine each dimension in the N-D router
|
| 13 |
+
// cord_dims_p is normally the same as dims_p. However, the override allows users to pass
|
| 14 |
+
// a larger cord array than necessary, useful for parameterizing between 1d/nd networks
|
| 15 |
+
,parameter cord_dims_p = dims_p
|
| 16 |
+
,parameter int cord_markers_pos_p[cord_dims_p:0] = '{ 5, 4, 0 } // '{5,0} //
|
| 17 |
+
,parameter bit [1:0][dirs_lp-1:0][dirs_lp-1:0] routing_matrix_p = (dims_p == 2) ? StrictXY : StrictX
|
| 18 |
+
,parameter reverse_order_p = 0
|
| 19 |
+
,parameter `BSG_INV_PARAM(len_width_p)
|
| 20 |
+
,parameter debug_lp = 0
|
| 21 |
+
// Hold on valid sets the arbitration policy such that once an output tag is selected, it
|
| 22 |
+
// remains selected until it is acked, then the round-robin scheduler continues cycling
|
| 23 |
+
// from the selected tag. This is consistent with BaseJump STL handshake assumptions.
|
| 24 |
+
// Notably, this parameter is required to work with bsg_parallel_in_serial_out_passthrough.
|
| 25 |
+
// This policy has a slight throughput degradation but effectively arbitrates based on age,
|
| 26 |
+
// so minimizes worst case latency.
|
| 27 |
+
,parameter hold_on_valid_p = 0
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
(input clk_i
|
| 31 |
+
,input reset_i
|
| 32 |
+
|
| 33 |
+
// Traffics
|
| 34 |
+
,input [dirs_lp-1:0][`bsg_ready_and_link_sif_width(flit_width_p)-1:0] link_i
|
| 35 |
+
,output [dirs_lp-1:0][`bsg_ready_and_link_sif_width(flit_width_p)-1:0] link_o
|
| 36 |
+
|
| 37 |
+
// My coordinate data
|
| 38 |
+
,input [cord_markers_pos_p[dims_p]-1:0] my_cord_i
|
| 39 |
+
);
|
| 40 |
+
|
| 41 |
+
localparam input_dirs_lp = dirs_lp;
|
| 42 |
+
localparam output_dirs_lp = dirs_lp;
|
| 43 |
+
|
| 44 |
+
// FIXME: move to bsg_wormhole_router.svh
|
| 45 |
+
`declare_bsg_wormhole_router_header_s(cord_markers_pos_p[dims_p], len_width_p, bsg_wormhole_router_header_s);
|
| 46 |
+
|
| 47 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 48 |
+
wire [dirs_lp-1:0][dirs_lp-1:0] matrix_out_in_transpose;
|
| 49 |
+
|
| 50 |
+
bsg_transpose #(.width_p(dirs_lp),.els_p(dirs_lp)) tr (.i(routing_matrix_p[0])
|
| 51 |
+
,.o(matrix_out_in_transpose)
|
| 52 |
+
);
|
| 53 |
+
always_ff @(negedge reset_i)
|
| 54 |
+
begin
|
| 55 |
+
assert (routing_matrix_p[1] == matrix_out_in_transpose)
|
| 56 |
+
else $error("inconsistent matrixes");
|
| 57 |
+
end
|
| 58 |
+
`endif
|
| 59 |
+
|
| 60 |
+
// we collect the information for each FIFO here
|
| 61 |
+
wire [input_dirs_lp-1:0][flit_width_p-1:0] fifo_data_lo;
|
| 62 |
+
wire [input_dirs_lp-1:0] fifo_valid_lo;
|
| 63 |
+
|
| 64 |
+
// one for each input channel; it broadcasts that it is finished to all of the outputs
|
| 65 |
+
wire [dirs_lp-1:0] releases;
|
| 66 |
+
|
| 67 |
+
// from each input to each output
|
| 68 |
+
wire [dirs_lp-1:0][dirs_lp-1:0] reqs, reqs_transpose;
|
| 69 |
+
|
| 70 |
+
// from each output to each input
|
| 71 |
+
wire [dirs_lp-1:0][dirs_lp-1:0] yumis, yumis_transpose;
|
| 72 |
+
|
| 73 |
+
`declare_bsg_ready_and_link_sif_s(flit_width_p,bsg_ready_and_link_sif_s);
|
| 74 |
+
bsg_ready_and_link_sif_s [dirs_lp-1:0] link_i_cast, link_o_cast;
|
| 75 |
+
|
| 76 |
+
assign link_i_cast = link_i;
|
| 77 |
+
assign link_o = link_o_cast;
|
| 78 |
+
|
| 79 |
+
genvar i,j;
|
| 80 |
+
|
| 81 |
+
for (i = 0; i < input_dirs_lp; i=i+1)
|
| 82 |
+
begin: in_ch
|
| 83 |
+
localparam output_dirs_sparse_lp = `BSG_COUNTONES_SYNTH(routing_matrix_p[0][i]);
|
| 84 |
+
|
| 85 |
+
// live decoding of output dirs from header
|
| 86 |
+
|
| 87 |
+
wire [output_dirs_lp-1:0] decoded_dest_lo;
|
| 88 |
+
wire [output_dirs_sparse_lp-1:0] decoded_dest_sparse_lo;
|
| 89 |
+
wire [output_dirs_sparse_lp-1:0] reqs_lo, yumis_li;
|
| 90 |
+
|
| 91 |
+
bsg_concentrate_static #(.pattern_els_p(routing_matrix_p[0][i])) conc
|
| 92 |
+
(.i(yumis_transpose[i])
|
| 93 |
+
,.o(yumis_li)
|
| 94 |
+
);
|
| 95 |
+
|
| 96 |
+
wire any_yumi = | yumis_li;
|
| 97 |
+
|
| 98 |
+
bsg_two_fifo #(.width_p(flit_width_p)) twofer
|
| 99 |
+
(.clk_i
|
| 100 |
+
,.reset_i
|
| 101 |
+
,.ready_param_o (link_o_cast[i].ready_and_rev)
|
| 102 |
+
,.data_i (link_i_cast[i].data)
|
| 103 |
+
,.v_i (link_i_cast[i].v)
|
| 104 |
+
,.v_o (fifo_valid_lo[i])
|
| 105 |
+
,.data_o (fifo_data_lo [i])
|
| 106 |
+
,.yumi_i (any_yumi)
|
| 107 |
+
);
|
| 108 |
+
|
| 109 |
+
bsg_wormhole_router_header_s hdr;
|
| 110 |
+
|
| 111 |
+
assign hdr = fifo_data_lo[i][$bits(bsg_wormhole_router_header_s)-1:0];
|
| 112 |
+
|
| 113 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 114 |
+
if (debug_lp)
|
| 115 |
+
begin
|
| 116 |
+
logic release_r;
|
| 117 |
+
|
| 118 |
+
always_ff @(posedge clk_i)
|
| 119 |
+
release_r <= releases[i];
|
| 120 |
+
|
| 121 |
+
always_ff @(negedge clk_i)
|
| 122 |
+
begin
|
| 123 |
+
if (releases[i] & ~release_r)
|
| 124 |
+
$display("%m in ch%2d: packet finished last cycle",i);
|
| 125 |
+
|
| 126 |
+
if ((reset_i === 1'b0) && link_i_cast[i].v && !link_o_cast[i].ready_and_rev)
|
| 127 |
+
$display("%m in ch%2d: nacking packet %h",i,link_i_cast[i].data);
|
| 128 |
+
else
|
| 129 |
+
if ((reset_i === 1'b0) && link_i_cast[i].v && link_o_cast[i].ready_and_rev)
|
| 130 |
+
$display("%m in ch%2d: accepting packet %h",i,link_i_cast[i].data);
|
| 131 |
+
if ((reset_i === 1'b0) && any_yumi)
|
| 132 |
+
begin
|
| 133 |
+
assert (fifo_valid_lo[i]) else $error("Error dequeing when data not available");
|
| 134 |
+
if (reqs_lo)
|
| 135 |
+
$display("%m in ch%2d: dequeing header %h (outch=%b,len=%b,dest=%b)",i,fifo_data_lo[i],reqs_lo,hdr.len,hdr.cord);
|
| 136 |
+
else
|
| 137 |
+
$display ("%m in ch%2d: dequeing packet %h",i, fifo_data_lo[i]);
|
| 138 |
+
end
|
| 139 |
+
|
| 140 |
+
end // always_ff @
|
| 141 |
+
end
|
| 142 |
+
`endif
|
| 143 |
+
|
| 144 |
+
bsg_wormhole_router_decoder_dor #(.dims_p(dims_p)
|
| 145 |
+
,.cord_dims_p(cord_dims_p)
|
| 146 |
+
,.reverse_order_p(reverse_order_p)
|
| 147 |
+
,.cord_markers_pos_p(cord_markers_pos_p)
|
| 148 |
+
) dor
|
| 149 |
+
(.target_cord_i(hdr.cord)
|
| 150 |
+
,.my_cord_i
|
| 151 |
+
,.req_o(decoded_dest_lo)
|
| 152 |
+
);
|
| 153 |
+
|
| 154 |
+
bsg_concentrate_static #(.pattern_els_p(routing_matrix_p[0][i])) conc_dec
|
| 155 |
+
(.i(decoded_dest_lo)
|
| 156 |
+
,.o(decoded_dest_sparse_lo)
|
| 157 |
+
);
|
| 158 |
+
|
| 159 |
+
// fixme: add assertions for stubbed out parameters
|
| 160 |
+
|
| 161 |
+
wire detected_header_lo;
|
| 162 |
+
|
| 163 |
+
bsg_wormhole_router_input_control #(.output_dirs_p(output_dirs_sparse_lp), .payload_len_bits_p($bits(hdr.len))) wic
|
| 164 |
+
(.clk_i
|
| 165 |
+
,.reset_i
|
| 166 |
+
,.fifo_v_i (fifo_valid_lo[i])
|
| 167 |
+
,.fifo_yumi_i (any_yumi)
|
| 168 |
+
,.fifo_decoded_dest_i(decoded_dest_sparse_lo)
|
| 169 |
+
,.fifo_payload_len_i (hdr.len)
|
| 170 |
+
,.reqs_o (reqs_lo)
|
| 171 |
+
,.release_o (releases[i]) // broadcast to all
|
| 172 |
+
,.detected_header_o (detected_header_lo)
|
| 173 |
+
);
|
| 174 |
+
|
| 175 |
+
// switch to dense matrix form
|
| 176 |
+
bsg_unconcentrate_static #(.pattern_els_p(routing_matrix_p[0][i])) unc
|
| 177 |
+
(.i (reqs_lo)
|
| 178 |
+
,.o (reqs[i]) // unicast
|
| 179 |
+
);
|
| 180 |
+
|
| 181 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 182 |
+
always_ff @(negedge clk_i)
|
| 183 |
+
if (debug_lp)
|
| 184 |
+
assert (detected_header_lo!==1'b1 || !(decoded_dest_lo & ~ routing_matrix_p[0][i]))
|
| 185 |
+
else $error("%m input port %d request to route in direction not supported by router %b %b",i,decoded_dest_lo, routing_matrix_p[0][i]);
|
| 186 |
+
`endif
|
| 187 |
+
|
| 188 |
+
end
|
| 189 |
+
|
| 190 |
+
// flip signal wires from input-indexed to output-indexed
|
| 191 |
+
// this is swizzling the wires that connect input ports and output ports
|
| 192 |
+
bsg_transpose #(.width_p(dirs_lp),.els_p(dirs_lp)) reqs_trans
|
| 193 |
+
(.i(reqs)
|
| 194 |
+
,.o(reqs_transpose)
|
| 195 |
+
);
|
| 196 |
+
|
| 197 |
+
// iterate through each output channel
|
| 198 |
+
for (i = 0; i < output_dirs_lp; i=i+1)
|
| 199 |
+
begin: out_ch
|
| 200 |
+
localparam input_dirs_sparse_lp = `BSG_COUNTONES_SYNTH(routing_matrix_p[1][i]);
|
| 201 |
+
wire [input_dirs_sparse_lp-1:0] reqs_li, release_li, valids_li, yumis_lo, data_sel_lo;
|
| 202 |
+
wire [input_dirs_sparse_lp-1:0][flit_width_p-1:0] fifo_data_sparse_lo;
|
| 203 |
+
|
| 204 |
+
bsg_concentrate_static #(.pattern_els_p(routing_matrix_p[1][i])) conc
|
| 205 |
+
(.i(reqs_transpose[i]),.o(reqs_li));
|
| 206 |
+
|
| 207 |
+
bsg_concentrate_static #(.pattern_els_p(routing_matrix_p[1][i])) conc2
|
| 208 |
+
(.i(releases),.o(release_li));
|
| 209 |
+
|
| 210 |
+
bsg_concentrate_static #(.pattern_els_p(routing_matrix_p[1][i])) conc3
|
| 211 |
+
(.i(fifo_valid_lo),.o(valids_li));
|
| 212 |
+
|
| 213 |
+
bsg_array_concentrate_static #(.width_p(flit_width_p), .pattern_els_p(routing_matrix_p[1][i])) conc4
|
| 214 |
+
(.i(fifo_data_lo),.o(fifo_data_sparse_lo));
|
| 215 |
+
|
| 216 |
+
bsg_wormhole_router_output_control
|
| 217 |
+
#(.input_dirs_p(input_dirs_sparse_lp), .hold_on_valid_p(hold_on_valid_p)) woc
|
| 218 |
+
(.clk_i
|
| 219 |
+
,.reset_i
|
| 220 |
+
,.reqs_i (reqs_li )
|
| 221 |
+
,.release_i (release_li)
|
| 222 |
+
,.valid_i (valids_li )
|
| 223 |
+
,.yumi_o (yumis_lo )
|
| 224 |
+
,.ready_and_i (link_i_cast[i].ready_and_rev)
|
| 225 |
+
,.valid_o (link_o_cast[i].v)
|
| 226 |
+
,.data_sel_o (data_sel_lo)
|
| 227 |
+
);
|
| 228 |
+
|
| 229 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 230 |
+
always_ff @(negedge clk_i)
|
| 231 |
+
begin
|
| 232 |
+
if (debug_lp)
|
| 233 |
+
begin
|
| 234 |
+
if ((reset_i === 1'b0) && link_o_cast[i].v)
|
| 235 |
+
begin
|
| 236 |
+
if (link_i_cast[i].ready_and_rev)
|
| 237 |
+
begin
|
| 238 |
+
$display("%m out ch%2d: sending packet %h",i,link_o_cast[i].data);
|
| 239 |
+
end
|
| 240 |
+
end
|
| 241 |
+
end
|
| 242 |
+
end
|
| 243 |
+
`endif
|
| 244 |
+
|
| 245 |
+
bsg_mux_one_hot #(.width_p(flit_width_p)
|
| 246 |
+
,.els_p(input_dirs_sparse_lp)
|
| 247 |
+
) data_mux
|
| 248 |
+
(.data_i(fifo_data_sparse_lo)
|
| 249 |
+
,.sel_one_hot_i(data_sel_lo)
|
| 250 |
+
,.data_o(link_o_cast[i].data)
|
| 251 |
+
);
|
| 252 |
+
|
| 253 |
+
bsg_unconcentrate_static #(.pattern_els_p(routing_matrix_p[1][i])) unc1
|
| 254 |
+
(.i (yumis_lo)
|
| 255 |
+
,.o (yumis[i])
|
| 256 |
+
);
|
| 257 |
+
end
|
| 258 |
+
|
| 259 |
+
// flip signal wires from output-indexed to input-indexed
|
| 260 |
+
// this is swizzling the wires that connect input ports and output ports
|
| 261 |
+
bsg_transpose #(.width_p(dirs_lp),.els_p(dirs_lp)) yumis_trans
|
| 262 |
+
(.i(yumis)
|
| 263 |
+
,.o(yumis_transpose)
|
| 264 |
+
);
|
| 265 |
+
|
| 266 |
+
endmodule
|
| 267 |
+
|
| 268 |
+
`BSG_ABSTRACT_MODULE(bsg_wormhole_router)
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_wormhole_router.svh
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// this is a partial packet header should always go at the bottom bits of a header flit
|
| 2 |
+
// move to bsg_wormhole_router.svh
|
| 3 |
+
// FIXME: have them pass in the cord_markers_pos_p
|
| 4 |
+
// struct, then it will match bsg_wormhole_router
|
| 5 |
+
//
|
| 6 |
+
|
| 7 |
+
`define declare_bsg_wormhole_router_header_s(cord_width_mp, len_width_mp, struct_name_mp) \
|
| 8 |
+
typedef struct packed { \
|
| 9 |
+
logic [len_width_mp-1:0] len; \
|
| 10 |
+
logic [cord_width_mp-1:0 ] cord; \
|
| 11 |
+
} struct_name_mp
|
| 12 |
+
|
| 13 |
+
`define declare_bsg_wormhole_concentrator_header_s(cord_width_mp, len_width_mp, cid_width, struct_name_mp) \
|
| 14 |
+
typedef struct packed { \
|
| 15 |
+
logic [cid_width-1:0] cid; \
|
| 16 |
+
logic [len_width_mp-1:0] len; \
|
| 17 |
+
logic [cord_width_mp-1:0] cord; \
|
| 18 |
+
} struct_name_mp
|
| 19 |
+
|
| 20 |
+
`define declare_bsg_wormhole_router_packet_s(cord_width_mp, len_width_mp, payload_width_mp, struct_name_mp) \
|
| 21 |
+
typedef struct packed { \
|
| 22 |
+
logic [payload_width_mp-1:0] payload; \
|
| 23 |
+
logic [len_width_mp-1:0] len; \
|
| 24 |
+
logic [cord_width_mp-1:0] cord; \
|
| 25 |
+
} struct_name_mp
|
| 26 |
+
|
| 27 |
+
`define declare_bsg_wormhole_concentrator_packet_s(cord_width_mp, len_width_mp, cid_width_mp, payload_width_mp, struct_name_mp) \
|
| 28 |
+
typedef struct packed { \
|
| 29 |
+
logic [payload_width_mp-1:0] payload; \
|
| 30 |
+
logic [cid_width_mp-1:0] cid; \
|
| 31 |
+
logic [len_width_mp-1:0] len; \
|
| 32 |
+
logic [cord_width_mp-1:0] cord; \
|
| 33 |
+
} struct_name_mp
|
| 34 |
+
|
| 35 |
+
`define bsg_wormhole_router_header_width(cord_width_mp, len_width_mp) \
|
| 36 |
+
(cord_width_mp + len_width_mp)
|
| 37 |
+
|
| 38 |
+
`define bsg_wormhole_concentrator_header_width(cord_width_mp, len_width_mp, cid_width_mp) \
|
| 39 |
+
(cord_width_mp + len_width_mp + cid_width_mp)
|
| 40 |
+
|
| 41 |
+
`define bsg_wormhole_concentrator_packet_width(cord_width_mp, len_width_mp, cid_width_mp, payload_width_mp) \
|
| 42 |
+
(cord_width_mp + len_width_mp + cid_width_mp + payload_width_mp)
|
| 43 |
+
|
| 44 |
+
`define bsg_wormhole_router_packet_width(cord_width_mp, len_width_mp, payload_width_mp) \
|
| 45 |
+
(cord_width_mp + len_width_mp + payload_width_mp)
|
| 46 |
+
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_wormhole_router_adapter_in.sv
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* bsg_wormhole_router_adapter_in.sv
|
| 3 |
+
*
|
| 4 |
+
* packet = {payload, length, cord}
|
| 5 |
+
*
|
| 6 |
+
* Goes from a wide register containing an entire packet to a serialized packet.
|
| 7 |
+
* Most useful for testbenches, and in hardware, shorter packets where the data is
|
| 8 |
+
* not naturally serialized.
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
`include "bsg_defines.sv"
|
| 12 |
+
|
| 13 |
+
`include "bsg_noc_links.svh"
|
| 14 |
+
`include "bsg_wormhole_router.svh"
|
| 15 |
+
|
| 16 |
+
module bsg_wormhole_router_adapter_in
|
| 17 |
+
#(parameter `BSG_INV_PARAM(max_payload_width_p )
|
| 18 |
+
, parameter `BSG_INV_PARAM(len_width_p )
|
| 19 |
+
, parameter `BSG_INV_PARAM(cord_width_p )
|
| 20 |
+
, parameter `BSG_INV_PARAM(flit_width_p )
|
| 21 |
+
|
| 22 |
+
, localparam bsg_ready_and_link_sif_width_lp =
|
| 23 |
+
`bsg_ready_and_link_sif_width(flit_width_p)
|
| 24 |
+
, localparam bsg_wormhole_packet_width_lp =
|
| 25 |
+
`bsg_wormhole_router_packet_width(cord_width_p, len_width_p, max_payload_width_p)
|
| 26 |
+
)
|
| 27 |
+
(input clk_i
|
| 28 |
+
, input reset_i
|
| 29 |
+
|
| 30 |
+
, input [bsg_wormhole_packet_width_lp-1:0] packet_i
|
| 31 |
+
, input packet_v_i
|
| 32 |
+
, output packet_ready_and_o
|
| 33 |
+
|
| 34 |
+
, output [flit_width_p-1:0] link_data_o
|
| 35 |
+
, output link_v_o
|
| 36 |
+
, input link_ready_and_i
|
| 37 |
+
);
|
| 38 |
+
|
| 39 |
+
`declare_bsg_wormhole_router_packet_s(cord_width_p, len_width_p, max_payload_width_p, bsg_wormhole_packet_s);
|
| 40 |
+
bsg_wormhole_packet_s packet_cast_i;
|
| 41 |
+
assign packet_cast_i = packet_i;
|
| 42 |
+
|
| 43 |
+
localparam max_num_flits_lp = `BSG_CDIV($bits(bsg_wormhole_packet_s), flit_width_p);
|
| 44 |
+
localparam protocol_len_lp = `BSG_SAFE_CLOG2(max_num_flits_lp);
|
| 45 |
+
wire [max_num_flits_lp*flit_width_p-1:0] packet_padded_li = packet_i;
|
| 46 |
+
|
| 47 |
+
bsg_parallel_in_serial_out_dynamic
|
| 48 |
+
#(.width_p(flit_width_p)
|
| 49 |
+
,.max_els_p(max_num_flits_lp)
|
| 50 |
+
)
|
| 51 |
+
piso
|
| 52 |
+
(.clk_i(clk_i)
|
| 53 |
+
,.reset_i(reset_i)
|
| 54 |
+
|
| 55 |
+
,.v_i(packet_v_i)
|
| 56 |
+
,.len_i(protocol_len_lp'(packet_cast_i.len))
|
| 57 |
+
,.data_i(packet_padded_li)
|
| 58 |
+
,.ready_and_o(packet_ready_and_o)
|
| 59 |
+
|
| 60 |
+
,.v_o(link_v_o)
|
| 61 |
+
,.len_v_o(/* unused */)
|
| 62 |
+
,.data_o(link_data_o)
|
| 63 |
+
,.yumi_i(link_ready_and_i & link_v_o)
|
| 64 |
+
);
|
| 65 |
+
|
| 66 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 67 |
+
always_ff @(negedge clk_i)
|
| 68 |
+
assert(reset_i || ~packet_v_i || (packet_cast_i.len <= max_num_flits_lp))
|
| 69 |
+
else
|
| 70 |
+
$error("Packet received with len: %x > max_num_flits: %x", packet_cast_i.len, max_num_flits_lp);
|
| 71 |
+
`endif
|
| 72 |
+
|
| 73 |
+
endmodule
|
| 74 |
+
|
| 75 |
+
`BSG_ABSTRACT_MODULE(bsg_wormhole_router_adapter_in)
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_wormhole_router_adapter_out.sv
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* bsg_wormhole_router_adapter_out.sv
|
| 3 |
+
*
|
| 4 |
+
* packet = {payload, length, cord}
|
| 5 |
+
*
|
| 6 |
+
* Basic module that deserializes an incoming wormhole packet into a wide register.
|
| 7 |
+
* This is especially useful for testbenches. (For hardware,
|
| 8 |
+
* full deserialization adds latency and area, this is often undesireable, but for
|
| 9 |
+
* small packets, it may make sense to use it.)
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
`include "bsg_defines.sv"
|
| 13 |
+
|
| 14 |
+
`include "bsg_noc_links.svh"
|
| 15 |
+
`include "bsg_wormhole_router.svh"
|
| 16 |
+
|
| 17 |
+
module bsg_wormhole_router_adapter_out
|
| 18 |
+
#(parameter `BSG_INV_PARAM(max_payload_width_p )
|
| 19 |
+
, parameter `BSG_INV_PARAM(len_width_p )
|
| 20 |
+
, parameter `BSG_INV_PARAM(cord_width_p )
|
| 21 |
+
, parameter `BSG_INV_PARAM(flit_width_p )
|
| 22 |
+
|
| 23 |
+
, localparam bsg_ready_and_link_sif_width_lp =
|
| 24 |
+
`bsg_ready_and_link_sif_width(flit_width_p)
|
| 25 |
+
, localparam bsg_wormhole_packet_width_lp =
|
| 26 |
+
`bsg_wormhole_router_packet_width(cord_width_p, len_width_p, max_payload_width_p)
|
| 27 |
+
)
|
| 28 |
+
(input clk_i
|
| 29 |
+
, input reset_i
|
| 30 |
+
|
| 31 |
+
, input link_v_i
|
| 32 |
+
, input [max_payload_width_p-1:0] link_data_i
|
| 33 |
+
, output link_ready_and_o
|
| 34 |
+
|
| 35 |
+
, output [bsg_wormhole_packet_width_lp-1:0] packet_o
|
| 36 |
+
, output packet_v_o
|
| 37 |
+
, input packet_yumi_i
|
| 38 |
+
);
|
| 39 |
+
|
| 40 |
+
`declare_bsg_wormhole_router_header_s(cord_width_p, len_width_p, bsg_wormhole_header_s);
|
| 41 |
+
bsg_wormhole_header_s header_li;
|
| 42 |
+
assign header_li = link_data_i;
|
| 43 |
+
|
| 44 |
+
`declare_bsg_wormhole_router_packet_s(cord_width_p,len_width_p,max_payload_width_p,bsg_wormhole_packet_s);
|
| 45 |
+
|
| 46 |
+
localparam max_num_flits_lp = `BSG_CDIV($bits(bsg_wormhole_packet_s), flit_width_p);
|
| 47 |
+
localparam protocol_len_lp = `BSG_SAFE_CLOG2(max_num_flits_lp);
|
| 48 |
+
logic [max_num_flits_lp*flit_width_p-1:0] packet_padded_lo;
|
| 49 |
+
bsg_serial_in_parallel_out_dynamic
|
| 50 |
+
#(.width_p(flit_width_p)
|
| 51 |
+
,.max_els_p(max_num_flits_lp)
|
| 52 |
+
)
|
| 53 |
+
sipo
|
| 54 |
+
(.clk_i(clk_i)
|
| 55 |
+
,.reset_i(reset_i)
|
| 56 |
+
|
| 57 |
+
,.data_i(link_data_i)
|
| 58 |
+
,.len_i(protocol_len_lp'(header_li.len))
|
| 59 |
+
,.ready_and_o(link_ready_and_o)
|
| 60 |
+
,.len_ready_o(/* unused */)
|
| 61 |
+
,.v_i(link_v_i)
|
| 62 |
+
|
| 63 |
+
,.v_o(packet_v_o)
|
| 64 |
+
,.data_o(packet_padded_lo)
|
| 65 |
+
,.yumi_i(packet_yumi_i)
|
| 66 |
+
);
|
| 67 |
+
assign packet_o = packet_padded_lo[0+:bsg_wormhole_packet_width_lp];
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 72 |
+
logic recv_r;
|
| 73 |
+
bsg_dff_reset_en
|
| 74 |
+
#(.width_p(1))
|
| 75 |
+
recv_reg
|
| 76 |
+
(.clk_i(clk_i)
|
| 77 |
+
,.reset_i(reset_i)
|
| 78 |
+
,.en_i(link_v_i || packet_yumi_i)
|
| 79 |
+
|
| 80 |
+
,.data_i(link_v_i)
|
| 81 |
+
,.data_o(recv_r)
|
| 82 |
+
);
|
| 83 |
+
wire new_header_li = ~recv_r & link_v_i;
|
| 84 |
+
|
| 85 |
+
// TODO: This assertion is buggy and fires erroneously
|
| 86 |
+
//always_ff @(negedge clk_i)
|
| 87 |
+
// assert(reset_i || ~new_header_li || (header_li.len <= max_num_flits_lp))
|
| 88 |
+
// else
|
| 89 |
+
// $error("Header received with len: %x > max_num_flits: %x", header_li.len, max_num_flits_lp);
|
| 90 |
+
`endif
|
| 91 |
+
|
| 92 |
+
endmodule
|
| 93 |
+
|
| 94 |
+
`BSG_ABSTRACT_MODULE(bsg_wormhole_router_adapter_out)
|
| 95 |
+
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_wormhole_router_output_control.sv
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`include "bsg_defines.sv"
|
| 2 |
+
|
| 3 |
+
module bsg_wormhole_router_output_control
|
| 4 |
+
#(parameter `BSG_INV_PARAM(input_dirs_p)
|
| 5 |
+
// Hold on valid sets the arbitration policy such that once an output tag is selected, it
|
| 6 |
+
// remains selected until it is acked, then the round-robin scheduler continues cycling
|
| 7 |
+
// from the selected tag. This is consistent with BaseJump STL handshake assumptions.
|
| 8 |
+
// Notably, this parameter is required to work with bsg_parallel_in_serial_out_passthrough.
|
| 9 |
+
// This policy has a slight throughput degradation but effectively arbitrates based on age,
|
| 10 |
+
// so minimizes worst case latency.
|
| 11 |
+
, parameter hold_on_valid_p = 0
|
| 12 |
+
)
|
| 13 |
+
(input clk_i
|
| 14 |
+
, input reset_i
|
| 15 |
+
|
| 16 |
+
// this input channel has a header packet at the head of the FIFO for this output
|
| 17 |
+
, input [input_dirs_p-1:0] reqs_i
|
| 18 |
+
|
| 19 |
+
// the input channel finished a packet on the previous cycle
|
| 20 |
+
// note: it is up to this module to verify that the input channel was allocated to this output channel
|
| 21 |
+
, input [input_dirs_p-1:0] release_i
|
| 22 |
+
|
| 23 |
+
// from input fifos
|
| 24 |
+
, input [input_dirs_p-1:0] valid_i
|
| 25 |
+
, output [input_dirs_p-1:0] yumi_o
|
| 26 |
+
|
| 27 |
+
// channel outputs
|
| 28 |
+
, input ready_and_i
|
| 29 |
+
, output valid_o
|
| 30 |
+
, output [input_dirs_p-1:0] data_sel_o
|
| 31 |
+
);
|
| 32 |
+
|
| 33 |
+
wire [input_dirs_p-1:0] scheduled_r, scheduled_with_release, scheduled_n, grants_lo;
|
| 34 |
+
|
| 35 |
+
bsg_dff_reset #(.width_p(input_dirs_p)) scheduled_reg (.clk_i, .reset_i, .data_i(scheduled_n), .data_o(scheduled_r));
|
| 36 |
+
|
| 37 |
+
assign scheduled_with_release = scheduled_r & ~release_i;
|
| 38 |
+
|
| 39 |
+
wire free_to_schedule = !scheduled_with_release;
|
| 40 |
+
|
| 41 |
+
bsg_round_robin_arb
|
| 42 |
+
#(.inputs_p(input_dirs_p), .hold_on_valid_p(hold_on_valid_p))
|
| 43 |
+
brr
|
| 44 |
+
(.clk_i
|
| 45 |
+
,.reset_i
|
| 46 |
+
,.grants_en_i (free_to_schedule) // ports are all free
|
| 47 |
+
,.reqs_i (reqs_i) // requests from input ports
|
| 48 |
+
,.grants_o (grants_lo) // output grants, takes into account grants_en_i
|
| 49 |
+
,.sel_one_hot_o() // output grants, does not take into account grants_en_i
|
| 50 |
+
,.v_o () // some reqs_i was set
|
| 51 |
+
,.tag_o ()
|
| 52 |
+
// make sure to only allocate the port if we succeeded in transmitting the header
|
| 53 |
+
// otherwise the input will try to allocate again on the next cycle
|
| 54 |
+
,.yumi_i (free_to_schedule & ready_and_i & valid_o) // update round_robin
|
| 55 |
+
);
|
| 56 |
+
|
| 57 |
+
assign scheduled_n = grants_lo | scheduled_with_release;
|
| 58 |
+
assign data_sel_o = scheduled_n;
|
| 59 |
+
assign valid_o = (|(scheduled_n & valid_i));
|
| 60 |
+
assign yumi_o = ready_and_i ? (scheduled_n & valid_i) : '0;
|
| 61 |
+
endmodule
|
| 62 |
+
|
| 63 |
+
`BSG_ABSTRACT_MODULE(bsg_wormhole_router_output_control)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_noc/bsg_wormhole_router_pkg.sv
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`include "bsg_defines.sv"
|
| 2 |
+
|
| 3 |
+
package bsg_wormhole_router_pkg;
|
| 4 |
+
localparam bit [1:0][2:0][2:0] StrictX
|
| 5 |
+
= { // EWP (input)
|
| 6 |
+
{ 3'b011 // E
|
| 7 |
+
,3'b101 // W
|
| 8 |
+
,3'b111 // P (output)
|
| 9 |
+
}
|
| 10 |
+
, // EWP (output)
|
| 11 |
+
{ 3'b011 // E
|
| 12 |
+
,3'b101 // W
|
| 13 |
+
,3'b111 // P (input)
|
| 14 |
+
}
|
| 15 |
+
};
|
| 16 |
+
|
| 17 |
+
localparam bit [1:0][2:0][2:0] X_AllowLoopBack // for testing only; you should never build a machine like this
|
| 18 |
+
= { // EWP (input) // it will deadlock
|
| 19 |
+
{ 3'b100 // E
|
| 20 |
+
,3'b010 // W
|
| 21 |
+
,3'b000 // P (output)
|
| 22 |
+
}
|
| 23 |
+
, // EWP (output)
|
| 24 |
+
{ 3'b111 // E
|
| 25 |
+
,3'b111 // W
|
| 26 |
+
,3'b111 // P (input)
|
| 27 |
+
}
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
localparam bit [1:0][4:0][4:0] StrictXY
|
| 31 |
+
= {
|
| 32 |
+
{// SNEWP (input)
|
| 33 |
+
5'b01111 // S
|
| 34 |
+
,5'b10111 // N
|
| 35 |
+
,5'b00011 // E
|
| 36 |
+
,5'b00101 // W
|
| 37 |
+
,5'b11111 // P (output)
|
| 38 |
+
}
|
| 39 |
+
,
|
| 40 |
+
{// SNEWP (output)
|
| 41 |
+
5'b01001 // S
|
| 42 |
+
,5'b10001 // N
|
| 43 |
+
,5'b11011 // E
|
| 44 |
+
,5'b11101 // W
|
| 45 |
+
,5'b11111 // P (input)
|
| 46 |
+
}
|
| 47 |
+
};
|
| 48 |
+
|
| 49 |
+
localparam bit [1:0][4:0][4:0] StrictYX
|
| 50 |
+
= {
|
| 51 |
+
{// SNEWP (input)
|
| 52 |
+
5'b01001 // S
|
| 53 |
+
,5'b10001 // N
|
| 54 |
+
,5'b11011 // E
|
| 55 |
+
,5'b11101 // W
|
| 56 |
+
,5'b11111 // P (output)
|
| 57 |
+
}
|
| 58 |
+
,
|
| 59 |
+
{// SNEWP (output)
|
| 60 |
+
5'b01111 // S
|
| 61 |
+
,5'b10111 // N
|
| 62 |
+
,5'b00011 // E
|
| 63 |
+
,5'b00101 // W
|
| 64 |
+
,5'b11111 // P (input)
|
| 65 |
+
}
|
| 66 |
+
};
|
| 67 |
+
|
| 68 |
+
// These are "OR-in" matrices, that are intended to be layered upon StrictYX or Strict XY.
|
| 69 |
+
localparam bit [1:0][4:0][4:0] XY_Allow_S
|
| 70 |
+
= {
|
| 71 |
+
{// SNEWP (input)
|
| 72 |
+
5'b00000 // S
|
| 73 |
+
,5'b00000 // N
|
| 74 |
+
,5'b10000 // E
|
| 75 |
+
,5'b10000 // W
|
| 76 |
+
,5'b00000 // P (output)
|
| 77 |
+
}
|
| 78 |
+
,
|
| 79 |
+
{// SNEWP (output)
|
| 80 |
+
5'b00110 // S
|
| 81 |
+
,5'b00000 // N
|
| 82 |
+
,5'b00000 // E
|
| 83 |
+
,5'b00000 // W
|
| 84 |
+
,5'b00000 // P (input)
|
| 85 |
+
}
|
| 86 |
+
};
|
| 87 |
+
|
| 88 |
+
localparam bit [1:0][4:0][4:0] XY_Allow_N
|
| 89 |
+
= {
|
| 90 |
+
{// SNEWP (input)
|
| 91 |
+
5'b00000 // S
|
| 92 |
+
,5'b00000 // N
|
| 93 |
+
,5'b01000 // E
|
| 94 |
+
,5'b01000 // W
|
| 95 |
+
,5'b00000 // P (output)
|
| 96 |
+
}
|
| 97 |
+
,
|
| 98 |
+
{// SNEWP (output)
|
| 99 |
+
5'b00000 // S
|
| 100 |
+
,5'b00110 // N
|
| 101 |
+
,5'b00000 // E
|
| 102 |
+
,5'b00000 // W
|
| 103 |
+
,5'b00000 // P (input)
|
| 104 |
+
}
|
| 105 |
+
};
|
| 106 |
+
|
| 107 |
+
localparam bit
|
| 108 |
+
[1:0][4:0][4:0] YX_Allow_W = {
|
| 109 |
+
{// SNEWP (input)
|
| 110 |
+
5'b00010 // S
|
| 111 |
+
,5'b00010 // N
|
| 112 |
+
,5'b00000 // E
|
| 113 |
+
,5'b00000 // W
|
| 114 |
+
,5'b00000 // P (output)
|
| 115 |
+
}
|
| 116 |
+
,
|
| 117 |
+
{// SNEWP (output)
|
| 118 |
+
5'b00000 // S
|
| 119 |
+
,5'b00000 // N
|
| 120 |
+
,5'b00000 // E
|
| 121 |
+
,5'b11000 // W
|
| 122 |
+
,5'b00000 // P (input)
|
| 123 |
+
}
|
| 124 |
+
};
|
| 125 |
+
|
| 126 |
+
localparam bit
|
| 127 |
+
[1:0][4:0][4:0] YX_Allow_E = {
|
| 128 |
+
{// SNEWP (input)
|
| 129 |
+
5'b00100 // S
|
| 130 |
+
,5'b00100 // N
|
| 131 |
+
,5'b00000 // E
|
| 132 |
+
,5'b00000 // W
|
| 133 |
+
,5'b00000 // P (output)
|
| 134 |
+
}
|
| 135 |
+
,
|
| 136 |
+
{// SNEWP (output)
|
| 137 |
+
5'b00000 // S
|
| 138 |
+
,5'b00000 // N
|
| 139 |
+
,5'b11000 // E
|
| 140 |
+
,5'b00000 // W
|
| 141 |
+
,5'b00000 // P (input)
|
| 142 |
+
}
|
| 143 |
+
};
|
| 144 |
+
|
| 145 |
+
endpackage
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_tag/README
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
See this LatchUp 2023 slide deck for a detailed rational and description of bsg_tag:
|
| 2 |
+
|
| 3 |
+
https://docs.google.com/presentation/d/18ILrko9kOfioF4d6rrcotiHvpBK8Bl3xfFB93Xv0of4/edit#slide=id.p
|
| 4 |
+
|
| 5 |
+
bsg_tag is quite fast (400 mbps) for many configuration tasks, but for gate-level sims of large chips, it can be helpful to accelerate evermore.
|
| 6 |
+
One approach is to directly manipulate the lines coming out of bsg_tag master. Partial orders between tag addresses can be encoded in a file, and
|
| 7 |
+
then a scheduler can derive the maximally parallel bsg_tag sequence that can boot the chip through a SystemVerilog testbench.
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_tag/bsg_tag.svh
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// bsg_tag
|
| 2 |
+
//
|
| 3 |
+
// bsg_tag implements a serial configuration network.
|
| 4 |
+
//
|
| 5 |
+
// the abstraction is that you have a number of multibit registers inside your chip that
|
| 6 |
+
// you would like to configure, either before the
|
| 7 |
+
// chip boots, or even as the chip runs. bsg_tag correctly handles
|
| 8 |
+
// clock domain crossings, so multibit registers will be updated atomically, allowing on-the-fly
|
| 9 |
+
// configuration changes. however, for this to happen, both the tag clock and the destination
|
| 10 |
+
// clock must be active, and enough clock cycles must pass on both sides for the data to be absorbed.
|
| 11 |
+
//
|
| 12 |
+
// bsg_tag enables this capability using only three
|
| 13 |
+
// external pins on the chip -- one for a clock, one for data, and one for a failsafe enable.
|
| 14 |
+
//
|
| 15 |
+
// each multibit register has a nodeID, and a customized length, and is implemented with a bsg_tag_client
|
| 16 |
+
//
|
| 17 |
+
// when you stream data into the chip, a single bsg_tag_master module demultiplexes the incoming packets
|
| 18 |
+
// according to nodeID out to the bsg_tag_client nodes. each client has a 4-wire connection to the master
|
| 19 |
+
// -- the shared tag clock, the failsafe enable, and a two-bit opcode. the opcode encodes 4 operations:
|
| 20 |
+
// shift in 1, shift in 0, reset, and noop. A noop immediately following a shift indicates that the
|
| 21 |
+
// transfer is done and should be sent across the CDC.
|
| 22 |
+
//
|
| 23 |
+
// - to reset the bsg_tag_master node, a stream of 0's is sent.
|
| 24 |
+
// - to reset the client, you
|
| 25 |
+
// transmit a 1, then the nodeID, a 0, then a length, and then length ' 1 bits.
|
| 26 |
+
// - to transmit data to a client, you
|
| 27 |
+
// transmit a 1, then the nodeID, a 1, then the length, then the data.
|
| 28 |
+
// - to not send data, transmit 0's.
|
| 29 |
+
//
|
| 30 |
+
// the enable signal is an out-of-band signal. if enable is low, then all of the bsg_tag_clients
|
| 31 |
+
// are disconnected from the masters. it should not be asserted / deasserted
|
| 32 |
+
// when trying to send data at the same time.
|
| 33 |
+
//
|
| 34 |
+
// when using bsg_tag to program the clock generators, the enable signal must be low
|
| 35 |
+
// initially because the clock generators must already be running in order to absorb data
|
| 36 |
+
// from the bsg_tag and be programmed. =)
|
| 37 |
+
//
|
| 38 |
+
// see bsg_ip_cores/testing/bsg_clk_gen/bsg_nonsynth_clk_gen_tester.sv for an example usage
|
| 39 |
+
//
|
| 40 |
+
// the bsg_tag clock should be asserted 180 degrees out of phase with the data/en signals, to
|
| 41 |
+
// avoid setup/hold time violations. i.e. use negedge clock.
|
| 42 |
+
//
|
| 43 |
+
|
| 44 |
+
`ifndef BSG_TAG_VH
|
| 45 |
+
`define BSG_TAG_VH
|
| 46 |
+
|
| 47 |
+
`define declare_bsg_tag_header_s(PARAM_els,PARAM_lg_width) \
|
| 48 |
+
\
|
| 49 |
+
typedef struct packed { \
|
| 50 |
+
logic [`BSG_SAFE_CLOG2((PARAM_els))-1:0] nodeID; \
|
| 51 |
+
logic data_not_reset; \
|
| 52 |
+
logic [(PARAM_lg_width)-1:0] len; \
|
| 53 |
+
} bsg_tag_header_s;
|
| 54 |
+
|
| 55 |
+
`define bsg_tag_max_packet_len(PARAM_els,PARAM_lg_width) ((1 << (PARAM_lg_width)) - 1 + $bits(bsg_tag_header_s))
|
| 56 |
+
`define bsg_tag_reset_len(PARAM_els,PARAM_lg_width) ((1 << `BSG_SAFE_CLOG2(`bsg_tag_max_packet_len((PARAM_els),(PARAM_lg_width))+1))+1)
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
`endif // `ifndef BSG_TAG_VH
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_tag/bsg_tag_bitbang.sv
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
`include "bsg_defines.sv"
|
| 3 |
+
|
| 4 |
+
/*
|
| 5 |
+
* This module takes 1 bit of data and sends it out along with a clock pulse.
|
| 6 |
+
*
|
| 7 |
+
* When this module receives a bit, tag_clk_r_o becomes low and the
|
| 8 |
+
* received data is put on tag_data_r_o on the current cycle. On next cycle,
|
| 9 |
+
* tag_clk_r_o will become high and generate a positive clock edge. The clock
|
| 10 |
+
* signal will remain high until the next data comes in.
|
| 11 |
+
*
|
| 12 |
+
* -----+
|
| 13 |
+
* v_i: |
|
| 14 |
+
* +-----------------------------
|
| 15 |
+
*
|
| 16 |
+
* +-----+ +-----+ +-----
|
| 17 |
+
* clk_i: | | | | |
|
| 18 |
+
* -----+ +-----+ +-----+
|
| 19 |
+
*
|
| 20 |
+
* -----+ +-----------------
|
| 21 |
+
* tag_clk_r_o: | |
|
| 22 |
+
* +-----------+
|
| 23 |
+
*
|
| 24 |
+
* +-----------------------+
|
| 25 |
+
* tag_data_r_o: | |
|
| 26 |
+
* -----+ +-----
|
| 27 |
+
*
|
| 28 |
+
* One use case is to write sequence of data from software through bsg_tag_bitbang
|
| 29 |
+
* to bsg tag master. This eliminates the need of dedicated hardware, like a ROM
|
| 30 |
+
* and a tag trace replay module.
|
| 31 |
+
*
|
| 32 |
+
*/
|
| 33 |
+
|
| 34 |
+
module bsg_tag_bitbang(
|
| 35 |
+
input clk_i
|
| 36 |
+
, input reset_i
|
| 37 |
+
, input data_i
|
| 38 |
+
, input v_i
|
| 39 |
+
, output logic ready_and_o // throughput: clk_i / 2
|
| 40 |
+
|
| 41 |
+
// tag clock is a synchronously generated variable frequency clock that toggles
|
| 42 |
+
// once for every data bit that is transmitted.
|
| 43 |
+
, output logic tag_clk_r_o
|
| 44 |
+
, output logic tag_data_r_o
|
| 45 |
+
);
|
| 46 |
+
|
| 47 |
+
logic tag_clk_r;
|
| 48 |
+
logic tag_data_r;
|
| 49 |
+
// Lower tag clock for one cycle upon a successful handshake
|
| 50 |
+
wire tag_clk_n = ~(ready_and_o & v_i);
|
| 51 |
+
|
| 52 |
+
bsg_dff_reset #(
|
| 53 |
+
.width_p(1)
|
| 54 |
+
,.reset_val_p(1)
|
| 55 |
+
) tag_clk_reg (
|
| 56 |
+
.clk_i(clk_i)
|
| 57 |
+
,.reset_i(reset_i)
|
| 58 |
+
,.data_i(tag_clk_n)
|
| 59 |
+
,.data_o(tag_clk_r)
|
| 60 |
+
);
|
| 61 |
+
|
| 62 |
+
bsg_dff_en #(.width_p(1)
|
| 63 |
+
) tag_data_reg (
|
| 64 |
+
.clk_i(clk_i)
|
| 65 |
+
,.data_i(data_i)
|
| 66 |
+
,.en_i(~tag_clk_n)
|
| 67 |
+
,.data_o(tag_data_r)
|
| 68 |
+
);
|
| 69 |
+
|
| 70 |
+
assign tag_data_r_o = tag_data_r;
|
| 71 |
+
assign tag_clk_r_o = tag_clk_r;
|
| 72 |
+
assign ready_and_o = tag_clk_r;
|
| 73 |
+
|
| 74 |
+
endmodule
|
| 75 |
+
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_tag/bsg_tag_client_unsync.sv
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// bsg_tag_client_unsync
|
| 3 |
+
//
|
| 4 |
+
// simple serial on-chip configuration network
|
| 5 |
+
//
|
| 6 |
+
// this client has only the shift register that captures data from the client
|
| 7 |
+
// no attempt is made to perform any synchronzation, or to hide intermediate toggles
|
| 8 |
+
// of bits as values are shifted in.
|
| 9 |
+
//
|
| 10 |
+
// generally speaking, this version should only be used in special cases:
|
| 11 |
+
//
|
| 12 |
+
// - where values are not intended to be updated on the fly as the chip runs;
|
| 13 |
+
// i.e. configuration prior to reset
|
| 14 |
+
//
|
| 15 |
+
// - where receive logic has been explicitly coded separately
|
| 16 |
+
//
|
| 17 |
+
// 5/26/2018 MBT
|
| 18 |
+
//
|
| 19 |
+
//
|
| 20 |
+
// RESET SEMANTICS
|
| 21 |
+
//
|
| 22 |
+
// 1. Shift in the value you want to use.
|
| 23 |
+
// 2. Deassert reset on the receive side module.
|
| 24 |
+
//
|
| 25 |
+
|
| 26 |
+
`include "bsg_defines.sv"
|
| 27 |
+
|
| 28 |
+
module bsg_tag_client_unsync
|
| 29 |
+
import bsg_tag_pkg::bsg_tag_s;
|
| 30 |
+
#(parameter `BSG_INV_PARAM(width_p), harden_p=1, debug_level_lp=0)
|
| 31 |
+
(
|
| 32 |
+
input bsg_tag_s bsg_tag_i
|
| 33 |
+
|
| 34 |
+
,output [width_p-1:0] data_async_r_o
|
| 35 |
+
);
|
| 36 |
+
|
| 37 |
+
logic op_r, param_r;
|
| 38 |
+
|
| 39 |
+
always_ff @(posedge bsg_tag_i.clk)
|
| 40 |
+
begin
|
| 41 |
+
op_r <= bsg_tag_i.op;
|
| 42 |
+
param_r <= bsg_tag_i.param;
|
| 43 |
+
end
|
| 44 |
+
|
| 45 |
+
wire shift_op = op_r;
|
| 46 |
+
wire no_op = ~op_r & ~param_r;
|
| 47 |
+
|
| 48 |
+
logic [width_p-1:0] tag_data_r, tag_data_n, tag_data_shift;
|
| 49 |
+
|
| 50 |
+
// shift in new state
|
| 51 |
+
if (width_p > 1)
|
| 52 |
+
begin : fi
|
| 53 |
+
assign tag_data_shift = { param_r, tag_data_r[width_p-1:1] };
|
| 54 |
+
end
|
| 55 |
+
else
|
| 56 |
+
begin: fi
|
| 57 |
+
assign tag_data_shift = param_r;
|
| 58 |
+
end
|
| 59 |
+
|
| 60 |
+
bsg_mux2_gatestack #(.width_p(width_p),.harden_p(harden_p)) tag_data_mux
|
| 61 |
+
(.i0 (tag_data_r ) // sel=0
|
| 62 |
+
,.i1(tag_data_shift ) // sel=1
|
| 63 |
+
,.i2({ width_p {shift_op} }) // sel var
|
| 64 |
+
,.o (tag_data_n)
|
| 65 |
+
);
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
// Veri lator did not like bsg_dff_gatestack with the replicated clock signal
|
| 69 |
+
// hopefully this replacement does not cause inordinate problems =)
|
| 70 |
+
|
| 71 |
+
bsg_dff #(.width_p(width_p), .harden_p(harden_p)) tag_data_reg
|
| 72 |
+
(.clk_i(bsg_tag_i.clk)
|
| 73 |
+
,.data_i(tag_data_n)
|
| 74 |
+
,.data_o(tag_data_r)
|
| 75 |
+
);
|
| 76 |
+
|
| 77 |
+
/*
|
| 78 |
+
bsg_dff_gatestack #(.width_p(width_p),.harden_p(harden_p)) tag_data_reg
|
| 79 |
+
(
|
| 80 |
+
.i0 (tag_data_n )
|
| 81 |
+
,.i1( { width_p { bsg_tag_i.clk } })
|
| 82 |
+
,.o (tag_data_r )
|
| 83 |
+
);
|
| 84 |
+
*/
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 88 |
+
if (debug_level_lp > 1)
|
| 89 |
+
begin: debug
|
| 90 |
+
wire reset_op = ~op_r & param_r;
|
| 91 |
+
always @(negedge bsg_tag_i.clk)
|
| 92 |
+
begin
|
| 93 |
+
//if (reset_op)
|
| 94 |
+
// $display("## bsg_tag_client RESET HI (%m)");
|
| 95 |
+
if (reset_op & ~(~bsg_tag_i.op & bsg_tag_i.param))
|
| 96 |
+
$display("## bsg_tag_client RESET DEASSERTED time %t (%m)",$time);
|
| 97 |
+
if (~reset_op & (~bsg_tag_i.op & bsg_tag_i.param))
|
| 98 |
+
$display("## bsg_tag_client RESET ASSERTED time %t (%m)",$time);
|
| 99 |
+
if (shift_op)
|
| 100 |
+
$display("## bsg_tag_client (send) SHIFTING %b (%m)",tag_data_r);
|
| 101 |
+
end
|
| 102 |
+
end
|
| 103 |
+
`endif
|
| 104 |
+
|
| 105 |
+
assign data_async_r_o = tag_data_r;
|
| 106 |
+
|
| 107 |
+
endmodule
|
| 108 |
+
|
| 109 |
+
`BSG_ABSTRACT_MODULE(bsg_tag_client_unsync)
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_tag/bsg_tag_master.sv
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// bsg_tag_master
|
| 2 |
+
//
|
| 3 |
+
// 8/30/2016
|
| 4 |
+
//
|
| 5 |
+
// Usage: send a stream of 0's to reset master node and/or noop.
|
| 6 |
+
// Then, send a single <1> followed by a packet:
|
| 7 |
+
// < id > < data_not_reset > < payload length > < payload >
|
| 8 |
+
// ****************************************************************************
|
| 9 |
+
// $clog2(els_p+1) 1 $clog2(max_payload_length+1) (variable size)
|
| 10 |
+
//
|
| 11 |
+
// To reset client nodes, set data_not_reset to 0, and payload to 1's.
|
| 12 |
+
//
|
| 13 |
+
//
|
| 14 |
+
|
| 15 |
+
`include "bsg_defines.sv"
|
| 16 |
+
|
| 17 |
+
`include "bsg_tag.svh"
|
| 18 |
+
|
| 19 |
+
// will not build in verilator without this
|
| 20 |
+
// possibly resulting incorrect behavior :(
|
| 21 |
+
|
| 22 |
+
// verilator lint_off BLKANDNBLK
|
| 23 |
+
|
| 24 |
+
module bsg_tag_master
|
| 25 |
+
import bsg_tag_pkg::bsg_tag_s;
|
| 26 |
+
|
| 27 |
+
// els_p is the number of clients to attach
|
| 28 |
+
// lg_width_p is the number of bits used to describe the payload size
|
| 29 |
+
|
| 30 |
+
#(parameter `BSG_INV_PARAM(els_p), `BSG_INV_PARAM(lg_width_p), debug_level_lp=2)
|
| 31 |
+
(
|
| 32 |
+
// from pins
|
| 33 |
+
input clk_i
|
| 34 |
+
,input en_i
|
| 35 |
+
,input data_i
|
| 36 |
+
, output bsg_tag_s [els_p-1:0] clients_r_o
|
| 37 |
+
);
|
| 38 |
+
|
| 39 |
+
`declare_bsg_tag_header_s(els_p,lg_width_p)
|
| 40 |
+
|
| 41 |
+
localparam max_packet_len_lp = `bsg_tag_max_packet_len(els_p,lg_width_p);
|
| 42 |
+
|
| 43 |
+
localparam reset_len_lp = `bsg_tag_reset_len(els_p,lg_width_p);
|
| 44 |
+
|
| 45 |
+
// counts 0..max_packet_len_lp
|
| 46 |
+
localparam lg_max_packet_len_lp = `BSG_SAFE_CLOG2(max_packet_len_lp+1);
|
| 47 |
+
|
| 48 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 49 |
+
if (debug_level_lp > 2)
|
| 50 |
+
always @(negedge clk_i)
|
| 51 |
+
$display("## bsg_tag_master clients=%b (%m)",clients_r_o);
|
| 52 |
+
`endif
|
| 53 |
+
|
| 54 |
+
logic data_i_r;
|
| 55 |
+
|
| 56 |
+
always @(posedge clk_i)
|
| 57 |
+
data_i_r <= data_i;
|
| 58 |
+
|
| 59 |
+
// ***************************
|
| 60 |
+
// RESET LOGIC
|
| 61 |
+
// extra bit to detect carry out in counter
|
| 62 |
+
|
| 63 |
+
localparam ctr_width_lp = lg_max_packet_len_lp+1;
|
| 64 |
+
logic [ctr_width_lp-1:0] zeros_ctr_r;
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
wire tag_reset_req = zeros_ctr_r[ctr_width_lp-1];
|
| 68 |
+
|
| 69 |
+
// this self-clearing counter detects a certain number
|
| 70 |
+
// of consecutive 0's
|
| 71 |
+
// indicating a tag_master reset condition
|
| 72 |
+
//
|
| 73 |
+
|
| 74 |
+
bsg_counter_clear_up #(.max_val_p((1 << ctr_width_lp)-1)
|
| 75 |
+
,.init_val_p(0)
|
| 76 |
+
) bccu
|
| 77 |
+
(.clk_i (clk_i)
|
| 78 |
+
,.reset_i(1'b0)
|
| 79 |
+
// we clear the counter if we hit the limit
|
| 80 |
+
,.clear_i(data_i_r | tag_reset_req)
|
| 81 |
+
,.up_i (~data_i_r)
|
| 82 |
+
,.count_o(zeros_ctr_r)
|
| 83 |
+
);
|
| 84 |
+
|
| 85 |
+
// veri lator doesn't support -d
|
| 86 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 87 |
+
initial
|
| 88 |
+
$display("## %m instantiating bsg_tag_master with els_p=%d, lg_width_p=%d, max_packet_len_lp=%d, reset_zero_len=%d"
|
| 89 |
+
,els_p,lg_width_p,max_packet_len_lp,reset_len_lp);
|
| 90 |
+
`endif
|
| 91 |
+
|
| 92 |
+
//
|
| 93 |
+
// END RESET LOGIC
|
| 94 |
+
// ***************************
|
| 95 |
+
|
| 96 |
+
logic [lg_max_packet_len_lp-1:0] hdr_ptr_r, hdr_ptr_n;
|
| 97 |
+
bsg_tag_header_s hdr_r, hdr_n;
|
| 98 |
+
|
| 99 |
+
// sending
|
| 100 |
+
logic v_n;
|
| 101 |
+
// value to send
|
| 102 |
+
bsg_tag_s bsg_tag_n;
|
| 103 |
+
|
| 104 |
+
typedef enum logic [1:0] {eStart, eHeader, eTransfer, eStuck} state_e;
|
| 105 |
+
|
| 106 |
+
state_e state_r, state_n;
|
| 107 |
+
|
| 108 |
+
// synopsys sync_set_reset "tag_reset_req, data_i_r"
|
| 109 |
+
|
| 110 |
+
always_ff @(posedge clk_i)
|
| 111 |
+
// if we hit the counter AND (subtle bug) there is no valid incoming data that would get lost
|
| 112 |
+
if (tag_reset_req & ~data_i_r)
|
| 113 |
+
begin
|
| 114 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 115 |
+
if (debug_level_lp > 2) $display("## bsg_tag_master RESET time %t (%m)",$time);
|
| 116 |
+
`endif
|
| 117 |
+
state_r <= eStart;
|
| 118 |
+
|
| 119 |
+
// we put this here because DC did not currently infer "reset" logic
|
| 120 |
+
hdr_ptr_r <= 0;
|
| 121 |
+
end
|
| 122 |
+
else
|
| 123 |
+
begin
|
| 124 |
+
state_r <= state_n;
|
| 125 |
+
hdr_ptr_r <= hdr_ptr_n;
|
| 126 |
+
end
|
| 127 |
+
|
| 128 |
+
always_ff @(posedge clk_i)
|
| 129 |
+
hdr_r <= hdr_n;
|
| 130 |
+
|
| 131 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 132 |
+
always_ff @(negedge clk_i)
|
| 133 |
+
if (state_n != state_r)
|
| 134 |
+
if (debug_level_lp > 1) $display("## bsg_tag_master STATE CHANGE # %s --> %s #",state_r.name(),state_n.name());
|
| 135 |
+
`endif
|
| 136 |
+
|
| 137 |
+
always_comb
|
| 138 |
+
begin
|
| 139 |
+
state_n = state_r;
|
| 140 |
+
hdr_ptr_n = hdr_ptr_r;
|
| 141 |
+
hdr_n = hdr_r;
|
| 142 |
+
|
| 143 |
+
// outgoing
|
| 144 |
+
v_n = 1'b0;
|
| 145 |
+
bsg_tag_n.op = 1'b0;
|
| 146 |
+
bsg_tag_n.param = 1'b0;
|
| 147 |
+
|
| 148 |
+
case (state_r)
|
| 149 |
+
// first 1 after zero indicates beginning of packet
|
| 150 |
+
eStart:
|
| 151 |
+
begin
|
| 152 |
+
if (data_i_r)
|
| 153 |
+
state_n = eHeader;
|
| 154 |
+
|
| 155 |
+
hdr_ptr_n = 0;
|
| 156 |
+
hdr_n = 0;
|
| 157 |
+
end
|
| 158 |
+
eHeader:
|
| 159 |
+
begin
|
| 160 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 161 |
+
if (debug_level_lp > 1)
|
| 162 |
+
$display("## bsg_tag_master RECEIVING HEADER (%m) (%d) = %b",hdr_ptr_r,data_i_r);
|
| 163 |
+
`endif
|
| 164 |
+
|
| 165 |
+
hdr_n = { data_i_r, hdr_r[1+:($bits(bsg_tag_header_s)-1)] };
|
| 166 |
+
hdr_ptr_n = hdr_ptr_r + 1'b1;
|
| 167 |
+
// if we are at the next to last value
|
| 168 |
+
if (hdr_ptr_r == lg_max_packet_len_lp'($bits(bsg_tag_header_s)-1))
|
| 169 |
+
begin
|
| 170 |
+
if (hdr_n.len == 0)
|
| 171 |
+
begin
|
| 172 |
+
state_n = eStart;
|
| 173 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 174 |
+
$display("## bsg_tag_master NULL PACKET, len=0 (%m)");
|
| 175 |
+
`endif
|
| 176 |
+
end
|
| 177 |
+
else
|
| 178 |
+
begin
|
| 179 |
+
|
| 180 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 181 |
+
if (debug_level_lp > 1)
|
| 182 |
+
$display("## bsg_tag_master PACKET HEADER RECEIVED (length=%b,data_not_reset=%b,nodeID=%b) (%m) "
|
| 183 |
+
,hdr_n.len,hdr_n.data_not_reset,hdr_n.nodeID);
|
| 184 |
+
`endif
|
| 185 |
+
|
| 186 |
+
// if we have data to transfer go to transfer state
|
| 187 |
+
state_n = eTransfer;
|
| 188 |
+
end
|
| 189 |
+
end
|
| 190 |
+
end // case: eHeader
|
| 191 |
+
eTransfer:
|
| 192 |
+
begin
|
| 193 |
+
// transmit data
|
| 194 |
+
// if hdr_r.reset = 1, then we send <0,data> for hdr_r.len cycles
|
| 195 |
+
// otherwise we send <1,data> for hdr_r.len cycles
|
| 196 |
+
// typically for reset, we will send 1's.
|
| 197 |
+
|
| 198 |
+
v_n = 1'b1;
|
| 199 |
+
bsg_tag_n.op = hdr_r.data_not_reset;
|
| 200 |
+
bsg_tag_n.param = data_i_r;
|
| 201 |
+
|
| 202 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 203 |
+
if (debug_level_lp > 2)
|
| 204 |
+
$display("## bsg_tag_master PACKET TRANSFER op,param=<%b,%b> (%m)", bsg_tag_n.op, bsg_tag_n.param);
|
| 205 |
+
`endif
|
| 206 |
+
|
| 207 |
+
// finishing words
|
| 208 |
+
if (hdr_r.len== lg_width_p ' (1))
|
| 209 |
+
begin
|
| 210 |
+
state_n = eStart;
|
| 211 |
+
|
| 212 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 213 |
+
if (debug_level_lp > 1) $display("## bsg_tag_master PACKET END (%m)");
|
| 214 |
+
`endif
|
| 215 |
+
|
| 216 |
+
end
|
| 217 |
+
hdr_n.len = hdr_r.len - 1;
|
| 218 |
+
end
|
| 219 |
+
eStuck:
|
| 220 |
+
state_n = eStuck;
|
| 221 |
+
|
| 222 |
+
default:
|
| 223 |
+
begin
|
| 224 |
+
state_n = eStuck;
|
| 225 |
+
|
| 226 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 227 |
+
$display("## bsg_tag_master transitioning to error state; be sure to run gate-level netlist to avoid sim/synth mismatch (%m)");
|
| 228 |
+
`endif
|
| 229 |
+
|
| 230 |
+
end
|
| 231 |
+
endcase // case (state_r)
|
| 232 |
+
|
| 233 |
+
end // always_comb
|
| 234 |
+
|
| 235 |
+
genvar i;
|
| 236 |
+
|
| 237 |
+
// demultiplex the stream to the target node
|
| 238 |
+
|
| 239 |
+
wire [els_p-1:0] clients_decode = (v_n << hdr_r.nodeID);
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
for (i = 0; i < els_p; i=i+1)
|
| 243 |
+
begin: rof
|
| 244 |
+
always_ff @(posedge clk_i)
|
| 245 |
+
begin
|
| 246 |
+
clients_r_o[i].op <= clients_decode[i] & bsg_tag_n.op;
|
| 247 |
+
clients_r_o[i].param <= clients_decode[i] & bsg_tag_n.param;
|
| 248 |
+
end
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
assign clients_r_o[i].clk = clk_i;
|
| 252 |
+
assign clients_r_o[i].en = en_i;
|
| 253 |
+
end
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
endmodule // bsg_tag_master
|
| 257 |
+
|
| 258 |
+
`BSG_ABSTRACT_MODULE(bsg_tag_master)
|
| 259 |
+
|
| 260 |
+
// verilator lint_on BLKANDNBLK
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_tag/bsg_tag_master_decentralized.sv
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// bsg_tag_master
|
| 2 |
+
//
|
| 3 |
+
// 8/30/2016
|
| 4 |
+
//
|
| 5 |
+
// Usage: send a stream of 0's to reset master node and/or noop.
|
| 6 |
+
// Then, send a single <1> followed by a packet:
|
| 7 |
+
// < id > < data_not_reset > < payload length > < payload >
|
| 8 |
+
// ****************************************************************************
|
| 9 |
+
// $clog2(els_p+1) 1 $clog2(max_payload_length+1) (variable size)
|
| 10 |
+
//
|
| 11 |
+
// To reset client nodes, set data_not_reset to 0, and payload to 1's.
|
| 12 |
+
//
|
| 13 |
+
//
|
| 14 |
+
|
| 15 |
+
`include "bsg_defines.sv"
|
| 16 |
+
|
| 17 |
+
`include "bsg_tag.svh"
|
| 18 |
+
|
| 19 |
+
// will not build in verilator without this
|
| 20 |
+
// possibly resulting incorrect behavior :(
|
| 21 |
+
|
| 22 |
+
// verilator lint_off BLKANDNBLK
|
| 23 |
+
|
| 24 |
+
module bsg_tag_master_decentralized
|
| 25 |
+
import bsg_tag_pkg::bsg_tag_s;
|
| 26 |
+
|
| 27 |
+
// els_p is the maximum number of clients supported in system
|
| 28 |
+
// local_els_p is the number of clients to attach
|
| 29 |
+
// lg_width_p is the number of bits used to describe the payload size
|
| 30 |
+
|
| 31 |
+
#(`BSG_INV_PARAM(els_p)
|
| 32 |
+
,`BSG_INV_PARAM(local_els_p)
|
| 33 |
+
,`BSG_INV_PARAM(lg_width_p)
|
| 34 |
+
,debug_level_lp=1
|
| 35 |
+
,lg_els_lp=`BSG_SAFE_CLOG2(els_p)
|
| 36 |
+
,lg_local_els_lp=`BSG_SAFE_CLOG2(local_els_p)
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
(
|
| 40 |
+
// from pins
|
| 41 |
+
input clk_i
|
| 42 |
+
,input data_i
|
| 43 |
+
// node_id_offset_i is used to filter incoming packets.
|
| 44 |
+
// packets with nodeID < node_id_offset_i or nodeID >= node_id_offset_i+local_els_p
|
| 45 |
+
// will be ignored.
|
| 46 |
+
,input [lg_els_lp-1:0] node_id_offset_i
|
| 47 |
+
,output bsg_tag_s [local_els_p-1:0] clients_o
|
| 48 |
+
);
|
| 49 |
+
|
| 50 |
+
`declare_bsg_tag_header_s(els_p,lg_width_p)
|
| 51 |
+
|
| 52 |
+
localparam max_packet_len_lp = `bsg_tag_max_packet_len(els_p,lg_width_p);
|
| 53 |
+
|
| 54 |
+
localparam reset_len_lp = `bsg_tag_reset_len(els_p,lg_width_p);
|
| 55 |
+
|
| 56 |
+
// counts 0..max_packet_len_lp
|
| 57 |
+
localparam lg_max_packet_len_lp = `BSG_SAFE_CLOG2(max_packet_len_lp+1);
|
| 58 |
+
|
| 59 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 60 |
+
if (debug_level_lp > 2)
|
| 61 |
+
always @(negedge clk_i)
|
| 62 |
+
$display("## bsg_tag_master clients=%b (%m)",clients_o);
|
| 63 |
+
`endif
|
| 64 |
+
|
| 65 |
+
logic data_i_r;
|
| 66 |
+
|
| 67 |
+
always @(posedge clk_i)
|
| 68 |
+
data_i_r <= data_i;
|
| 69 |
+
|
| 70 |
+
// ***************************
|
| 71 |
+
// RESET LOGIC
|
| 72 |
+
// extra bit to detect carry out in counter
|
| 73 |
+
|
| 74 |
+
localparam ctr_width_lp = lg_max_packet_len_lp+1;
|
| 75 |
+
logic [ctr_width_lp-1:0] zeros_ctr_r;
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
wire tag_reset_req = zeros_ctr_r[ctr_width_lp-1];
|
| 79 |
+
|
| 80 |
+
// this self-clearing counter detects a certain number
|
| 81 |
+
// of consecutive 0's
|
| 82 |
+
// indicating a tag_master reset condition
|
| 83 |
+
//
|
| 84 |
+
|
| 85 |
+
bsg_counter_clear_up #(.max_val_p((1 << ctr_width_lp)-1)
|
| 86 |
+
,.init_val_p(0)
|
| 87 |
+
) bccu
|
| 88 |
+
(.clk_i (clk_i)
|
| 89 |
+
,.reset_i(1'b0)
|
| 90 |
+
// we clear the counter if we hit the limit
|
| 91 |
+
,.clear_i(data_i_r | tag_reset_req)
|
| 92 |
+
,.up_i (~data_i_r)
|
| 93 |
+
,.count_o(zeros_ctr_r)
|
| 94 |
+
);
|
| 95 |
+
|
| 96 |
+
// veri lator doesn't support -d
|
| 97 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 98 |
+
initial
|
| 99 |
+
$display("## %m instantiating bsg_tag_master_decentralized with els_p=%d, local_els_p=%d, lg_width_p=%d, max_packet_len_lp=%d, reset_zero_len=%d"
|
| 100 |
+
,els_p,local_els_p,lg_width_p,max_packet_len_lp,reset_len_lp);
|
| 101 |
+
`endif
|
| 102 |
+
|
| 103 |
+
//
|
| 104 |
+
// END RESET LOGIC
|
| 105 |
+
// ***************************
|
| 106 |
+
|
| 107 |
+
logic [lg_max_packet_len_lp-1:0] hdr_ptr_r, hdr_ptr_n;
|
| 108 |
+
bsg_tag_header_s hdr_r, hdr_n;
|
| 109 |
+
|
| 110 |
+
// sending
|
| 111 |
+
logic v_n;
|
| 112 |
+
// value to send
|
| 113 |
+
bsg_tag_s bsg_tag_n;
|
| 114 |
+
|
| 115 |
+
typedef enum logic [1:0] {eStart, eHeader, eTransfer, eStuck} state_e;
|
| 116 |
+
|
| 117 |
+
state_e state_r, state_n;
|
| 118 |
+
|
| 119 |
+
// synopsys sync_set_reset "tag_reset_req, data_i_r"
|
| 120 |
+
|
| 121 |
+
always_ff @(posedge clk_i)
|
| 122 |
+
// if we hit the counter AND (subtle bug) there is no valid incoming data that would get lost
|
| 123 |
+
if (tag_reset_req & ~data_i_r)
|
| 124 |
+
begin
|
| 125 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 126 |
+
if (debug_level_lp > 2) $display("## bsg_tag_master RESET time %t (%m)",$time);
|
| 127 |
+
`endif
|
| 128 |
+
state_r <= eStart;
|
| 129 |
+
|
| 130 |
+
// we put this here because DC did not currently infer "reset" logic
|
| 131 |
+
hdr_ptr_r <= 0;
|
| 132 |
+
end
|
| 133 |
+
else
|
| 134 |
+
begin
|
| 135 |
+
state_r <= state_n;
|
| 136 |
+
hdr_ptr_r <= hdr_ptr_n;
|
| 137 |
+
end
|
| 138 |
+
|
| 139 |
+
always_ff @(posedge clk_i)
|
| 140 |
+
hdr_r <= hdr_n;
|
| 141 |
+
|
| 142 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 143 |
+
always_ff @(negedge clk_i)
|
| 144 |
+
if (state_n != state_r)
|
| 145 |
+
if (debug_level_lp > 1) $display("## bsg_tag_master STATE CHANGE # %s --> %s #",state_r.name(),state_n.name());
|
| 146 |
+
`endif
|
| 147 |
+
|
| 148 |
+
always_comb
|
| 149 |
+
begin
|
| 150 |
+
state_n = state_r;
|
| 151 |
+
hdr_ptr_n = hdr_ptr_r;
|
| 152 |
+
hdr_n = hdr_r;
|
| 153 |
+
|
| 154 |
+
// outgoing
|
| 155 |
+
v_n = 1'b0;
|
| 156 |
+
bsg_tag_n.op = 1'b0;
|
| 157 |
+
bsg_tag_n.param = 1'b0;
|
| 158 |
+
|
| 159 |
+
case (state_r)
|
| 160 |
+
// first 1 after zero indicates beginning of packet
|
| 161 |
+
eStart:
|
| 162 |
+
begin
|
| 163 |
+
if (data_i_r)
|
| 164 |
+
state_n = eHeader;
|
| 165 |
+
|
| 166 |
+
hdr_ptr_n = 0;
|
| 167 |
+
hdr_n = 0;
|
| 168 |
+
end
|
| 169 |
+
eHeader:
|
| 170 |
+
begin
|
| 171 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 172 |
+
if (debug_level_lp > 1)
|
| 173 |
+
$display("## bsg_tag_master RECEIVING HEADER (%m) (%d) = %b",hdr_ptr_r,data_i_r);
|
| 174 |
+
`endif
|
| 175 |
+
|
| 176 |
+
hdr_n = { data_i_r, hdr_r[1+:($bits(bsg_tag_header_s)-1)] };
|
| 177 |
+
hdr_ptr_n = hdr_ptr_r + 1'b1;
|
| 178 |
+
// if we are at the next to last value
|
| 179 |
+
if (hdr_ptr_r == lg_max_packet_len_lp'($bits(bsg_tag_header_s)-1))
|
| 180 |
+
begin
|
| 181 |
+
if (hdr_n.len == 0)
|
| 182 |
+
begin
|
| 183 |
+
state_n = eStart;
|
| 184 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 185 |
+
$display("## bsg_tag_master NULL PACKET, len=0 (%m)");
|
| 186 |
+
`endif
|
| 187 |
+
end
|
| 188 |
+
else
|
| 189 |
+
begin
|
| 190 |
+
|
| 191 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 192 |
+
if (debug_level_lp > 1)
|
| 193 |
+
$display("## bsg_tag_master PACKET HEADER RECEIVED (length=%b,data_not_reset=%b,nodeID=%b) (%m) "
|
| 194 |
+
,hdr_n.len,hdr_n.data_not_reset,hdr_n.nodeID);
|
| 195 |
+
`endif
|
| 196 |
+
|
| 197 |
+
// if we have data to transfer go to transfer state
|
| 198 |
+
state_n = eTransfer;
|
| 199 |
+
end
|
| 200 |
+
end
|
| 201 |
+
end // case: eHeader
|
| 202 |
+
eTransfer:
|
| 203 |
+
begin
|
| 204 |
+
// transmit data
|
| 205 |
+
// if hdr_r.reset = 1, then we send <0,data> for hdr_r.len cycles
|
| 206 |
+
// otherwise we send <1,data> for hdr_r.len cycles
|
| 207 |
+
// typically for reset, we will send 1's.
|
| 208 |
+
|
| 209 |
+
v_n = 1'b1;
|
| 210 |
+
bsg_tag_n.op = hdr_r.data_not_reset;
|
| 211 |
+
bsg_tag_n.param = data_i_r;
|
| 212 |
+
|
| 213 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 214 |
+
if (debug_level_lp > 2)
|
| 215 |
+
$display("## bsg_tag_master PACKET TRANSFER op,param=<%b,%b> (%m)", bsg_tag_n.op, bsg_tag_n.param);
|
| 216 |
+
`endif
|
| 217 |
+
|
| 218 |
+
// finishing words
|
| 219 |
+
if (hdr_r.len== lg_width_p ' (1))
|
| 220 |
+
begin
|
| 221 |
+
state_n = eStart;
|
| 222 |
+
|
| 223 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 224 |
+
if (debug_level_lp > 1) $display("## bsg_tag_master PACKET END (%m)");
|
| 225 |
+
`endif
|
| 226 |
+
|
| 227 |
+
end
|
| 228 |
+
hdr_n.len = hdr_r.len - 1;
|
| 229 |
+
end
|
| 230 |
+
eStuck:
|
| 231 |
+
state_n = eStuck;
|
| 232 |
+
|
| 233 |
+
default:
|
| 234 |
+
begin
|
| 235 |
+
state_n = eStuck;
|
| 236 |
+
|
| 237 |
+
`ifndef BSG_HIDE_FROM_SYNTHESIS
|
| 238 |
+
$display("## bsg_tag_master transitioning to error state; be sure to run gate-level netlist to avoid sim/synth mismatch (%m)");
|
| 239 |
+
`endif
|
| 240 |
+
|
| 241 |
+
end
|
| 242 |
+
endcase // case (state_r)
|
| 243 |
+
|
| 244 |
+
end // always_comb
|
| 245 |
+
|
| 246 |
+
genvar i;
|
| 247 |
+
|
| 248 |
+
// calculate local nodeID
|
| 249 |
+
// must have lg_els_lp bits to prevent overflow
|
| 250 |
+
// (underflow is okay in this case)
|
| 251 |
+
wire [lg_els_lp-1:0] local_node_id = hdr_r.nodeID - node_id_offset_i;
|
| 252 |
+
|
| 253 |
+
// demultiplex the stream to the target node
|
| 254 |
+
// use only lg_local_els_lp bits to simplify decoder logic
|
| 255 |
+
wire [local_els_p-1:0] clients_decode = (v_n << local_node_id[lg_local_els_lp-1:0]);
|
| 256 |
+
|
| 257 |
+
// determine if incoming packet is within the nodeID range
|
| 258 |
+
wire node_id_above_offset = (hdr_r.nodeID >= node_id_offset_i);
|
| 259 |
+
wire local_node_id_below_limit = (local_node_id < local_els_p);
|
| 260 |
+
wire node_id_match = (node_id_above_offset && local_node_id_below_limit);
|
| 261 |
+
|
| 262 |
+
// output to bsg_tag_clients directly without flops
|
| 263 |
+
for (i = 0; i < local_els_p; i=i+1)
|
| 264 |
+
begin: rof
|
| 265 |
+
assign clients_o[i].clk = clk_i;
|
| 266 |
+
assign clients_o[i].op = node_id_match & clients_decode[i] & bsg_tag_n.op;
|
| 267 |
+
assign clients_o[i].param = node_id_match & clients_decode[i] & bsg_tag_n.param;
|
| 268 |
+
assign clients_o[i].en = 1'b1;
|
| 269 |
+
end
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
endmodule // bsg_tag_master
|
| 273 |
+
|
| 274 |
+
`BSG_ABSTRACT_MODULE(bsg_tag_master_decentralized)
|
| 275 |
+
|
| 276 |
+
// verilator lint_on BLKANDNBLK
|
snapshots/bespoke-silicon-group_basejump_stl_pr706/bsg_tag/bsg_tag_pkg.sv
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package bsg_tag_pkg;
|
| 2 |
+
typedef struct packed {
|
| 3 |
+
logic clk;
|
| 4 |
+
// op param
|
| 5 |
+
logic op; // 1 D shift D
|
| 6 |
+
logic param; // 0 0 nop (also "send", immediately after shift operation)
|
| 7 |
+
// 0 1 reset
|
| 8 |
+
|
| 9 |
+
logic en; // this signal disables thru-transmit of new values
|
| 10 |
+
} bsg_tag_s;
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
endpackage // bsg_tag_pkg
|
| 14 |
+
|
| 15 |
+
|