`timescale 1ns/1ps
/**********************************************************************
** File: routing.v
**
** Copyright (C) 2014-2017 Alireza Monemi
**
** This file is part of ProNoC
**
** ProNoC ( stands for Prototype Network-on-chip) is free software:
** you can redistribute it and/or modify it under the terms of the GNU
** Lesser General Public License as published by the Free Software Foundation,
** either version 2 of the License, or (at your option) any later version.
**
** ProNoC is distributed in the hope that it will be useful, but WITHOUT
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
** Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with ProNoC. If not, see .
**
**
** Description:
** look-ahead and conventional routing algorithms for Mesh and Torus NoC
**
**
**************************************************************/
module conventional_routing #(
parameter TOPOLOGY = "MESH",
parameter ROUTE_NAME = "XY",
parameter ROUTE_TYPE = "DETERMINISTIC",
parameter T1 = 4,
parameter T2 = 4,
parameter T3 = 4,
parameter RAw = 3,
parameter EAw = 3,
parameter DSTPw = 4,
parameter LOCATED_IN_NI = 1 // only needed for mesh and odd-even routing
)
(
reset,
clk,
current_r_addr,
src_e_addr,
dest_e_addr,
destport
);
function integer log2;
input integer number; begin
log2=(number <=1) ? 1: 0;
while(2**log2 P-T3) ? 0 : SW_LOC; //single_local
mesh_tori_router_addr_decode #(
.TOPOLOGY(TOPOLOGY),
.T1(T1),
.T2(T2),
.T3(T3),
.RAw(RAw)
)
router_addr_decode
(
.r_addr(current_r_addr),
.rx(current_rx),
.ry(current_ry),
.valid( )
);
/* verilator lint_off WIDTH */
if(TOPOLOGY == "FMESH") begin :fmesh
/* verilator lint_on WIDTH */
fmesh_endp_addr_decode #(
.T1(T1),
.T2(T2),
.T3(T3),
.EAw(EAw)
)
end_addr_decode
(
.e_addr(dest_e_addr),
.ex(dest_ex),
.ey(dest_ey),
.ep( ),
.valid()
);
end else begin :mesh
mesh_tori_endp_addr_decode #(
.TOPOLOGY(TOPOLOGY),
.T1(T1),
.T2(T2),
.T3(T3),
.EAw(EAw)
)
end_addr_decode
(
.e_addr(dest_e_addr),
.ex(dest_ex),
.ey(dest_ey),
.el( ),
.valid()
);
end
mesh_torus_look_ahead_routing #(
.NX(T1),
.NY(T2),
.SW_LOC(SL_SW_LOC),
.TOPOLOGY(TOPOLOGY),
.ROUTE_NAME(ROUTE_NAME),
.ROUTE_TYPE(ROUTE_TYPE)
)
look_ahead_route
(
.current_x(current_rx),
.current_y(current_ry),
.dest_x(dest_ex),
.dest_y(dest_ey),
.destport_encoded(destport_encoded),
.lkdestport_encoded(lkdestport_encoded),
.reset(reset),
.clk(clk)
);
/* verilator lint_off WIDTH */
end else if (TOPOLOGY == "FATTREE") begin: fat
/* verilator lint_on WIDTH */
wire [PLKw-1 : 0] neighbors_rx;
wire [PLw-1 : 0] neighbors_ry;
for (i=0; i