Line 19... |
Line 19... |
//LINE RING Topology p=3
|
//LINE RING Topology p=3
|
localparam FORWARD = 1,
|
localparam FORWARD = 1,
|
BACKWARD= 2;
|
BACKWARD= 2;
|
|
|
|
|
|
|
function automatic integer log2;
|
function automatic integer log2;
|
input integer number; begin
|
input integer number; begin
|
log2=(number <=1) ? 1: 0;
|
log2=(number <=1) ? 1: 0;
|
while(2**log2<number) begin
|
while(2**log2<number) begin
|
log2=log2+1;
|
log2=log2+1;
|
Line 108... |
Line 107... |
end
|
end
|
end
|
end
|
endfunction
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
/*******************
|
/*******************
|
* "RING" "LINE" "MESH" TORUS" "FMESH"
|
* "RING" "LINE" "MESH" TORUS" "FMESH"
|
******************/
|
******************/
|
|
|
|
|
|
|
|
|
/* verilator lint_off WIDTH */
|
/* verilator lint_off WIDTH */
|
//route type
|
//route type
|
localparam
|
localparam
|
NX = T1,
|
NX = T1,
|
NY = T2,
|
NY = T2,
|
Line 136... |
Line 140... |
EAw_MESH_TORI = (NL==1) ? RAw_MESH_TORI : RAw_MESH_TORI + NLw,
|
EAw_MESH_TORI = (NL==1) ? RAw_MESH_TORI : RAw_MESH_TORI + NLw,
|
NR_MESH_TORI = (TOPOLOGY=="RING" || TOPOLOGY=="LINE")? NX : NX*NY,
|
NR_MESH_TORI = (TOPOLOGY=="RING" || TOPOLOGY=="LINE")? NX : NX*NY,
|
NE_MESH_TORI = NR_MESH_TORI * NL,
|
NE_MESH_TORI = NR_MESH_TORI * NL,
|
MAX_P_MESH_TORI = R2R_CHANELS_MESH_TORI + R2E_CHANELS_MESH_TORI,
|
MAX_P_MESH_TORI = R2R_CHANELS_MESH_TORI + R2E_CHANELS_MESH_TORI,
|
DSTPw_MESH_TORI = R2R_CHANELS_MESH_TORI; // P-1
|
DSTPw_MESH_TORI = R2R_CHANELS_MESH_TORI; // P-1
|
|
|
/* verilator lint_on WIDTH */
|
/* verilator lint_on WIDTH */
|
|
|
/****************
|
/****************
|
* FMESH
|
* FMESH
|
* *************/
|
* *************/
|
Line 148... |
Line 153... |
NR_FMESH = NR_MESH_TORI,
|
NR_FMESH = NR_MESH_TORI,
|
MAX_P_FMESH = 4 + NL,
|
MAX_P_FMESH = 4 + NL,
|
EAw_FMESH = RAw_MESH_TORI + log2(MAX_P_FMESH);
|
EAw_FMESH = RAw_MESH_TORI + log2(MAX_P_FMESH);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************
|
/******************
|
* FATTREE
|
* FATTREE
|
* *****************/
|
* *****************/
|
localparam
|
localparam
|
K=T1,
|
K=T1,
|
Line 168... |
Line 168... |
EAw_FATTREE = LKw,
|
EAw_FATTREE = LKw,
|
NE_FATTREE = powi( K,L ),
|
NE_FATTREE = powi( K,L ),
|
NR_FATTREE = L * powi( K , L - 1 ), // total number of routers
|
NR_FATTREE = L * powi( K , L - 1 ), // total number of routers
|
ROUTE_TYPE_FATTREE = "DETERMINISTIC",
|
ROUTE_TYPE_FATTREE = "DETERMINISTIC",
|
DSTPw_FATTREE = K+1,
|
DSTPw_FATTREE = K+1,
|
MAX_P_FATTREE = 2*K;
|
MAX_P_FATTREE = 2*K,
|
|
DAw_MCAST_FATTREE= powi( K,L);
|
|
|
|
|
|
|
/**********************
|
/**********************
|
* TREE
|
* TREE
|
Line 182... |
Line 183... |
NE_TREE = powi( K,L ), //total number of endpoints
|
NE_TREE = powi( K,L ), //total number of endpoints
|
NR_TREE = sum_powi ( K,L ), // total number of routers
|
NR_TREE = sum_powi ( K,L ), // total number of routers
|
RAw_TREE = LKw + Lw,
|
RAw_TREE = LKw + Lw,
|
EAw_TREE = LKw,
|
EAw_TREE = LKw,
|
DSTPw_TREE = log2(K+1),
|
DSTPw_TREE = log2(K+1),
|
MAX_P_TREE = K+1;
|
MAX_P_TREE = K+1,
|
|
DAw_MCAST_TREE= DAw_MCAST_FATTREE;
|
|
|
|
|
/*********************
|
/*********************
|
* STAR
|
* STAR
|
* ******************/
|
* ******************/
|
Line 195... |
Line 197... |
NE_STAR = T1, //total number of endpoints
|
NE_STAR = T1, //total number of endpoints
|
NR_STAR = 1, // total number of routers
|
NR_STAR = 1, // total number of routers
|
RAw_STAR = 1,
|
RAw_STAR = 1,
|
EAw_STAR = log2(NE_STAR),
|
EAw_STAR = log2(NE_STAR),
|
DSTPw_STAR = EAw_STAR,
|
DSTPw_STAR = EAw_STAR,
|
MAX_P_STAR = NE_STAR;
|
MAX_P_STAR = NE_STAR,
|
|
DAw_MCAST_STAR= NE_STAR;
|
|
|
/************************
|
/************************
|
* CUSTOM - made by netmaker
|
* CUSTOM - made by netmaker
|
* **********************/
|
* **********************/
|
localparam
|
localparam
|
Line 210... |
Line 213... |
RAw_CUSTOM = log2(NR_CUSTOM),
|
RAw_CUSTOM = log2(NR_CUSTOM),
|
MAX_P_CUSTOM = T3,
|
MAX_P_CUSTOM = T3,
|
DSTPw_CUSTOM = log2(MAX_P_CUSTOM);
|
DSTPw_CUSTOM = log2(MAX_P_CUSTOM);
|
|
|
|
|
|
|
/* verilator lint_off WIDTH */
|
/* verilator lint_off WIDTH */
|
localparam
|
localparam
|
PPSw = PPSw_MESH_TORI,
|
PPSw = PPSw_MESH_TORI,
|
// maximum number of port in a router in the topology
|
// maximum number of port in a router in the topology
|
MAX_P =
|
MAX_P =
|
Line 224... |
Line 228... |
(TOPOLOGY == "STAR") ? MAX_P_STAR:
|
(TOPOLOGY == "STAR") ? MAX_P_STAR:
|
MAX_P_CUSTOM,
|
MAX_P_CUSTOM,
|
|
|
// destination port width in header flit
|
// destination port width in header flit
|
DSTPw =
|
DSTPw =
|
// (CAST_TYPE!= "UNICAST")? MAX_P: // Each asserted bit indicats that the flit should be sent to that port
|
// Each asserted bit indicats that the flit should be sent to that port
|
(TOPOLOGY == "FATTREE")? DSTPw_FATTREE:
|
(TOPOLOGY == "FATTREE")? DSTPw_FATTREE:
|
(TOPOLOGY == "TREE")? DSTPw_TREE:
|
(TOPOLOGY == "TREE")? DSTPw_TREE:
|
|
(CAST_TYPE!= "UNICAST")? MAX_P:
|
(TOPOLOGY == "RING" || TOPOLOGY == "LINE" || TOPOLOGY == "MESH" || TOPOLOGY == "TORUS")? DSTPw_MESH_TORI:
|
(TOPOLOGY == "RING" || TOPOLOGY == "LINE" || TOPOLOGY == "MESH" || TOPOLOGY == "TORUS")? DSTPw_MESH_TORI:
|
(TOPOLOGY == "FMESH")? DSTPw_MESH_TORI:
|
(TOPOLOGY == "FMESH")? DSTPw_MESH_TORI:
|
(TOPOLOGY == "STAR") ? DSTPw_STAR:
|
(TOPOLOGY == "STAR") ? DSTPw_STAR:
|
DSTPw_CUSTOM,
|
DSTPw_CUSTOM,
|
//router address width
|
//router address width
|
Line 255... |
Line 260... |
(TOPOLOGY == "TREE")? NE_TREE:
|
(TOPOLOGY == "TREE")? NE_TREE:
|
(TOPOLOGY == "RING" || TOPOLOGY == "LINE" || TOPOLOGY == "MESH" || TOPOLOGY == "TORUS")? NE_MESH_TORI:
|
(TOPOLOGY == "RING" || TOPOLOGY == "LINE" || TOPOLOGY == "MESH" || TOPOLOGY == "TORUS")? NE_MESH_TORI:
|
(TOPOLOGY == "FMESH")? NE_FMESH:
|
(TOPOLOGY == "FMESH")? NE_FMESH:
|
(TOPOLOGY == "STAR")? NE_STAR:
|
(TOPOLOGY == "STAR")? NE_STAR:
|
NE_CUSTOM,
|
NE_CUSTOM,
|
|
|
|
//Destination endpoint(s) address width
|
|
|
|
|
|
DAw_OFFSETw = (TOPOLOGY=="MESH" || TOPOLOGY=="TORUS" || TOPOLOGY=="FMESH")? NX : 0,
|
|
|
|
MCAST_PRTLw = mcast_partial_width( MCAST_ENDP_LIST),
|
|
|
|
MCASTw =
|
|
(CAST_TYPE == "MULTICAST_FULL") ? NE :
|
|
(CAST_TYPE == "MULTICAST_PARTIAL" && EAw >= MCAST_PRTLw) ? EAw +1 :
|
|
(CAST_TYPE == "MULTICAST_PARTIAL" && EAw < MCAST_PRTLw) ? MCAST_PRTLw +1 :
|
|
EAw +1, //broadcast
|
|
|
|
DAw =
|
|
(CAST_TYPE == "UNICAST") ? EAw:
|
|
MCASTw + DAw_OFFSETw,
|
|
|
|
|
|
|
|
|
//total number of routers
|
//total number of routers
|
NR =
|
NR =
|
(TOPOLOGY == "FATTREE")? NR_FATTREE:
|
(TOPOLOGY == "FATTREE")? NR_FATTREE:
|
(TOPOLOGY == "TREE")? NR_TREE:
|
(TOPOLOGY == "TREE")? NR_TREE:
|
(TOPOLOGY == "RING" || TOPOLOGY == "LINE" || TOPOLOGY == "MESH" || TOPOLOGY == "TORUS")? NR_MESH_TORI:
|
(TOPOLOGY == "RING" || TOPOLOGY == "LINE" || TOPOLOGY == "MESH" || TOPOLOGY == "TORUS")? NR_MESH_TORI:
|
Line 278... |
Line 304... |
|
|
|
|
|
|
|
|
|
|
|
|
|
function automatic integer mcast_id_to_endp_id;
|
|
input integer mcast_id;
|
|
reg [NE-1 : 0] mcast_list;
|
|
integer k;
|
|
begin
|
|
mcast_list =MCAST_ENDP_LIST;
|
|
mcast_id_to_endp_id=0;
|
|
k=0;
|
|
/* verilator lint_off WIDTH */
|
|
if (CAST_TYPE == "MULTICAST_FULL")begin
|
|
/* verilator lint_on WIDTH */
|
|
mcast_id_to_endp_id =mcast_id;
|
|
end else begin
|
|
while( k!=mcast_id+1) begin
|
|
if( mcast_list[mcast_id_to_endp_id]==1'b1) begin
|
|
k=k+1;
|
|
end
|
|
mcast_id_to_endp_id= mcast_id_to_endp_id+1;
|
|
end
|
|
end
|
|
end
|
|
endfunction
|
|
|
|
function automatic integer endp_id_to_mcast_id;
|
|
input integer endp_id;
|
|
reg [NE-1 : 0] mcast_list;
|
|
integer i;
|
|
begin
|
|
/* verilator lint_off WIDTH */
|
|
if (CAST_TYPE == "MULTICAST_FULL") begin
|
|
/* verilator lint_on WIDTH */
|
|
endp_id_to_mcast_id = endp_id;
|
|
end else begin
|
|
mcast_list =MCAST_ENDP_LIST;
|
|
endp_id_to_mcast_id=0;
|
|
for (i=0;i<endp_id;i=i+1) begin
|
|
if( mcast_list[i]==1'b1) endp_id_to_mcast_id=endp_id_to_mcast_id+1;
|
|
end
|
|
end
|
|
end
|
|
endfunction
|
|
|
|
|
|
|
|
function automatic integer mcast_partial_width;
|
|
input [NE-1 : 0] p;
|
|
integer i;
|
|
begin
|
|
|
|
mcast_partial_width=0;
|
|
for (i=0;i<NE;i=i+1) begin
|
|
if (p [i]==1'b1) mcast_partial_width=mcast_partial_width+1;
|
|
end
|
|
end
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
function automatic integer fmesh_addrencode;
|
|
input integer in;
|
|
integer y, x, l,p, diff,mul;begin
|
|
|
|
mul = NX*NY*NL;
|
|
if(in < mul) begin
|
|
y = ((in/NL) / NX );
|
|
x = ((in/NL) % NX );
|
|
l = (in % NL);
|
|
p = (l==0)? LOCAL : 4+l;
|
|
end else begin
|
|
diff = in - mul ;
|
|
if( diff < NX) begin //top mesh edge
|
|
y = 0;
|
|
x = diff;
|
|
p = NORTH;
|
|
end else if ( diff < 2* NX) begin //bottom mesh edge
|
|
y = NY-1;
|
|
x = diff-NX;
|
|
p = SOUTH;
|
|
end else if ( diff < (2* NX)+NY ) begin //left mesh edge
|
|
y = diff - (2* NX);
|
|
x = 0;
|
|
p = WEST;
|
|
end else begin //right mesh edge
|
|
y = diff - (2* NX) -NY;
|
|
x = NX-1;
|
|
p = EAST;
|
|
end
|
|
end//else
|
|
fmesh_addrencode = ( p<<(NXw+NYw) | (y<<NXw) | x);
|
|
end
|
|
endfunction // addrencode
|
|
|
|
|
|
|
|
// synthesis translate_off
|
|
/* verilator lint_off WIDTH */
|
|
task display_noc_parameters;
|
|
begin
|
|
//print_parameter
|
|
$display ("NoC parameters:----------------");
|
|
$display ("\tTopology: %s",TOPOLOGY);
|
|
$display ("\tRouting algorithm: %s",ROUTE_NAME);
|
|
$display ("\tVC_per port: %0d", V);
|
|
$display ("\tNon-local port buffer_width per VC: %0d", B);
|
|
$display ("\tLocal port buffer_width per VC: %0d", LB);
|
|
if(TOPOLOGY=="MESH" || TOPOLOGY=="TORUS" || TOPOLOGY == "FMESH")begin
|
|
$display ("\tRouter num in row: %0d",T1);
|
|
$display ("\tRouter num in column: %0d",T2);
|
|
$display ("\tEndpoint num per router: %0d",T3);
|
|
end else if (TOPOLOGY=="RING" || TOPOLOGY == "LINE") begin
|
|
$display ("\tTotal Router num: %0d",T1);
|
|
$display ("\tEndpoint num per router: %0d",T3);
|
|
end else if (TOPOLOGY == "TREE" || TOPOLOGY == "FATTREE")begin
|
|
$display ("\tK: %0d",T1);
|
|
$display ("\tL: %0d",T2);
|
|
end else begin //CUSTOM
|
|
$display ("\tTotal Endpoints number: %0d",T1);
|
|
$display ("\tTotal Routers number: %0d",T2);
|
|
end
|
|
$display ("\tNumber of Class: %0d", C);
|
|
$display ("\tFlit data width: %0d", Fpay);
|
|
$display ("\tVC reallocation mechanism: %s", VC_REALLOCATION_TYPE);
|
|
$display ("\tVC/sw combination mechanism: %s", COMBINATION_TYPE);
|
|
$display ("\tAVC_ATOMIC_EN:%0d", AVC_ATOMIC_EN);
|
|
$display ("\tCongestion Index:%0d",CONGESTION_INDEX);
|
|
$display ("\tADD_PIPREG_AFTER_CROSSBAR:%0d",ADD_PIPREG_AFTER_CROSSBAR);
|
|
$display ("\tSSA_EN enabled:%s",SSA_EN);
|
|
$display ("\tSwitch allocator arbitration type:%s",SWA_ARBITER_TYPE);
|
|
$display ("\tMinimum supported packet size:%0d flit(s)",MIN_PCK_SIZE);
|
|
$display ("\tLoop back is enabled:%s",SELF_LOOP_EN);
|
|
$display ("\tNumber of multihop bypass (SMART max):%0d",SMART_MAX);
|
|
$display ("\tCastying type:%s.",CAST_TYPE);
|
|
if (CAST_TYPE == "MULTICAST_PARTIAL" || CAST_TYPE == "BROADCAST_PARTIAL")begin
|
|
$display ("\tNumber of nodes in Cast list:%d", MCAST_PRTLw);
|
|
$display ("\tCAST LIST:%b", MCAST_ENDP_LIST);
|
|
end
|
|
$display ("NoC parameters:----------------");
|
|
end
|
|
endtask
|
|
/* verilator lint_on WIDTH */
|
|
// synthesis translate_on
|
|
|
|
|
|
|
|
|
|
|
`endif
|
`endif
|
|
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|