OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk/mpsoc/src_verilator
    from Rev 43 to Rev 48
    Reverse comparison

Rev 43 → Rev 48

/topology.h File deleted
topology.h Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: mesh_torus_noc_connection.sv =================================================================== --- mesh_torus_noc_connection.sv (revision 43) +++ mesh_torus_noc_connection.sv (nonexistent) @@ -1,433 +0,0 @@ - -// synthesis translate_off -`timescale 1ns / 1ps -// synthesis translate_on - - -/********************************************************************** -** File: mesh_torus_noc.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: -** the NoC top module. It generate one of the mesh, torus, ring, or line topologies by -** connecting routers -** -**************************************************************/ - - - - -`define START_LOC(port_num,width) (width*(port_num+1)-1) -`define END_LOC(port_num,width) (width*port_num) -`define router_id(x,y) ((y * NX) + x) -`define endp_id(x,y,l) ((y * NX) + x) * NL + l -`define SELECT_WIRE(x,y,port,width) `router_id(x,y)] [`START_LOC(port,width) : `END_LOC(port,width ) - - -module mesh_torus_noc_connection ( - - reset, - clk, - router_flit_out_all, - router_flit_out_we_all, - router_credit_in_all, - - router_flit_in_all, - router_flit_in_we_all, - router_credit_out_all, - router_congestion_in_all, - router_congestion_out_all, - - ni_flit_in, - ni_flit_in_wr, - ni_credit_out, - ni_flit_out, - ni_flit_out_wr, - ni_credit_in, - start_i, - er_addr, - current_r_addr, - start_o - -); - - - - - - `define INCLUDE_PARAM - `include"parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - localparam - PV = V * MAX_P, - Fw = 2+V+Fpay, //flit width; - PFw = MAX_P * Fw, - NEFw = NE * Fw, - NEV = NE * V, - CONG_ALw = CONGw * MAX_P; // congestion width per router - - - - input reset,clk; - - - - - - output [PFw-1 : 0] router_flit_out_all [NR-1 :0]; - output [MAX_P-1 : 0] router_flit_out_we_all [NR-1 :0]; - input [PV-1 : 0] router_credit_in_all [NR-1 :0]; - - input [PFw-1 : 0] router_flit_in_all [NR-1 :0]; - input [MAX_P-1 : 0] router_flit_in_we_all [NR-1 :0]; - output [PV-1 : 0] router_credit_out_all [NR-1 :0]; - input [CONG_ALw-1: 0] router_congestion_in_all[NR-1 :0]; - output [CONG_ALw-1: 0] router_congestion_out_all [NR-1 :0]; - - - input [Fw-1 : 0] ni_flit_in [NE-1 :0]; - input [NE-1 : 0] ni_flit_in_wr; - output [V-1 : 0] ni_credit_out [NE-1 :0]; - output [Fw-1 : 0] ni_flit_out [NE-1 :0]; - output [NE-1 : 0] ni_flit_out_wr; - input [V-1 : 0] ni_credit_in [NE-1 :0]; - - - input start_i; - - output [RAw-1 : 0] er_addr [NE-1 : 0]; - output [RAw-1 : 0] current_r_addr [NR-1 : 0]; - - - output [NE-1 : 0] start_o; - - // mesh torus - localparam - EAST = 1, - NORTH = 2, - WEST = 3, - SOUTH = 4; - //ring line - localparam - FORWARD = 1, - BACKWARD= 2; - - -genvar x,y,l; -generate - /* verilator lint_off WIDTH */ - if( TOPOLOGY == "RING" || TOPOLOGY == "LINE") begin : ring_line - /* verilator lint_on WIDTH */ - for (x=0; x0)begin :not_first_x - assign router_flit_out_all [`SELECT_WIRE(x,0,BACKWARD,Fw)] = router_flit_in_all [`SELECT_WIRE((x-1),0,FORWARD,Fw)]; - assign router_credit_out_all [`SELECT_WIRE(x,0,BACKWARD,V)] = router_credit_in_all [`SELECT_WIRE((x-1),0,FORWARD,V)] ; - assign router_flit_out_we_all [x][BACKWARD] = router_flit_in_we_all [`router_id((x-1),0)][FORWARD]; - assign router_congestion_out_all[`SELECT_WIRE(x,0,BACKWARD,CONGw)] = router_congestion_in_all [`SELECT_WIRE((x-1),0,FORWARD,CONGw)]; - end else begin :first_x - /* verilator lint_off WIDTH */ - if(TOPOLOGY == "LINE") begin : line_first_x - /* verilator lint_on WIDTH */ - assign router_flit_out_all [`SELECT_WIRE(x,0,BACKWARD,Fw)] = {Fw{1'b0}}; - assign router_credit_out_all [`SELECT_WIRE(x,0,BACKWARD,V)] = {V{1'b0}}; - assign router_flit_out_we_all [x][BACKWARD] = 1'b0; - assign router_congestion_out_all[`SELECT_WIRE(x,0,BACKWARD,CONGw)] = {CONGw{1'b0}}; - end else begin : ring_first_x - assign router_flit_out_all [`SELECT_WIRE(x,0,BACKWARD,Fw)] = router_flit_in_all [`SELECT_WIRE((NX-1),0,FORWARD,Fw)] ; - assign router_credit_out_all [`SELECT_WIRE(x,0,BACKWARD,V)] = router_credit_in_all [`SELECT_WIRE((NX-1),0,FORWARD,V)] ; - assign router_flit_out_we_all [x][BACKWARD] = router_flit_in_we_all [`router_id((NX-1),0)][FORWARD]; - assign router_congestion_out_all[`SELECT_WIRE(x,0,BACKWARD,CONGw)] = router_congestion_in_all [`SELECT_WIRE((NX-1),0,FORWARD,CONGw)]; - end - end - - // connect local ports - for (l=0; l0) begin : not_first_y - assign router_flit_out_all [`SELECT_WIRE(x,y,NORTH,Fw)] = router_flit_in_all [`SELECT_WIRE(x,(y-1),SOUTH,Fw)]; - assign router_credit_out_all [`SELECT_WIRE(x,y,NORTH,V)] = router_credit_in_all [`SELECT_WIRE(x,(y-1),SOUTH,V)]; - assign router_flit_out_we_all [`router_id(x,y)][NORTH] = router_flit_in_we_all [`router_id(x,(y-1))][SOUTH]; - assign router_congestion_out_all [`SELECT_WIRE(x,y,NORTH,CONGw)] = router_congestion_in_all [`SELECT_WIRE(x,(y-1),SOUTH,CONGw)]; - end else begin :first_y - /* verilator lint_off WIDTH */ - if(TOPOLOGY == "MESH") begin : first_y_mesh - /* verilator lint_on WIDTH */ - assign router_flit_out_all [`SELECT_WIRE(x,y,NORTH,Fw)] = {Fw{1'b0}}; - assign router_credit_out_all [`SELECT_WIRE(x,y,NORTH,V)] = {V{1'b0}}; - assign router_flit_out_we_all [`router_id(x,y)][NORTH] = 1'b0; - assign router_congestion_out_all [`SELECT_WIRE(x,y,NORTH,CONGw)] = {CONGw{1'b0}}; - /* verilator lint_off WIDTH */ - end else if(TOPOLOGY == "TORUS") begin :first_y_torus - /* verilator lint_on WIDTH */ - assign router_flit_out_all [`SELECT_WIRE(x,y,NORTH,Fw)] = router_flit_in_all [`SELECT_WIRE(x,(NY-1),SOUTH,Fw)]; - assign router_credit_out_all [`SELECT_WIRE(x,y,NORTH,V)] = router_credit_in_all [`SELECT_WIRE(x,(NY-1),SOUTH,V)]; - assign router_flit_out_we_all [`router_id(x,y)][NORTH] = router_flit_in_we_all [`router_id(x,(NY-1))][SOUTH]; - assign router_congestion_out_all [`SELECT_WIRE(x,y,NORTH,CONGw)] = router_congestion_in_all [`SELECT_WIRE(x,(NY-1),SOUTH,CONGw)]; - end//topology - end//y>0 - - - if(x>0)begin :not_first_x - assign router_flit_out_all [`SELECT_WIRE(x,y,WEST,Fw)] = router_flit_in_all [`SELECT_WIRE((x-1),y,EAST,Fw)] ; - assign router_credit_out_all [`SELECT_WIRE(x,y,WEST,V)] = router_credit_in_all [`SELECT_WIRE((x-1),y,EAST,V)] ; - assign router_flit_out_we_all [`router_id(x,y)][WEST] = router_flit_in_we_all [`router_id((x-1),y)][EAST]; - assign router_congestion_out_all [`SELECT_WIRE(x,y,WEST,CONGw)] = router_congestion_in_all [`SELECT_WIRE((x-1),y,EAST,CONGw)]; - end else begin :first_x - /* verilator lint_off WIDTH */ - if(TOPOLOGY == "MESH") begin :first_x_mesh - /* verilator lint_on WIDTH */ - assign router_flit_out_all [`SELECT_WIRE(x,y,WEST,Fw)] = {Fw{1'b0}}; - assign router_credit_out_all [`SELECT_WIRE(x,y,WEST,V)] = {V{1'b0}}; - assign router_flit_out_we_all [`router_id(x,y)][WEST] = 1'b0; - assign router_congestion_out_all [`SELECT_WIRE(x,y,WEST,CONGw)] = {CONGw{1'b0}}; - /* verilator lint_off WIDTH */ - end else if(TOPOLOGY == "TORUS") begin :first_x_torus - /* verilator lint_on WIDTH */ - assign router_flit_out_all [`SELECT_WIRE(x,y,WEST,Fw)] = router_flit_in_all [`SELECT_WIRE((NX-1),y,EAST,Fw)] ; - assign router_credit_out_all [`SELECT_WIRE(x,y,WEST,V)] = router_credit_in_all [`SELECT_WIRE((NX-1),y,EAST,V)] ; - assign router_flit_out_we_all [`router_id(x,y)][WEST] = router_flit_in_we_all [`router_id((NX-1),y)][EAST]; - assign router_congestion_out_all [`SELECT_WIRE(x,y,WEST,CONGw)] = router_congestion_in_all [`SELECT_WIRE((NX-1),y,EAST,CONGw)]; - end//topology - end - - if(y < NY-1) begin : firsty - assign router_flit_out_all [`SELECT_WIRE(x,y,SOUTH,Fw)] = router_flit_in_all [`SELECT_WIRE(x,(y+1),NORTH,Fw)]; - assign router_credit_out_all [`SELECT_WIRE(x,y,SOUTH,V)] = router_credit_in_all [`SELECT_WIRE(x,(y+1),NORTH,V)]; - assign router_flit_out_we_all [`router_id(x,y)][SOUTH] = router_flit_in_we_all [`router_id(x,(y+1))][NORTH]; - assign router_congestion_out_all [`SELECT_WIRE(x,y,SOUTH,CONGw)] = router_congestion_in_all [`SELECT_WIRE(x,(y+1),NORTH,CONGw)]; - end else begin : lasty - /* verilator lint_off WIDTH */ - if(TOPOLOGY == "MESH") begin :ly_mesh - /* verilator lint_on WIDTH */ - assign router_flit_out_all [`SELECT_WIRE(x,y,4,Fw)] = {Fw{1'b0}}; - assign router_credit_out_all [`SELECT_WIRE(x,y,4,V)] = {V{1'b0}}; - assign router_flit_out_we_all [`router_id(x,y)][4] = 1'b0; - assign router_congestion_out_all [`SELECT_WIRE(x,y,4,CONGw)] = {CONGw{1'b0}}; - /* verilator lint_off WIDTH */ - end else if(TOPOLOGY == "TORUS") begin :ly_torus - /* verilator lint_on WIDTH */ - assign router_flit_out_all [`SELECT_WIRE(x,y,SOUTH,Fw)] = router_flit_in_all [`SELECT_WIRE(x,0,NORTH,Fw)]; - assign router_credit_out_all [`SELECT_WIRE(x,y,SOUTH,V)] = router_credit_in_all [`SELECT_WIRE(x,0,NORTH,V)]; - assign router_flit_out_we_all [`router_id(x,y)][SOUTH] = router_flit_in_we_all [`router_id(x,0)][NORTH]; - assign router_congestion_out_all [`SELECT_WIRE(x,y,SOUTH,CONGw)] = router_congestion_in_all [`SELECT_WIRE(x,0,NORTH,CONGw)]; - end//topology - end - - - // endpoint(s) connection - // connect local ports - for (l=0; l
mesh_torus_noc_connection.sv Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: noc_connection.sv =================================================================== --- noc_connection.sv (revision 43) +++ noc_connection.sv (nonexistent) @@ -1,189 +0,0 @@ -`timescale 1ns/1ps - - -module noc_connection ( - - /* - reset, - clk, - flit_out_all, - flit_out_wr_all, - credit_in_all, - flit_in_all, - flit_in_wr_all, - credit_out_all - */ - clk, - reset, - start_i, - start_o, - router_flit_out_all, - router_flit_out_we_all, - router_credit_in_all, - router_credit_out_all, - router_flit_in_all, - router_flit_in_we_all, - router_congestion_in_all, - router_congestion_out_all, -// router_iport_weight_in_all, -// router_iport_weight_out_all, - ni_flit_in, - ni_flit_in_wr, - ni_credit_out, - ni_flit_out, - ni_flit_out_wr, - ni_credit_in, - er_addr,// endpoints connected to each router - current_r_addr, - neighbors_r_addr -); - - - - - `define INCLUDE_PARAM - `include"parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * MAX_P, - Fw = 2+V+Fpay, //flit width; - PFw = MAX_P * Fw, - CONG_ALw = CONGw * MAX_P, // congestion width per router - W= WEIGHTw, - WP = W * MAX_P, - PRAw= RAw * MAX_P; - - - output [PFw-1 : 0] router_flit_out_all [NR-1 : 0]; - output [MAX_P-1 : 0] router_flit_out_we_all [NR-1 : 0]; - input [PV-1 : 0] router_credit_in_all [NR-1 : 0]; - - - input [PFw-1 : 0] router_flit_in_all [NR-1 : 0]; - input [MAX_P-1 : 0] router_flit_in_we_all [NR-1 : 0]; - output [PV-1 : 0] router_credit_out_all[NR-1: 0]; - - input [CONG_ALw-1 : 0] router_congestion_in_all [NR-1 :0]; - output [CONG_ALw-1 : 0] router_congestion_out_all [NR-1 :0]; - - - input [Fw-1 : 0] ni_flit_in [NE-1 : 0]; - input [NE-1 : 0] ni_flit_in_wr; - output [V-1 : 0] ni_credit_out [NE-1 : 0]; - output [Fw-1 : 0] ni_flit_out [NE-1 : 0]; - output [NE-1 : 0] ni_flit_out_wr; - input [V-1 : 0] ni_credit_in [NE-1 : 0]; - - output [RAw-1 : 0] current_r_addr [NR-1 : 0]; - output [RAw-1 : 0] er_addr [NE-1 : 0]; - output [PRAw-1 :0] neighbors_r_addr [NR-1 :0];//get a fixed value for each individual router - - - - input clk,reset, start_i; - - - output [NE-1 : 0] start_o; - - -generate - /* verilator lint_off WIDTH */ - if( TOPOLOGY == "FATTREE") begin : fat - /* verilator lint_on WIDTH */ - - fattree_noc_connection connections - ( - .clk(clk), - .reset(reset), - .start_i(start_i), - .start_o(start_o), - .router_flit_out_all(router_flit_out_all), - .router_flit_out_we_all(router_flit_out_we_all), - .router_credit_in_all(router_credit_in_all), - .router_credit_out_all(router_credit_out_all), - .router_flit_in_all(router_flit_in_all), - .router_flit_in_we_all(router_flit_in_we_all), - .router_congestion_in_all(router_congestion_in_all), - .router_congestion_out_all(router_congestion_out_all), - .ni_flit_in(ni_flit_in), - .ni_flit_in_wr(ni_flit_in_wr), - .ni_credit_out(ni_credit_out), - .ni_flit_out(ni_flit_out), - .ni_flit_out_wr(ni_flit_out_wr), - .ni_credit_in(ni_credit_in), - .er_addr(er_addr), - .current_r_addr(current_r_addr), - .neighbors_r_all(neighbors_r_addr) - ); - /* verilator lint_off WIDTH */ - end else if( TOPOLOGY == "TREE") begin : fat - /* verilator lint_on WIDTH */ - - tree_noc_connection connections - ( - .clk(clk), - .reset(reset), - .start_i(start_i), - .start_o(start_o), - .router_flit_out_all(router_flit_out_all), - .router_flit_out_we_all(router_flit_out_we_all), - .router_credit_in_all(router_credit_in_all), - .router_credit_out_all(router_credit_out_all), - .router_flit_in_all(router_flit_in_all), - .router_flit_in_we_all(router_flit_in_we_all), - .router_congestion_in_all(router_congestion_in_all), - .router_congestion_out_all(router_congestion_out_all), - .ni_flit_in(ni_flit_in), - .ni_flit_in_wr(ni_flit_in_wr), - .ni_credit_out(ni_credit_out), - .ni_flit_out(ni_flit_out), - .ni_flit_out_wr(ni_flit_out_wr), - .ni_credit_in(ni_credit_in), - .er_addr(er_addr), - .current_r_addr(current_r_addr), - .neighbors_r_all(neighbors_r_addr) - ); - - end else begin :mesh_torus - mesh_torus_noc_connection connections - ( - .clk(clk), - .reset(reset), - .start_i(start_i), - .start_o(start_o), - .router_flit_out_all(router_flit_out_all), - .router_flit_out_we_all(router_flit_out_we_all), - .router_credit_in_all(router_credit_in_all), - .router_credit_out_all(router_credit_out_all), - .router_flit_in_all(router_flit_in_all), - .router_flit_in_we_all(router_flit_in_we_all), - .router_congestion_in_all(router_congestion_in_all), - .router_congestion_out_all(router_congestion_out_all), - .ni_flit_in(ni_flit_in), - .ni_flit_in_wr(ni_flit_in_wr), - .ni_credit_out(ni_credit_out), - .ni_flit_out(ni_flit_out), - .ni_flit_out_wr(ni_flit_out_wr), - .ni_credit_in(ni_credit_in), - .er_addr(er_addr), - .current_r_addr(current_r_addr) - -); - - end - endgenerate -endmodule -
noc_connection.sv Property changes : Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: traffic_gen_verilator.v =================================================================== --- traffic_gen_verilator.v (revision 43) +++ traffic_gen_verilator.v (nonexistent) @@ -1,159 +0,0 @@ -/************************************** -* Module: traffic_gen_verilator -* Date:2015-01-16 -* Author: alireza -* -* Description: -***************************************/ -module traffic_gen_verilator ( - - ratio, - avg_pck_size_in, - pck_size_in, - current_r_addr, - current_e_addr, - dest_e_addr, - pck_class_in, - start, - stop, - report, - init_weight, - - pck_number, - sent_done, // tail flit has been sent - hdr_flit_sent, - update, // update the noc_analayzer - src_e_addr, - - distance, - pck_class_out, - time_stamp_h2h, - time_stamp_h2t, - - flit_out, - flit_out_wr, - credit_in, - flit_in, - flit_in_wr, - credit_out, - - reset, - clk -); - - - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam - - Cw = (C > 1)? log2(C): 1, - Fw = 2+V+Fpay, - RATIOw = log2(MAX_RATIO), - PCK_CNTw = log2(MAX_PCK_NUM+1), - CLK_CNTw = log2(MAX_SIM_CLKs+1), - PCK_SIZw = log2(MAX_PCK_SIZ+1), - - /* verilator lint_off WIDTH */ - DISTw = (TOPOLOGY=="FATTREE" || TOPOLOGY == "TREE") ? log2(2*L+1): log2(NR+1), - /* verilator lint_on WIDTH */ - W = WEIGHTw; - - - - input reset, clk; - input [RATIOw-1 :0] ratio; - input start,stop; - output update; - output [CLK_CNTw-1 :0] time_stamp_h2h,time_stamp_h2t; - output [DISTw-1 :0] distance; - output [Cw-1 :0] pck_class_out; - // the connected router address - input [RAw-1 :0] current_r_addr; - // the current endpoint address - input [EAw-1 :0] current_e_addr; - // the destination endpoint adress - input [EAw-1 :0] dest_e_addr; - - output [PCK_CNTw-1 :0] pck_number; - input [PCK_SIZw-1 :0] avg_pck_size_in; - input [PCK_SIZw-1 :0] pck_size_in; - - output sent_done; - output hdr_flit_sent; - input [Cw-1 :0] pck_class_in; - input [W-1 :0] init_weight; - // NOC interfaces - output [Fw-1 :0] flit_out; - output flit_out_wr; - input [V-1 :0] credit_in; - - input [Fw-1 :0] flit_in; - input flit_in_wr; - output [V-1 :0] credit_out; - input report; - // the recieved packet source endpoint address - output [EAw-1 : 0] src_e_addr; - - - traffic_gen #( - .V(V), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .Fpay(Fpay), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .C(C), - .MAX_PCK_NUM(MAX_PCK_NUM), - .MAX_SIM_CLKs(MAX_SIM_CLKs), - .MAX_PCK_SIZ(MAX_PCK_SIZ), - .TIMSTMP_FIFO_NUM(TIMSTMP_FIFO_NUM), - .MAX_RATIO(MAX_RATIO), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_traffic_gen - ( - .reset(reset), - .clk(clk), - .ratio(ratio), - .start(start), - .stop(stop), - .update(update), - .time_stamp_h2h(time_stamp_h2h), - .time_stamp_h2t(time_stamp_h2t), - .distance(distance), - .pck_class_out(pck_class_out), - .current_r_addr(current_r_addr), - .current_e_addr(current_e_addr), - .dest_e_addr(dest_e_addr), - .pck_number(pck_number), - .avg_pck_size_in(avg_pck_size_in), - .pck_size_in(pck_size_in), - .sent_done(sent_done), - .hdr_flit_sent(hdr_flit_sent), - .pck_class_in(pck_class_in), - .init_weight(init_weight), - .flit_out(flit_out), - .flit_out_wr(flit_out_wr), - .credit_in(credit_in), - .flit_in(flit_in), - .flit_in_wr(flit_in_wr), - .credit_out(credit_out), - .report(report), - .src_e_addr(src_e_addr) - ); - - - -endmodule -
traffic_gen_verilator.v Property changes : Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: router_verilator.v =================================================================== --- router_verilator.v (revision 43) +++ router_verilator.v (nonexistent) @@ -1,1908 +0,0 @@ -/************** -Port num = 2 -****************/ - -module router_verilator_p2 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=2; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 3 -****************/ - -module router_verilator_p3 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=3; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 4 -****************/ - -module router_verilator_p4 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=4; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 5 -****************/ - -module router_verilator_p5 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=5; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 6 -****************/ - -module router_verilator_p6 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=6; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 7 -****************/ - -module router_verilator_p7 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=7; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 8 -****************/ - -module router_verilator_p8 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=8; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 9 -****************/ - -module router_verilator_p9 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=9; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 10 -****************/ - -module router_verilator_p10 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=10; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 11 -****************/ - -module router_verilator_p11 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=11; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 12 -****************/ - -module router_verilator_p12 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=12; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 13 -****************/ - -module router_verilator_p13 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=13; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 14 -****************/ - -module router_verilator_p14 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=14; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 15 -****************/ - -module router_verilator_p15 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=15; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 16 -****************/ - -module router_verilator_p16 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=16; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 17 -****************/ - -module router_verilator_p17 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=17; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 18 -****************/ - -module router_verilator_p18 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=18; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -/************** -Port num = 19 -****************/ - -module router_verilator_p19 -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=19; - - `define INCLUDE_PARAM - `include "parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule -
router_verilator.v Property changes : Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: fattree_noc_connection.sv =================================================================== --- fattree_noc_connection.sv (revision 43) +++ fattree_noc_connection.sv (nonexistent) @@ -1,217 +0,0 @@ -`timescale 1ns/1ps - -module fattree_noc_connection ( - clk, - reset, - start_i, - start_o, - router_flit_out_all, - router_flit_out_we_all, - router_credit_in_all, - router_credit_out_all, - router_flit_in_all, - router_flit_in_we_all, - router_congestion_in_all, - router_congestion_out_all, - - ni_flit_in, - ni_flit_in_wr, - ni_credit_out, - ni_flit_out, - ni_flit_out_wr, - ni_credit_in, - er_addr, - current_r_addr, - neighbors_r_all -); - - - `define INCLUDE_PARAM - `include"parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - function integer addrencode; - input integer pos,k,n,kw; - integer pow,i,tmp;begin - addrencode=0; - pow=1; - for (i = 0; i
fattree_noc_connection.sv Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: perl/gen_router_verilator_p.prl =================================================================== --- perl/gen_router_verilator_p.prl (revision 43) +++ perl/gen_router_verilator_p.prl (nonexistent) @@ -1,123 +0,0 @@ -#!/usr/bin/perl - - -use strict; -use warnings; -open(FILE, ">router_verilator.v") || die "Can not open: $!"; -for (my $p=2; $p<20; $p++) { - - -print FILE "/************** -Port num = $p -****************/ - -module router_verilator_p$p -( - current_r_addr, - neighbors_r_addr, - flit_in_all, - flit_in_we_all, - credit_out_all, - congestion_in_all, - flit_out_all, - flit_out_we_all, - credit_in_all, - congestion_out_all, - clk,reset -); - - localparam P=$p; - - `define INCLUDE_PARAM - `include \"parameter.v\" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include \"topology_localparam.v\" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - - - localparam - PV = V * P, - P_1 = P-1, - Fw = 2+V+Fpay, //flit width; - PFw = P * Fw, - CONG_ALw = CONGw * P, // congestion width per router - W = WEIGHTw, - WP = W * P, - PRAw = P * RAw; - - input clk,reset; - input [RAw-1 : 0] current_r_addr; - input [PRAw-1 : 0] neighbors_r_addr; - input [PFw-1 : 0] flit_in_all; - input [P-1 : 0] flit_in_we_all; - output [PV-1 : 0] credit_out_all; - input [CONG_ALw-1 : 0] congestion_in_all; - - output [PFw-1 : 0] flit_out_all; - output [P-1 : 0] flit_out_we_all; - input [PV-1 : 0] credit_in_all; - output [CONG_ALw-1 : 0] congestion_out_all; - - router # ( - .V(V), - .P(P), - .B(B), - .T1(T1), - .T2(T2), - .T3(T3), - .C(C), - .Fpay(Fpay), - .MUX_TYPE(MUX_TYPE), - .VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE), - .COMBINATION_TYPE(COMBINATION_TYPE), - .FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN), - .TOPOLOGY(TOPOLOGY), - .ROUTE_NAME(ROUTE_NAME), - .AVC_ATOMIC_EN(AVC_ATOMIC_EN), - .CONGESTION_INDEX(CONGESTION_INDEX), - .CONGw(CONGw), - .DEBUG_EN(DEBUG_EN), - .ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR), - .CVw(CVw), - .CLASS_SETTING(CLASS_SETTING), - .ESCAP_VC_MASK(ESCAP_VC_MASK), - .SSA_EN(SSA_EN), - .SWA_ARBITER_TYPE(SWA_ARBITER_TYPE), - .WEIGHTw(WEIGHTw), - .MIN_PCK_SIZE(MIN_PCK_SIZE) - ) - the_router - ( - .current_r_addr(current_r_addr), - .neighbors_r_addr(neighbors_r_addr), - .flit_in_all(flit_in_all), - .flit_in_we_all(flit_in_we_all), - .credit_out_all(credit_out_all), - .congestion_in_all(congestion_in_all), - .flit_out_all(flit_out_all), - .flit_out_we_all(flit_out_we_all), - .credit_in_all(credit_in_all), - .congestion_out_all(congestion_out_all), - .clk(clk), - .reset(reset) - - ); -endmodule - -"; - -} - -close(FILE); - - -
perl/gen_router_verilator_p.prl Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: tree_noc_connection.sv =================================================================== --- tree_noc_connection.sv (revision 43) +++ tree_noc_connection.sv (nonexistent) @@ -1,210 +0,0 @@ -// synthesis translate_off -`timescale 1ns / 1ps -// synthesis translate_on - -module tree_noc_connection ( - - clk, - reset, - start_i, - start_o, - router_flit_out_all, - router_flit_out_we_all, - router_credit_in_all, - router_credit_out_all, - router_flit_in_all, - router_flit_in_we_all, - router_congestion_in_all, - router_congestion_out_all, - - ni_flit_in, - ni_flit_in_wr, - ni_credit_out, - ni_flit_out, - ni_flit_out_wr, - ni_credit_in, - er_addr, - current_r_addr, - neighbors_r_all -); - - - `define INCLUDE_PARAM - `include"parameter.v" - - `define INCLUDE_TOPOLOGY_LOCALPARAM - `include "topology_localparam.v" - - - localparam CONGw= (CONGESTION_INDEX==3)? 3: - (CONGESTION_INDEX==5)? 3: - (CONGESTION_INDEX==7)? 3: - (CONGESTION_INDEX==9)? 3: - (CONGESTION_INDEX==10)? 4: - (CONGESTION_INDEX==12)? 3:2; - - function integer addrencode; - input integer pos,k,n,kw; - integer pow,i,tmp;begin - addrencode=0; - pow=1; - for (i = 0; i
tree_noc_connection.sv Property changes : Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: custom_traffic.h =================================================================== --- custom_traffic.h (revision 43) +++ custom_traffic.h (nonexistent) @@ -1,172 +0,0 @@ -#ifndef CUSTOM_TRAFFIC_h -#define CUSTOM_TRAFFIC_h - - -#include -#include -#include -#include "parameter.h" - -#define NC (NX*NY) -#define DISABLE -1 -#define MAX_FILE_LINE 50000 -#define MAX_LINE_LEN 5000 - - -struct TRAFFIC_PATTERN { - unsigned int src; // ID of the source node (PE) - unsigned int dst; // ID of the destination node (PE) - float pir; //1~100 % - unsigned int avg_pck_size; //in flit - unsigned int min_pck_size; //in flit - unsigned int max_pck_size; //in flit - unsigned int total_pck_num; - unsigned int initial_weight; - - unsigned int packet_sent; -}TrafficTable[MAX_FILE_LINE]; - -int active_location [NC+1]; - - -int global_index=0; -unsigned int total_pck_num_custom=0; - - - -void addTO( - struct TRAFFIC_PATTERN st -){ - - TrafficTable[global_index++]=st; - TrafficTable[global_index].src=-1; - total_pck_num_custom+=st.total_pck_num; -} - - - -struct TRAFFIC_PATTERN extract_traffic_data ( char * str, int * n) -{ - struct TRAFFIC_PATTERN st; - *n=sscanf( str, "%u,%u,%f,%u,%u,%u,%u,%u", - &st.src, - &st.dst, - &st.pir, - &st.avg_pck_size, - &st.min_pck_size, - &st.max_pck_size, - &st.total_pck_num, - &st.initial_weight); - return st; -} - - -char* removewhiteSpacses (char * oldstr ) { - char *newstr = (char*) malloc(strlen(oldstr)+1); - char *np = newstr, *op = oldstr; - do { - if (*op != ' ' && *op != '\t') - *np++ = *op; - } while (*op++); - return newstr; -} - - -int compare ( const void *pa, const void *pb ) -{ - const int *a = (const int *) pa; - const int *b = (const int *) pb; - return a[0] - b[0]; -} - - -int load_traffic_file(char * file){ - FILE * in; - char * line = NULL; - size_t len = 0; - ssize_t read; - - struct TRAFFIC_PATTERN file_data[MAX_FILE_LINE]; - struct TRAFFIC_PATTERN sorted[MAX_FILE_LINE]; - char l[MAX_LINE_LEN]; - - struct TRAFFIC_PATTERN st; - int index=0,i=0,n=0; - - for (i = 0; i < NC; i++) { - active_location[i] = DISABLE ; - } - - in = fopen(file,"rb"); - - - - if(in == NULL) - { - printf("Error: cannot open %s file in read mode!\n",file); - exit(1); - } - - - - while (fgets(l,MAX_LINE_LEN, in) != NULL) { - - - //while ((read = getline(&line, &len, in)) != -1) { - line = removewhiteSpacses(l); - //printf("%s", line); - - if(line[0] != '%' && line[0] != 0 ) { - st=extract_traffic_data(line,&n); - if(st.dst >=NC) continue;// the destination address must be smaller than NC - file_data[index]= st; - index++; - - if(index>MAX_FILE_LINE){ - perror("error: MAX_FILE_LINE is smaller than the file line number\n"); - } - //addTO(data); - } - - } - - // qsort(file_data, index, sizeof file_data[0], compare); - - //sort - int j,m=0; - for (i=0;i= NC) continue; - addTO(sorted[i]); - - if(j!=src){ - active_location[src]=i; - j=src; - - } - } - - - - - fclose(in); - - - return index; - -} - -#endif - - Index: netrace_lib.h =================================================================== --- netrace_lib.h (nonexistent) +++ netrace_lib.h (revision 48) @@ -0,0 +1,394 @@ +#ifndef NETRACE_LIB_H +#define NETRACE_LIB_H + + +#include "netrace-1.0/queue.h" +#include "netrace-1.0/netrace.h" +#include "netrace-1.0/queue.c" +#include "netrace-1.0/netrace.c" + + +extern int reset,clk; +extern char simulation_done; +extern void connect_clk_reset_start_all(void); +extern void sim_eval_all (void); +extern void topology_connect_all_nodes (void); +extern Vpck_inj *pck_inj[NE]; +extern unsigned int count_en; +extern unsigned long int main_time; // Current simulation time +extern int verbosity; + + + + +#define L2_LATENCY 8 + + +int ignore_dependencies = 0; +int start_region = 0; +int reader_throttling = 0; +unsigned long long int nt_cycle=0; +unsigned long long int nt_start_cycle=0; + +nt_header_t* header; +queue_t** waiting; +queue_t** inject; +queue_t** traverse; +nt_packet_t* trace_packet = NULL; +nt_packet_t* packet = NULL; +int nt_packets_left = 0; + + +int netrace_to_pronoc_map [64]; +int pronoc_to_netrace_map [NE]; +int pck_injct_in_pck_wr[NE]; + +unsigned int nt_total_rd_pck=0; // from trace file +unsigned int read_done=0; + +typedef struct queue_node queue_node_t; +struct queue_node { + nt_packet_t* packet; + unsigned long long int cycle; +}; + + +unsigned long long int calc_packet_timing( nt_packet_t* packet ) { + + int n_hops = abs( packet->src - packet->dst ); + if( n_hops <= 0 ) n_hops = 1; + return 3*n_hops; +} + + + +void netrace_init( char * tracefile){ + int i=0; + nt_open_trfile( tracefile ); + if( ignore_dependencies ) { + nt_disable_dependencies(); + printf("\tDependencies is turned off in tracking cleared packets list\n"); + } + if( reader_throttling ) { + printf("\treader throttling is enabled\n"); + } + nt_print_trheader(); + header = nt_get_trheader(); + nt_seek_region( &header->regions[start_region] ); + for(i = 0; i < start_region; i++ ) { + nt_cycle += header->regions[i].num_cycles; + } + if(nt_cycle){ + printf("\tThe simulation start at region %u and %llu cycle\n",start_region,nt_cycle); + nt_start_cycle=nt_cycle; + } + + waiting = (queue_t**) malloc( header->num_nodes * sizeof(queue_t*) ); + inject = (queue_t**) malloc( header->num_nodes * sizeof(queue_t*) ); + traverse = (queue_t**) malloc( header->num_nodes * sizeof(queue_t*) ); + if( (waiting == NULL) || (inject == NULL) || (traverse == NULL) ) { + printf( "ERROR: malloc fail queues\n" ); + exit(0); + } + for( i = 0; i < header->num_nodes; ++i ) { + waiting[i] = queue_new(); + inject[i] = queue_new(); + traverse[i] = queue_new(); + } + + if( !reader_throttling ) { + trace_packet = nt_read_packet(); + } else if( !ignore_dependencies ) { + nt_init_self_throttling(); + } + + MIN_PACKET_SIZE = (8*8)/Fpay; + MAX_PACKET_SIZE = (64*8)/Fpay; + AVG_PACKET_SIZE=(MIN_PACKET_SIZE+MAX_PACKET_SIZE)/2;// average packet size + int p=(MAX_PACKET_SIZE-MIN_PACKET_SIZE)+1; + rsv_size_array = (unsigned int*) calloc ( p , sizeof(int)); + if (rsv_size_array==NULL){ + fprintf(stderr,"ERROR: cannot allocate (%d x int) memory for rsv_size_array. \n",p); + exit(1); + } + + + if(verbosity==1) printf("\e[?25l"); //To hide the cursor: + +} + + + + +void netrace_eval(unsigned int eval_num){ + int i; + + if((reset==1) || (count_en==0)) return; + + if((( nt_cycle > header->num_cycles) || (read_done==1 )) && nt_packets_left==0 ) simulation_done=1; + + // Reset packets remaining check + nt_packets_left = 0; + + // Get packets for this cycle + if((end_sim_pck_num == 0 ) || (end_sim_pck_num > nt_total_rd_pck )){ + if( reader_throttling ) { + nt_packet_list_t* list; + for( list = nt_get_cleared_packets_list(); list != NULL; list = list->next ) { + if( list->node_packet != NULL ) { + trace_packet = list->node_packet; + queue_node_t* new_node = (queue_node_t*) nt_checked_malloc( sizeof(queue_node_t) ); + new_node->packet = trace_packet; + new_node->cycle = (trace_packet->cycle > nt_cycle) ? trace_packet->cycle : nt_cycle; + queue_push( inject[trace_packet->src], new_node, new_node->cycle ); + nt_total_rd_pck++; + } else { + printf( "ERROR: Malformed packet list" ); + exit(-1); + } + } + nt_empty_cleared_packets_list(); + } else { + while( (trace_packet != NULL) && (trace_packet->cycle == nt_cycle) ) { + // Place in appropriate queue + queue_node_t* new_node = (queue_node_t*) nt_checked_malloc( sizeof(queue_node_t) ); + new_node->packet = trace_packet; + new_node->cycle = (trace_packet->cycle > nt_cycle) ? trace_packet->cycle : nt_cycle; + if( ignore_dependencies || nt_dependencies_cleared( trace_packet ) ) { + // Add to inject queue + queue_push( inject[trace_packet->src], new_node, new_node->cycle ); + nt_total_rd_pck++; + } else { + // Add to waiting queue + queue_push( waiting[trace_packet->src], new_node, new_node->cycle ); + nt_total_rd_pck++; + } + // Get another packet from trace + trace_packet = nt_read_packet(); + } + if( (trace_packet != NULL) && (trace_packet->cycle < nt_cycle) ) { + // Error check: Crash and burn + printf( "ERROR: Invalid trace_packet cycle time: %llu, current cycle: %llu\n", trace_packet->cycle, nt_cycle ); + exit(-1); + } + } + }else {//if ~end_sim_pck_num + read_done=1; + } + + if(eval_numnum_nodes; ++i ) { + nt_packets_left |= !queue_empty( inject[i] ); + //TODO define RRA if multiple netrace sources are mapped to one node. only one can sent packt at each cycle + int pronoc_src = netrace_to_pronoc_map[i]; + //TODO define sent vc policy + int sent_vc = 0; + + if(pck_inj[pronoc_src]->pck_injct_in_pck_wr){ + //the wr_pck should be asserted only for single cycle + pck_inj[pronoc_src]->pck_injct_in_pck_wr = 0; + continue; + } + + pck_inj[pronoc_src]->pck_injct_in_pck_wr = 0; + if((pck_inj[pronoc_src]->pck_injct_out_ready & (0x1<packet; + if( (packet != NULL) && (temp_node->cycle <= nt_cycle) ) { + + if(verbosity>1) { + printf( "Inject: %llu ", nt_cycle ); + nt_print_packet( packet ); + } + temp_node = (queue_node_t*) queue_pop_front( inject[i] ); + temp_node->cycle = nt_cycle;//injection time + queue_push( traverse[packet->dst], temp_node, temp_node->cycle ); + long int ptr_addr = reinterpret_cast (temp_node); + int flit_num = (nt_get_packet_size(packet)* 8) / Fpay; + if(flit_num< pck_inj[pronoc_src]->min_pck_size) flit_num = pck_inj[pronoc_src]->min_pck_size; + int pronoc_dst = netrace_to_pronoc_map[packet->dst]; + if(IS_SELF_LOOP_EN ==0){ + if(packet->dst == pronoc_src ){ + fprintf(stderr,"ERROR: ProNoC is not configured with self-loop enable and Netrace aims to inject\n a " + "packet with identical source and destination address. Enable the SELF_LOOP parameter\n" + "in ProNoC and rebuild the simulation model\n"); + exit(1); + } + } + unsigned int sent_class =0; + pck_inj[pronoc_src]->pck_injct_in_data = ptr_addr; + pck_inj[pronoc_src]->pck_injct_in_size = flit_num; + pck_inj[pronoc_src]->pck_injct_in_endp_addr = endp_addr_encoder(pronoc_dst); + pck_inj[pronoc_src]->pck_injct_in_class_num = sent_class; + pck_inj[pronoc_src]->pck_injct_in_init_weight = 1; + pck_inj[pronoc_src]->pck_injct_in_vc = 0x1<pck_injct_in_pck_wr = 1; + total_sent_pck_num++; + + #if (C>1) + sent_stat[pronoc_src][sent_class].pck_num ++; + sent_stat[pronoc_src][sent_class].flit_num +=flit_num; + #else + sent_stat[pronoc_src].pck_num ++; + sent_stat[pronoc_src].flit_num +=flit_num; + #endif + } + } + } + +/* + // Step all network components, Eject where possible + for( i = 0; i < header->num_nodes; ++i ) { + nt_packets_left |= !queue_empty( traverse[i] ); + queue_node_t* temp_node = (queue_node_t*) queue_peek_front( traverse[i] ); + if( temp_node != NULL ) { + packet = temp_node->packet; + if( (packet != NULL) && (temp_node->cycle <= nt_cycle) ) { + printf( "Eject: %llu ", nt_cycle ); + nt_print_packet( packet ); + nt_clear_dependencies_free_packet( packet ); + temp_node = (queue_node_t*) queue_pop_front( traverse[i] ); + free( temp_node ); + } + } + } +*/ + + // Step all network components, Eject where possible + for( i = 0; i < NE; ++i ) { + nt_packets_left |= !queue_empty( traverse[i] ); + //check which pck injector got a packet + if(pck_inj[i]->pck_injct_out_pck_wr==0) continue; + //we have got a packet + //printf( "data=%lx\n",pck_inj[i]->pck_injct_out_data); + + queue_node_t* temp_node = (queue_node_t*) pck_inj[i]->pck_injct_out_data; + if( temp_node != NULL ) { + packet = temp_node->packet; + if( packet != NULL){ + if(verbosity>1) { + printf( "Eject: %llu ", nt_cycle ); + nt_print_packet( packet ); + } + // remove from traverse + nt_clear_dependencies_free_packet( packet ); + queue_remove( traverse[i], temp_node ); + unsigned long long int clk_num_h2t= (nt_cycle - temp_node->cycle)/netrace_speed_up; + unsigned int clk_num_h2h= clk_num_h2t - pck_inj[i]->pck_injct_out_h2t_delay; + /* + printf("clk_num_h2t (%llu) h2t_delay(%u)\n", clk_num_h2t , pck_inj[i]->pck_injct_out_h2t_delay); + if(clk_num_h2t < pck_inj[i]->pck_injct_out_h2t_delay){ + fprintf(stderr, "ERROR:clk_num_h2t (%llu) is smaller than injector h2t_delay(%u)\n", clk_num_h2t , pck_inj[i]->pck_injct_out_h2t_delay); + exit(1); + } + */ + update_statistic_at_ejection ( + i,// core_num + clk_num_h2h, // clk_num_h2h, + (unsigned int) clk_num_h2t, // clk_num_h2t, + pck_inj[i]->pck_injct_out_distance, // distance, + pck_inj[i]->pck_injct_out_class_num,// class_num, + packet->src// unsigned int src + ); + #if(C>1) + rsvd_stat[i][pck_inj[i]->pck_injct_out_class_num].flit_num +=pck_inj[i]->pck_injct_out_size; + #else + rsvd_stat[i].flit_num+=pck_inj[i]->pck_injct_out_size; + #endif + free( temp_node ); + + } + } + } + // Check for cleared dependences... or not + if( !reader_throttling ) { + for( i = 0; i < header->num_nodes; ++i ) { + nt_packets_left |= !queue_empty( waiting[i] ); + node_t* temp = waiting[i]->head; + while( temp != NULL ) { + queue_node_t* temp_node = (queue_node_t*) temp->elem; + packet = temp_node->packet; + temp = temp->next; + if( nt_dependencies_cleared( packet ) ) { + // remove from waiting + queue_remove( waiting[i], temp_node ); + // add to inject + queue_node_t* new_node = (queue_node_t*) nt_checked_malloc( sizeof(queue_node_t) ); + new_node->packet = packet; + new_node->cycle = nt_cycle + L2_LATENCY; + queue_push( inject[i], new_node, new_node->cycle ); + free( temp_node ); + } + } + } + } + nt_cycle++; +} + + +void netrace_posedge_event(){ + unsigned int i; + clk = 1; // Toggle clock + for(i=0;i #include #include // Defines common routines -//#include "Vrouter1.h" included in parameter.h -#include "Vnoc.h" + #include "Vtraffic.h" -#include "parameter.h" -#include "traffic_task_graph.h" -#include "traffic_synthetic.h" +#include "Vpck_inj.h" +#include +#include +#include -#define RATIO_INIT 2 -#define DISABLE -1 -#define MY_VL_SETBIT_W(data,bit) (data[VL_BITWORD_I(bit)] |= (VL_UL(1) << VL_BITBIT_I(bit))) -#define STND_DEV_EN 1 -#define SYNTHETIC 0 -#define CUSTOM 1 +#include +#include +#include +#include "simulator.h" -//Vrouter *router; -//Vrouter1 *router1[NR]; // Included in parameter.h file -Vnoc *noc; -Vtraffic *traffic[NE]; -int reset,clk; -int TRAFFIC_TYPE=SYNTHETIC; -int PACKET_SIZE=5; -int MIN_PACKET_SIZE=5; -int MAX_PACKET_SIZE=5; -int MAX_PCK_NUM; -int MAX_SIM_CLKs; -int HOTSPOT_NUM; -int C0_p=100, C1_p=0, C2_p=0, C3_p=0; -char * TRAFFIC; -unsigned char FIXED_SRC_DST_PAIR; -unsigned char NEw=0; -unsigned long int main_time = 0; // Current simulation time -unsigned int saved_time = 0; -unsigned int total_pck_num=0; -unsigned int sum_clk_h2h,sum_clk_h2t; -double sum_clk_per_hop; -const int CC=(C==0)? 1 : C; -unsigned int total_pck_num_per_class[CC]={0}; -unsigned int sum_clk_h2h_per_class[CC]={0}; -unsigned int sum_clk_h2t_per_class[CC]={0}; -double sum_clk_per_hop_per_class[CC]={0}; -unsigned int rsvd_core_total_pck_num[NE]= {0}; -unsigned int rsvd_core_worst_delay[NE] = {0}; -unsigned int sent_core_total_pck_num[NE]= {0}; -unsigned int sent_core_worst_delay[NE] = {0}; -unsigned int random_var[NE] = {100}; -unsigned int clk_counter; -unsigned int count_en; -unsigned int total_router; -char all_done=0; -unsigned int flit_counter =0; -int ratio=RATIO_INIT; -double first_avg_latency_flit,current_avg_latency_flit; -double sc_time_stamp (); -int pow2( int ); +int main(int argc, char** argv) { + char change_injection_ratio=0; + int i,j,x,y;//,report_delay_counter=0; -#if (STND_DEV_EN) - //#include - double sqroot (double s){ - int i; - double root = s/3; - if (s<=0) return 0; - for(i=0;i<32;i++) root = (root +s/root)/2; - return root; + char deafult_out[] = {"result"}; + NEw=Log2(NE); + for(i=0;i1) initial_threads(); + + while (!Verilated::gotFinish()) { + + if (main_time-saved_time >= 10 ) { + reset = 0; + } + + if(main_time == saved_time+21){ count_en=1; start_i=1;} + if(main_time == saved_time+23) start_i=0; + + if(TRAFFIC_TYPE==NETRACE) netrace_posedge_event(); + else traffic_clk_posedge_event(); + //The valus of all registers and input ports valuse change @ posedge of the clock. Once clk is deasserted, as multiple modules are connected inside the testbench we need several eval for propogating combinational logic values + //between modules when the clock . + for (i=0;i [synthetic Traffic options]\n" +" %s -f [Task options] or\n" +" %s -F [Netrace options] \n\n" +"synthetic Traffic options:\n" +" -t \"HOTSPOT\", \"RANDOM\", \"BIT_COMPLEMENT\" , \"BIT_REVERSE\",\n " +" \"TORNADO\", \"TRANSPOSE1\", \"TRANSPOSE2\", \"SHUFFEL\", \"CUSTOM\"\n" +" -m packet size format Random-Range or Random-discrete:\n" +" Random-Range : \"R,MIN,MAX\" : The injected packets' size in flits are\n" +" randomly selected in range MIN <= PCK_size <=MAX \n" +" Random-discrete: \"D,S1,S2,..Sn,P,P1,P2,P3,...Pn\": Si are the discrete\n" +" set of numbers representing packet size. The injected packet size is\n" +" randomly selected among these discrete values according to associated\n" +" probability values.\n" +" -c Simulation will stop when simulation clock number reach this value\n" +" -n Simulation will stop when total of sent packets to the noc reaches this number\n" +" -i flit injection ratio in percentage\n" +" -p The percentage of traffic injected for each class. represented in string\n" +" each class ratio is separated by comma. \"n0,n1,n2..\" \n" +" -h represented in a string with following format:\n" +" total number of hotspot nodes, first hotspot node ID, first hotspot node\n" +" send enable(1 or 0),first hotspot node percentage x10,second hotspot node ...\n" +" -H custom traffic pattern: represented in a string with following format:\n" +" \"SRC1,DEST1, SRC2,DEST2, .., SRCn, DESTn\" \n" +" -T total number of threads. The default is one (no-thread). \n" +//" -Q Quick (fast) simulation. ignore evaluating non-active routers \n" +" to speed up simulation time" +"\nTrace options:\n" +" -f path to the task file. any custom task file can be generated using ProNoC gui\n" +" -c Simulation will stop when simulation clock number reach this value \n" +" -T total number of threads. The default is one (no-thread). \n" +//" -Q Quick (fast) simulation. ignore evaluating non-active routers \n" +" to speed up simulation time" +"\nNetrace options:\n" +" -F path to the task file. any custom task file can be generated using ProNoC gui\n" +" -n Simulation will stop when total of sent packets to the NoC reaches this number\n" +" -d ignore dependencies\n" +" -r start region\n" +" -l reader throttling\n" +" -v Verbosity level. 0: off, 1:display a live number of injected packet,\n" +" 3: print injected/ejected packets details, default is 1\n" +" -T total number of threads. The default is one (no-thread). \n" +" -s the speed-up-num is the ratio of netrace frequency to pronoc.The higher value\n" +" results in higher injection ratio to the NoC. Default is one" +//" -Q Quick (fast) simulation. ignore evaluating non-active routers \n" +" to speed up simulation time" , +bin_name,bin_name,bin_name +); + +} + + + +void netrace_processArgs (int argc, char **argv ) +{ + char c; + + /* don't want getopt to moan - I can do that just fine thanks! */ + opterr = 0; + if (argc < 2) usage(argv[0]); + while ((c = getopt (argc, argv, "F:dr:lv:T:n:s:")) != -1) + { + switch (c) + { + case 'F': + TRAFFIC_TYPE=NETRACE; + TRAFFIC=(char *) "NETRACE"; + netrace_file = optarg; + break; + case 'd': + ignore_dependencies=1; + break; + case 'r': + start_region=atoi(optarg); + break; + case 'l': + reader_throttling=1; + break; + case 'v': + verbosity= atoi(optarg); + break; + case 'T': + thread_num = atoi(optarg); + break; + case 'n': + end_sim_pck_num=atoi(optarg); + break; + case 's': + netrace_speed_up=atoi(optarg); + + break; + case '?': + if (isprint (optopt)) + fprintf (stderr, "Unknown option `-%c'.\n", optopt); + else + fprintf (stderr, "Unknown option character `\\x%x'.\n", optopt); + default: + usage(argv[0]); + exit(1); + } + } +} + + + +void synthetic_task_processArgs (int argc, char **argv ) +{ + char c; + int p; + int array[10]; + float f; + + /* don't want getopt to moan - I can do that just fine thanks! */ + opterr = 0; + if (argc < 2) usage(argv[0]); + while ((c = getopt (argc, argv, "t:m:n:c:i:p:h:H:f:T:Q")) != -1) + { + switch (c) + { + case 'f': + TRAFFIC_TYPE=TASK; + TRAFFIC=(char *) "TASK"; + task_traffic_init(optarg); + break; + case 't': + TRAFFIC=optarg; + total_active_routers=-1; + break; + case 's': + MIN_PACKET_SIZE=atoi(optarg); + break; + case 'n': + end_sim_pck_num=atoi(optarg); + break; + case 'c': + sim_end_clk_num=atoi(optarg); + break; + case 'i': + f=atof(optarg); + f*=(MAX_RATIO/100); + ratio= (int) f; + break; + case 'p': + p= parse_string (optarg, array); + if (p==0) { + printf("Warning: class setting is ignored!\n"); + break; + } + class_percentage = (int *) malloc( p * sizeof(int)); + for(int k=0;k1 && p>C){ + printf("Warning: the number of given class %u is larger than the number of message classes in ProNoC (C=%u)!\n",p,C); + } + break; + case 'm': + update_pck_size(optarg); + + break; + case 'H': + update_custom_traffic(optarg); + break; + case 'h': + update_hotspot(optarg); + break; + case 'T': + thread_num = atoi(optarg); + break; + case 'Q': + //Quick_sim_en=1; + fprintf (stderr, "Unknown option `-%c'.\n", optopt); + usage(argv[0]); + exit(1); + break; + case '?': + if (isprint (optopt)) + fprintf (stderr, "Unknown option `-%c'.\n", optopt); + else + fprintf (stderr, "Unknown option character `\\x%x'.\n", optopt); + default: + usage(argv[0]); + exit(1); + } + } +} + + + + int parse_string ( char * str, int * array) { int i=0; @@ -118,8 +304,12 @@ } + + + + unsigned int pck_dst_gen ( unsigned int core_num) { - if(TRAFFIC_TYPE==CUSTOM) return pck_dst_gen_task_graph ( core_num); + if(TRAFFIC_TYPE==TASK) return pck_dst_gen_task_graph ( core_num); if((strcmp (TOPOLOGY,"MESH")==0)||(strcmp (TOPOLOGY,"TORUS")==0)) return pck_dst_gen_2D (core_num); return pck_dst_gen_1D (core_num); } @@ -134,17 +324,17 @@ hotspot_st * new_node; p= parse_string (str, array); if (p<4){ - printf("Error in hotspot traffic parameters \n"); + fprintf(stderr,"ERROR: in hotspot traffic parameters. 4 value should be given as hotspot parameter\n"); exit(1); } HOTSPOT_NUM=array[0]; if (p<1+HOTSPOT_NUM*3){ - printf("Error in hotspot traffic parameters \n"); + fprintf(stderr,"ERROR: in hotspot traffic parameters \n"); exit(1); } new_node = (hotspot_st *) malloc( HOTSPOT_NUM * sizeof(hotspot_st)); if( new_node == NULL){ - printf("Error: cannot allocate memory for hotspot traffic\n"); + fprintf(stderr,"ERROR: cannot allocate memory for hotspot traffic\n"); exit(1); } for (i=1;i<3*HOTSPOT_NUM; i+=3){ @@ -155,271 +345,223 @@ } if(acuum> 1000){ - printf("Warning: The hotspot traffic summation %f exceed than 100 percent. \n", (float) acuum /10); - + printf("Warning: The hotspot traffic summation %f exceed than 100 percent. \n", (float) acuum /10); } hotspots=new_node; } - - -void processArgs (int argc, char **argv ) -{ - char c; - int p; - int array[10]; - float f; - - /* don't want getopt to moan - I can do that just fine thanks! */ - opterr = 0; - if (argc < 2) usage(); - while ((c = getopt (argc, argv, "t:s:m:n:c:i:p:h:f:")) != -1) - { - switch (c) - { - case 'f': - TRAFFIC_TYPE=CUSTOM; - TRAFFIC=(char *) "CUSTOM from file"; - load_traffic_file(optarg,task_graph_data,task_graph_abstract); - MAX_PCK_NUM=task_graph_total_pck_num; - break; - case 't': - TRAFFIC=optarg; - total_active_routers=-1; - break; - case 's': - MIN_PACKET_SIZE=atoi(optarg); - break; - case 'm': - MAX_PACKET_SIZE=atoi(optarg); - break; - case 'n': - MAX_PCK_NUM=atoi(optarg); - break; - case 'c': - MAX_SIM_CLKs=atoi(optarg); - break; - case 'i': - f=atof(optarg); - f*=(MAX_RATIO/100); - ratio= (int) f; - break; - case 'p': - p= parse_string (optarg, array); - C0_p=array[0]; - C1_p=array[1]; - C2_p=array[2]; - C3_p=array[3]; - break; - case 'h': - update_hotspot(optarg); - break; - case '?': - if (isprint (optopt)) - fprintf (stderr, "Unknown option `-%c'.\n", optopt); - else - fprintf (stderr, - "Unknown option character `\\x%x'.\n", - optopt); - default: - usage(); - exit(1); - } - } - PACKET_SIZE=(MIN_PACKET_SIZE+MAX_PACKET_SIZE)/2;// average packet size +void update_custom_traffic (char * str){ + int i; + int array[10000]; + int p; + p= parse_string (str, array); + for (i=0;i array[i]) MIN_PACKET_SIZE = array[i]; + if(MAX_PACKET_SIZE < array[i]) MAX_PACKET_SIZE = array[i]; + } - reset=1; - reset_all_register(); - noc->start_i=0; + p= parse_string (pt2+1, array); + int sum=0; + AVG_PACKET_SIZE=0; + for (i=0; icurrent_e_addr = endp_addr_encoder(i); - traffic[i]->start=0; - traffic[i]->pck_class_in= pck_class_in_gen( i); - traffic[i]->pck_size_in=rnd_between(MIN_PACKET_SIZE,MAX_PACKET_SIZE); - dest_e_addr=pck_dst_gen (i); - traffic[i]->dest_e_addr= dest_e_addr; - //printf("src=%u, des_eaddr=%x, dest=%x\n", i,dest_e_addr, endp_addr_decoder(dest_e_addr)); - traffic[i]->stop=0; - if(TRAFFIC_TYPE==SYNTHETIC){ - traffic[i]->pck_size_in=PACKET_SIZE; - traffic[i]->avg_pck_size_in=PACKET_SIZE; - traffic[i]->ratio=ratio; - traffic[i]->init_weight=1; - } - } + } + } + AVG_PACKET_SIZE/=100; - main_time=0; - print_parameter(); - if(strcmp(TRAFFIC,"CUSTOM from file")) printf("\n\n\n Flit injection ratio per router is =%f \n",(float)ratio*100/MAX_RATIO); - //printf("\n\n\n delay= %u clk",router->delay); - while (!Verilated::gotFinish()) { - - if (main_time-saved_time >= 10 ) { - reset = 0; + if(sum!=100){ + fprintf(stderr,"ERROR: The accumulatio of the first %u probebility values is %u which is not equal to 100\n",in,sum); + exit(1); } - if(main_time == saved_time+21){ count_en=1; noc->start_i=1;}//for(i=0;istart=1;} - if(main_time == saved_time+26) noc->start_i=0;// for(i=0;istart=0; - - if ((main_time % 4) == 0) { - clk = 1; // Toggle clock - if(count_en) clk_counter++; - inject_done= ((total_pck_num >= MAX_PCK_NUM) || (clk_counter>= MAX_SIM_CLKs) || total_active_routers == 0); - //if(inject_done) printf("clk_counter=========%d\n",clk_counter); - for (i=0;iupdate & ~reset){ - update_noc_statistic (i) ; - - } - // the header flit has been sent out - if(traffic[i]->hdr_flit_sent ){ - traffic[i]->pck_class_in= pck_class_in_gen( i); - sent_core_total_pck_num[i]++; - if(!FIXED_SRC_DST_PAIR){ - traffic[i]->pck_size_in=rnd_between(MIN_PACKET_SIZE,MAX_PACKET_SIZE); - dest_e_addr=pck_dst_gen (i); - traffic[i]->dest_e_addr= dest_e_addr; - //printf("src=%u, dest=%x\n", i,endp_addr_decoder(dest_e_addr)); +} - } - } - if(traffic[i]->flit_out_wr==1) flit_counter++; +void task_traffic_init (char * str) { + load_traffic_file(str,task_graph_data,task_graph_abstract); + end_sim_pck_num=task_graph_total_pck_num; + MIN_PACKET_SIZE = task_graph_min_pck_size; + MAX_PACKET_SIZE = task_graph_max_pck_size; + AVG_PACKET_SIZE=(MIN_PACKET_SIZE+MAX_PACKET_SIZE)/2;// average packet size + int p=(MAX_PACKET_SIZE-MIN_PACKET_SIZE)+1; + rsv_size_array = (unsigned int*) calloc ( p , sizeof(int)); + if (rsv_size_array==NULL){ + fprintf(stderr,"ERROR: cannot allocate (%d x int) memory for rsv_size_array. \n",p); + exit(1); + } +} - }//for - if(inject_done) { - for (i=0;ipck_number>0) total_router = total_router +1; - printf(" simulation clock cycles:%d\n",clk_counter); - printf(" total received flits:%d\n",flit_counter); - print_statistic(out_file_name); - change_injection_ratio = 1; - routers_final(); - for(i=0;ifinal(); - noc->final(); - return 0; - } - }//if - else - { - clk = 0; -#if (NR<=64) - noc->ni_flit_in_wr =0; -#else - for(j=0;j<(sizeof(noc->ni_flit_in_wr)/sizeof(noc->ni_flit_in_wr[0])); j++) noc->ni_flit_in_wr[j]=0; -#endif - - connect_all_routers_to_noc (); - - for (i=0;icurrent_r_addr = noc->er_addr[i]; -#if (Fpay<=32) - traffic[i]->flit_in = noc->ni_flit_out [i]; -#else - for(j=0;j<(sizeof(traffic[i]->flit_out)/sizeof(traffic[i]->flit_out[0])); j++) traffic[i]->flit_in[j] = noc->ni_flit_out [i][j]; -#endif - traffic[i]->credit_in= noc->ni_credit_out[i]; - - noc->ni_credit_in[i] = traffic[i]->credit_out; -#if (Fpay<=32) - noc->ni_flit_in [i] = traffic[i]->flit_out; -#else - for(j=0;j<(sizeof(traffic[i]->flit_out)/sizeof(traffic[i]->flit_out[0])); j++) noc->ni_flit_in [i][j] = traffic[i]->flit_out[j]; -#endif +void processArgs (int argc, char **argv ){ + int i; + for( i = 1; i < argc; ++i ) { + if( strcmp(argv[i], "-t") == 0 ) { + synthetic_task_processArgs ( argc, argv ); + return; + } else if( strcmp(argv[i], "-f") == 0 ) { + synthetic_task_processArgs ( argc, argv ); + return; -#if (NE<=64) - if(traffic[i]->flit_out_wr) noc->ni_flit_in_wr = noc->ni_flit_in_wr | ((vluint64_t)1<flit_in_wr= ((noc->ni_flit_out_wr >> i) & 0x01); -#else - if(traffic[i]->flit_out_wr) MY_VL_SETBIT_W(noc->ni_flit_in_wr ,i); - traffic[i]->flit_in_wr= (VL_BITISSET_W(noc->ni_flit_out_wr,i)>0); -#endif + } else if( strcmp(argv[i], "-F") == 0 ) { + netrace_processArgs (argc, argv ); + return; + } + } + fprintf (stderr, "you should define one one of Synthetic,Task or nettrace based simulation. \n"); + usage(argv[0]); + exit(1); +} - }//for - }//else - //if(main_time > 20 && main_time < 30 ) traffic->start=1; else traffic->start=0; - //if(main_time == saved_time+25) router1[0]->flit_in_we_all=0; - //if((main_time % 250)==0) printf("router->all_done =%u\n",router->all_done); - - noc-> clk = clk; - noc-> reset = reset; - - for(i=0;istart= ((noc->start_o >>i)& 0x01); -#else - traffic[i]->start= (VL_BITISSET_W(noc->start_o, i)>0); -#endif - traffic[i]->reset= reset; - traffic[i]->clk = clk; +int get_new_pck_size(){ + if(pck_size_sel == RANDOM_discrete){ + int rnd = rand() % 100; // 0~99 + int i=0; + while( rnd > discrete_prob[i] ) i++; + return discrete_size [i]; } - - connect_routers_reset_clk(); - - //evaluate - noc->eval(); - routers_eval(); - for(i=0;ieval(); + //random range + return rnd_between(MIN_PACKET_SIZE,MAX_PACKET_SIZE); +} - //router1[0]->eval(); // Evaluate model - //printf("clk=%x\n",router->clk ); - main_time++; - //getchar(); - - }// Done simulating - - routers_final(); - for(i=0;ifinal(); - noc->final(); + + +void traffic_gen_final_report(){ + int i; + for (i=0;ipck_number>0) total_active_endp = total_active_endp +1; + printf("\nsimulation results-------------------\n"); + printf("\tSimulation clock cycles:%d\n",clk_counter); + printf("\n\tTotal injected packet in different size:\n"); + printf("\tflit_size,"); + for (i=0;i<=(MAX_PACKET_SIZE - MIN_PACKET_SIZE);i++){ + if(rsv_size_array[i]>0) printf("%u,",i+ MIN_PACKET_SIZE); + } + printf("\n\t#pck,"); + for (i=0;i<=(MAX_PACKET_SIZE - MIN_PACKET_SIZE);i++){ + if(rsv_size_array[i]>0) printf("%u,",rsv_size_array[i]); + } + printf("\n"); + +// printf(" total received flits:%d\n",total_rsv_flit_number); +// printf(" total sent flits:%d\n",total_sent_flit_number); + print_statistic_new (clk_counter); + } +void traffic_gen_init( void ){ + int i; + unsigned int dest_e_addr; + for (i=0;icurrent_e_addr = endp_addr_encoder(i); + traffic[i]->start=0; + traffic[i]->pck_class_in= pck_class_in_gen( i); + traffic[i]->pck_size_in=get_new_pck_size(); + dest_e_addr=pck_dst_gen (i); + traffic[i]->dest_e_addr= dest_e_addr; + if(dest_e_addr == INJECT_OFF) traffic[i]->stop=1; + //printf("src=%u, des_eaddr=%x, dest=%x\n", i,dest_e_addr, endp_addr_decoder(dest_e_addr)); + if(inject_done) traffic[i]->stop=1; + traffic[i]->start_delay=rnd_between(1,4*NE-2); + if(TRAFFIC_TYPE==SYNTHETIC){ + //traffic[i]->avg_pck_size_in=AVG_PACKET_SIZE; + traffic[i]->ratio=ratio; + traffic[i]->init_weight=1; + } + } +} +void pck_inj_init (void){ + int i; + for (i=0;icurrent_e_addr = endp_addr_encoder(i); + //TODO mapping should be done according to number of NE and should be set by the user larer + netrace_to_pronoc_map[i]=(int)((i* NE)/header->num_nodes); + pck_inj[i]->pck_injct_in_ready= (0x1<pck_injct_in_pck_wr=0; + //pronoc_to_netrace_map[i]=i; + } + +} + /************* * sc_time_stamp * @@ -434,8 +576,259 @@ return pw; } +/* +volatile int * lock; +unsigned int nr_per_thread=0; +unsigned int ne_per_thread=0; +void thread_function (int n){ + int i; + unsigned int node=0; + while(1){ + while(lock[n]==0) std::this_thread::yield(); + for(i=0;i= NR) break; + single_router_eval(node); + } + for(i=0;i= NE) break; + if( TRAFFIC_TYPE == NETRACE) pck_inj[node]->eval(); + else traffic[node]->eval(); + } + + //router1[n]->eval(); + //if( TRAFFIC_TYPE == NETRACE) pck_inj[n]->eval(); + //else traffic[n]->eval(); + + lock[n]=0; + if(n==0) break;//first thread is the main process + } +} +*/ +class alignas(64) Vthread +{ + // Access specifier + public: + std::atomic ready; + // Data Members + int n;//thread num + int nr_per_thread; + int ne_per_thread; + // Member Functions() + //Parameterized Constructor + + + void function ( ){ + int i; + unsigned int node=0; + while(1){ + while(!ready) std::this_thread::yield(); + for(i=0;i= NR) break; + //if(router_is_active[node] | (Quick_sim_en==0)) + single_router_eval(node); + } + for(i=0;i= NE) break; + if( TRAFFIC_TYPE == NETRACE) pck_inj[node]->eval(); + else traffic[node]->eval(); + } + + //router1[n]->eval(); + //if( TRAFFIC_TYPE == NETRACE) pck_inj[n]->eval(); + //else traffic[n]->eval(); + + ready=false; + if(n==0) break;//first thread is the main process + } + } + + Vthread(int x,int r,int e) + { + n=x; nr_per_thread=r; ne_per_thread=e; + ready=false; + if(n!=0) { + std::thread th {&Vthread::function,this}; + th.detach(); + } + } + + +}; + +Vthread ** thread; + +void initial_threads (void){ + int i; + //devide nodes equally between threads + unsigned int nr_per_thread=0; + unsigned int ne_per_thread=0; + nr_per_thread = (NR % thread_num)? (unsigned int)(NR/thread_num) + 1 : (unsigned int)(NR/thread_num); + ne_per_thread = (NE % thread_num)? (unsigned int)(NE/thread_num) + 1 : (unsigned int)(NE/thread_num); + + //std::vector threads(thread_num-1); + //lock = new int[thread_num]; + //for(i=0;i1) { + for(i=0;iready=true; + //thread_function (0); + thread[0]->function(); + for(i=0;iready); + }else{// no thread + //routers_eval(); + for(i=0;ieval(); + else for(i=0;ieval(); + } +} + +void sim_final_all (void){ + int i; + routers_final(); + if( TRAFFIC_TYPE == NETRACE) for(i=0;ifinal(); + else for(i=0;ifinal(); + //noc->final(); +} + +void connect_clk_reset_start_all(void){ + int i; + //noc-> clk = clk; + //noc-> reset = reset; + if( TRAFFIC_TYPE == NETRACE) { + for(i=0;ireset= reset; + pck_inj[i]->clk = clk; + } + }else { + for(i=0;istart= start_o[i]; + traffic[i]->reset= reset; + traffic[i]->clk = clk; + } + } + connect_routers_reset_clk(); +} + + +void traffic_clk_negedge_event(void){ + int i; + clk = 0; + //for (i=0;istop=1; + } + connect_clk_reset_start_all(); + sim_eval_all(); +} + + + + +void traffic_clk_posedge_event(void) { + int i; + unsigned int dest_e_addr; + clk = 1; // Toggle clock + if(count_en) clk_counter++; + inject_done= ((total_sent_pck_num >= end_sim_pck_num) || (clk_counter>= sim_end_clk_num) || total_active_routers == 0); + //if(inject_done) printf("clk_counter=========%d\n",clk_counter); + total_rsv_flit_number_old=total_rsv_flit_number; + for (i=0;iupdate & ~reset){ + update_noc_statistic (i) ; + } + // the header flit has been sent out + if(traffic[i]->hdr_flit_sent ){ + traffic[i]->pck_class_in= pck_class_in_gen( i); + sent_core_total_pck_num[i]++; + traffic[i]->pck_size_in=get_new_pck_size(); + if(!FIXED_SRC_DST_PAIR){ + dest_e_addr=pck_dst_gen (i); + traffic[i]->dest_e_addr= dest_e_addr; + if(dest_e_addr == INJECT_OFF) traffic[i]->stop=1; + //printf("src=%u, dest=%x\n", i,endp_addr_decoder(dest_e_addr)); + } + } + + if(traffic[i]->flit_out_wr==1){ + total_sent_flit_number++; + #if (C>1) + sent_stat [i][traffic[i]->flit_out_class].flit_num++; + #else + sent_stat [i].flit_num++; + #endif + } + if(traffic[i]->flit_in_wr==1){ + total_rsv_flit_number++; + #if (C>1) + rsvd_stat [i][traffic[i]->pck_class_out].flit_num++; + #else + rsvd_stat [i].flit_num++; + #endif + } + if(traffic[i]->hdr_flit_sent==1){ + total_sent_pck_num++; + #if (C>1) + sent_stat [i][traffic[i]->flit_out_class].pck_num++; + #else + sent_stat [i].pck_num++; + #endif + } + + }//for + + + if(inject_done){ + if(total_rsv_flit_number_old == total_rsv_flit_number){ + ideal_rsv_cnt++; + if(ideal_rsv_cnt >= 100){ + print_statistic( ); + fprintf(stderr,"ERROR: The number of sent (%u) & received flits (%u) were not equal at the end of simulation\n",total_sent_flit_number, total_rsv_flit_number); + exit(1); + } + } + if(total_sent_flit_number == total_rsv_flit_number ) simulation_done=1; + } + connect_clk_reset_start_all(); + sim_eval_all(); + +} + + /********************************** * * update_noc_statistic @@ -443,15 +836,22 @@ * *********************************/ -void update_noc_statistic ( int core_num){ - unsigned int clk_num_h2h =traffic[core_num]->time_stamp_h2h; - unsigned int clk_num_h2t =traffic[core_num]->time_stamp_h2t; - unsigned int distance=traffic[core_num]->distance; - unsigned int class_num=traffic[core_num]->pck_class_out; - unsigned int src_e_addr=traffic[core_num]->src_e_addr; - unsigned int src = endp_addr_decoder (src_e_addr); - total_pck_num+=1; - if((total_pck_num & 0Xffff )==0 ) printf(" packet sent total=%d\n",total_pck_num); + + +void update_statistic_at_ejection ( + int core_num, + unsigned int clk_num_h2h, + unsigned int clk_num_h2t, + unsigned int distance, + unsigned int class_num, + unsigned int src ){ + + total_rsv_pck_num+=1; + + if( TRAFFIC_TYPE != NETRACE){ + + //old st + if((total_rsv_pck_num & 0Xffff )==0 ) printf(" packet sent total=%d\n",total_rsv_pck_num); sum_clk_h2h+=clk_num_h2h; sum_clk_h2t+=clk_num_h2t; #if (STND_DEV_EN) @@ -459,108 +859,308 @@ sum_clk_pow2_per_class[class_num]+=(double)clk_num_h2h * (double) clk_num_h2h; #endif sum_clk_per_hop+= ((double)clk_num_h2h/(double)distance); - total_pck_num_per_class[class_num]+=1; + //printf("sum_clk_per_hop(%f)+= clk_num_h2h(%u)/distance(%u)\n",sum_clk_per_hop,clk_num_h2h,distance); + total_rsv_pck_num_per_class[class_num]+=1; sum_clk_h2h_per_class[class_num]+=clk_num_h2h ; sum_clk_h2t_per_class[class_num]+=clk_num_h2t ; sum_clk_per_hop_per_class[class_num]+= ((double)clk_num_h2h/(double)distance); rsvd_core_total_pck_num[core_num]=rsvd_core_total_pck_num[core_num]+1; - if (rsvd_core_worst_delay[core_num] < clk_num_h2t) rsvd_core_worst_delay[core_num] = (strcmp (AVG_LATENCY_METRIC,"HEAD_2_TAIL")==0)? clk_num_h2t : clk_num_h2h; - if (sent_core_worst_delay[src] < clk_num_h2t) sent_core_worst_delay[src] = (strcmp (AVG_LATENCY_METRIC,"HEAD_2_TAIL")==0)? clk_num_h2t : clk_num_h2h; + + if (rsvd_core_worst_delay[core_num] < clk_num_h2t) rsvd_core_worst_delay[core_num] = (strcmp (AVG_LATENCY_METRIC,"HEAD_2_TAIL")==0)? clk_num_h2t : clk_num_h2h; + if (sent_core_worst_delay[src] < clk_num_h2t) sent_core_worst_delay[src] = (strcmp (AVG_LATENCY_METRIC,"HEAD_2_TAIL")==0)? clk_num_h2t : clk_num_h2h; + + if( traffic[core_num]->pck_size_o >= MIN_PACKET_SIZE && traffic[core_num]->pck_size_o <=MAX_PACKET_SIZE){ + if(rsv_size_array!=NULL) rsv_size_array[traffic[core_num]->pck_size_o-MIN_PACKET_SIZE]++; + } + } + //new one TODO remove old st + + if(verbosity==0 && TRAFFIC_TYPE == NETRACE) if((total_rsv_pck_num & 0X1FFFF )==0 ) printf(" packet sent total=%d\n",total_rsv_pck_num); + unsigned int latency = (strcmp (AVG_LATENCY_METRIC,"HEAD_2_TAIL")==0)? clk_num_h2t : clk_num_h2h; + #if(C>1) + + rsvd_stat[core_num][class_num].pck_num ++; + rsvd_stat[core_num][class_num].sum_clk_h2h +=clk_num_h2h; + rsvd_stat[core_num][class_num].sum_clk_h2t +=clk_num_h2t; + rsvd_stat[core_num][class_num].sum_clk_per_hop+= ((double)clk_num_h2h/(double)distance); + if (rsvd_stat[core_num][class_num].worst_latency < latency ) rsvd_stat[core_num][class_num].worst_latency =latency; + if (rsvd_stat[core_num][class_num].min_latency==0 ) rsvd_stat[core_num][class_num].min_latency =latency; + if (rsvd_stat[core_num][class_num].min_latency > latency ) rsvd_stat[core_num][class_num].min_latency =latency; + if (sent_stat[src ][class_num].worst_latency < latency ) sent_stat[src ][class_num].worst_latency =latency; + if (sent_stat[src ][class_num].min_latency==0 ) sent_stat[src ][class_num].min_latency =latency; + if (sent_stat[src ][class_num].min_latency > latency ) sent_stat[src ][class_num].min_latency =latency; + + #if (STND_DEV_EN) + rsvd_stat[core_num][class_num].sum_clk_pow2 += (double)clk_num_h2h * (double) clk_num_h2h; + #endif + #else + rsvd_stat[core_num].pck_num ++; + rsvd_stat[core_num].sum_clk_h2h +=(double)clk_num_h2h; + rsvd_stat[core_num].sum_clk_h2t +=(double)clk_num_h2t; + rsvd_stat[core_num].sum_clk_per_hop+= ((double)clk_num_h2h/(double)distance); + if (rsvd_stat[core_num].worst_latency < latency ) rsvd_stat[core_num].worst_latency=latency; + if (rsvd_stat[core_num].min_latency==0 ) rsvd_stat[core_num].min_latency =latency; + if (rsvd_stat[core_num].min_latency > latency ) rsvd_stat[core_num].min_latency =latency; + if (sent_stat[src ].worst_latency < latency ) sent_stat[src ].worst_latency=latency; + if (sent_stat[src ].min_latency==0 ) sent_stat[src ].min_latency =latency; + if (sent_stat[src ].min_latency > latency ) sent_stat[src ].min_latency =latency; + + #if (STND_DEV_EN) + rsvd_stat[core_num].sum_clk_pow2 += (double)clk_num_h2h * (double) clk_num_h2h; + #endif + #endif + + + + + } +void update_noc_statistic ( int core_num){ + unsigned int clk_num_h2h =traffic[core_num]->time_stamp_h2h; + unsigned int clk_num_h2t =traffic[core_num]->time_stamp_h2t; + unsigned int distance=traffic[core_num]->distance; + unsigned int class_num=traffic[core_num]->pck_class_out; + unsigned int src_e_addr=traffic[core_num]->src_e_addr; + unsigned int src = endp_addr_decoder (src_e_addr); + update_statistic_at_ejection ( core_num, clk_num_h2h, clk_num_h2t, distance, class_num, src); -void print_statistic (char * out_file_name){ - double avg_latency_per_hop, avg_latency_flit, avg_latency_pck, avg_throughput,min_avg_latency_per_class; + +} + +avg_st_t finilize_statistic (unsigned long int total_clk, statistic_t rsvd_stat){ + + avg_st_t avg_statistic; + avg_statistic.avg_throughput= ((double)(rsvd_stat.flit_num*100)/NE )/total_clk; + avg_statistic.avg_latency_flit = rsvd_stat.sum_clk_h2h/rsvd_stat.pck_num; + avg_statistic.avg_latency_pck = rsvd_stat.sum_clk_h2t/rsvd_stat.pck_num; + avg_statistic.avg_latency_per_hop = ( rsvd_stat.pck_num==0)? 0 : rsvd_stat.sum_clk_per_hop/rsvd_stat.pck_num; + avg_statistic.avg_pck_siz = ( rsvd_stat.pck_num==0)? 0 : (double)(rsvd_stat.flit_num / rsvd_stat.pck_num); + #if (STND_DEV_EN) + avg_statistic.std_dev =standard_dev( rsvd_stat.sum_clk_pow2,rsvd_stat.pck_num, avg_statistic.avg_latency_flit); + #endif + return avg_statistic; +} + +template + void myout(T value) + { + std::cout << value << std::endl; + } +template + void myout(First first, Rest ... rest) + { + std::cout << first << ","; + myout(rest...); + } + +void print_st_single (unsigned long int total_clk, statistic_t rsvd_stat, statistic_t sent_stat){ + + + + avg_st_t avg; + avg=finilize_statistic (total_clk, rsvd_stat); + + myout( + sent_stat.pck_num, + rsvd_stat.pck_num, + sent_stat.flit_num, + rsvd_stat.flit_num, + sent_stat.worst_latency, + rsvd_stat.worst_latency, + sent_stat.min_latency, + rsvd_stat.min_latency, + avg.avg_latency_per_hop, + avg.avg_latency_flit, + avg.avg_latency_pck, + avg.avg_throughput, + avg.avg_pck_siz, + #if (STND_DEV_EN) + avg.std_dev + #endif + ); +// printf("\n"); + +} + + +void merge_statistic (statistic_t * merge_stat, statistic_t stat_in){ + merge_stat->pck_num+=stat_in.pck_num; + merge_stat->flit_num+=stat_in.flit_num; + if(merge_stat->worst_latency < stat_in.worst_latency) merge_stat->worst_latency= stat_in.worst_latency; + if(merge_stat->min_latency == 0 ) merge_stat->min_latency = stat_in.min_latency; + if(merge_stat->min_latency > stat_in.min_latency && stat_in.min_latency!=0 ) merge_stat->min_latency = stat_in.min_latency; + merge_stat->sum_clk_h2h +=stat_in.sum_clk_h2h ; + merge_stat->sum_clk_h2t +=stat_in.sum_clk_h2t ; + merge_stat->sum_clk_per_hop +=stat_in.sum_clk_per_hop; + #if (STND_DEV_EN) + merge_stat->sum_clk_pow2 +=stat_in.sum_clk_pow2; + #endif + +} + +void print_statistic_new (unsigned long int total_clk){ int i; -#if (STND_DEV_EN) - double std_dev; + printf("\n\t#node," + "sent_stat.pck_num," + "rsvd_stat.pck_num," + "sent_stat.flit_num," + "rsvd_stat.flit_num," + "sent_stat.worst_latency," + "rsvd_stat.worst_latency," + "sent_stat.min_latency," + "rsvd_stat.min_latency," + "avg_latency_per_hop," + "avg_latency_flit," + "avg_latency_pck," + "avg_throughput(%%)," + "avg_pck_size," + #if (STND_DEV_EN) + "avg.std_dev" + #endif + "\n"); + + + +#if(C>1) + int c; + statistic_t sent_stat_class [NE]; + statistic_t rsvd_stat_class [NE]; + statistic_t sent_stat_per_class [C]; + statistic_t rsvd_stat_per_class [C]; + + memset (&rsvd_stat_class,0,sizeof(statistic_t)*NE); + memset (&sent_stat_class,0,sizeof(statistic_t)*NE); + memset (&rsvd_stat_per_class,0,sizeof(statistic_t)*C); + memset (&sent_stat_per_class,0,sizeof(statistic_t)*C); + + + for (i=0; i1) + for (c=0; c0)? ((double)(total_pck_num_per_class[i]*PACKET_SIZE*100)/total_router )/clk_counter:0; - avg_latency_flit = (total_pck_num_per_class[i]>0)? (double)sum_clk_h2h_per_class[i]/total_pck_num_per_class[i]:0; - avg_latency_pck = (total_pck_num_per_class[i]>0)? (double)sum_clk_h2t_per_class[i]/total_pck_num_per_class[i]:0; - avg_latency_per_hop = (total_pck_num_per_class[i]>0)? (double)sum_clk_per_hop_per_class[i]/total_pck_num_per_class[i]:0; -if(strcmp (AVG_LATENCY_METRIC,"HEAD_2_TAIL")==0){ - printf ("\nclass : %d \n",i); - printf (" Total number of packet = %d \n avg_throughput = %f \n average latency per hop = %f \n average latency = %f\n",total_pck_num_per_class[i],avg_throughput,avg_latency_per_hop,avg_latency_pck); - //sprintf(file_name,"%s_c%u.txt",out_file_name,i); - // update_file( file_name,avg_throughput,avg_latency_pck ); -}else{ -printf ("\nclass : %d \n",i); - printf (" Total number of packet = %d \n avg_throughput = %f \n average latency per hop = %f \n average latency = %f\n",total_pck_num_per_class[i],avg_throughput,avg_latency_per_hop,avg_latency_flit); - // sprintf(file_name,"%s_c%u.txt",out_file_name,i); - // update_file( file_name,avg_throughput,avg_latency_flit ); -} - if(min_avg_latency_per_class > avg_latency_flit) min_avg_latency_per_class=avg_latency_flit; +void print_statistic (void){ + double avg_latency_per_hop, avg_latency_flit, avg_latency_pck, avg_throughput,min_avg_latency_per_class; + int i; +#if (STND_DEV_EN) + double std_dev; +#endif + avg_throughput= ((double)(total_sent_flit_number*100)/total_active_endp )/clk_counter; + printf(" Total active Endpoint: %d \n",total_active_endp); + printf(" Avg throughput is: %f (flits/clk/Total active Endpoint %%)\n", avg_throughput); + avg_latency_flit = (double)sum_clk_h2h/total_rsv_pck_num; + avg_latency_pck = (double)sum_clk_h2t/total_rsv_pck_num; + if(ratio==RATIO_INIT) first_avg_latency_flit=avg_latency_flit; #if (STND_DEV_EN) - std_dev= (total_pck_num_per_class[i]>0)? standard_dev( sum_clk_pow2_per_class[i],total_pck_num_per_class[i], avg_latency_flit):0; - // sprintf(file_name,"%s_std%u.txt",out_file_name,i); - // update_file( file_name,avg_throughput,std_dev); + std_dev= standard_dev( sum_clk_pow2,total_rsv_pck_num, avg_latency_flit); + printf(" standard_dev = %f\n",std_dev); +#endif + avg_latency_per_hop = (double)sum_clk_per_hop/total_rsv_pck_num; + printf("\nall : \n"); + printf(" Total number of packet = %d \n average latency per hop = %f \n",total_rsv_pck_num,avg_latency_per_hop); + printf(" average packet latency = %f \n average flit latency = %f \n",avg_latency_pck, avg_latency_flit); + min_avg_latency_per_class=1000000; + printf(" Total injected packet in different size:\n"); + for (i=0;i<=(MAX_PACKET_SIZE - MIN_PACKET_SIZE);i++){ + if(rsv_size_array[i]>0) printf("\t %u flit_sized pck = %u\n",i+ MIN_PACKET_SIZE, rsv_size_array[i]); + } + printf("\n"); + for(i=0;i0)? ((double)(total_rsv_pck_num_per_class[i]*AVG_PACKET_SIZE*100)/total_active_endp )/clk_counter:0; + avg_latency_flit = (total_rsv_pck_num_per_class[i]>0)? (double)sum_clk_h2h_per_class[i]/total_rsv_pck_num_per_class[i]:0; + avg_latency_pck = (total_rsv_pck_num_per_class[i]>0)? (double)sum_clk_h2t_per_class[i]/total_rsv_pck_num_per_class[i]:0; + avg_latency_per_hop = (total_rsv_pck_num_per_class[i]>0)? (double)sum_clk_per_hop_per_class[i]/total_rsv_pck_num_per_class[i]:0; + printf ("\nclass : %d \n",i); + printf (" Total number of packet = %d \n avg_throughput = %f \n average latency per hop = %f \n ",total_rsv_pck_num_per_class[i],avg_throughput,avg_latency_per_hop); + printf (" average packet latency = %f \n average flit latency = %f \n",avg_latency_pck,avg_latency_flit); + if(min_avg_latency_per_class > avg_latency_flit) min_avg_latency_per_class=avg_latency_flit; + +#if (STND_DEV_EN) + std_dev= (total_rsv_pck_num_per_class[i]>0)? standard_dev( sum_clk_pow2_per_class[i],total_rsv_pck_num_per_class[i], avg_latency_flit):0; + printf(" standard_dev = %f\n",std_dev); #endif - }//for - current_avg_latency_flit=min_avg_latency_per_class; - + }//for + current_avg_latency_flit=min_avg_latency_per_class; for (i=0;ipck_number); - printf ("\n\tworst-case-delay of sent pckets (clks): %u\n",sent_core_worst_delay[i] ); + printf ("\n\nEnd_point %d\n",i); + printf ("\n\ttotal number of received packets: %u\n",rsvd_core_total_pck_num[i]); + printf ("\n\tworst-case-delay of received packets (clks): %u\n",rsvd_core_worst_delay[i] ); + printf ("\n\ttotal number of sent packets: %u\n",traffic[i]->pck_number); + printf ("\n\tworst-case-delay of sent packets (clks): %u\n",sent_core_worst_delay[i] ); } + + print_statistic_new (clk_counter); + + } void print_parameter (){ - printf ("Router parameters: \n"); + printf ("NoC parameters:---------------- \n"); printf ("\tTopology: %s\n",TOPOLOGY); printf ("\tRouting algorithm: %s\n",ROUTE_NAME); printf ("\tVC_per port: %d\n", V); - printf ("\tBuffer_width: %d\n", B); + printf ("\tNon-local port buffer_width per VC: %d\n", B); + printf ("\tLocal port buffer_width per VC: %d\n", LB); if((strcmp (TOPOLOGY,"MESH")==0)||(strcmp (TOPOLOGY,"TORUS")==0)){ printf ("\tRouter num in row: %d \n",T1); printf ("\tRouter num in column: %d \n",T2); + printf ("\tEndpoint num per router: %d\n",T3); }else if ((strcmp (TOPOLOGY,"RING")==0)||(strcmp (TOPOLOGY,"LINE")==0)){ - printf ("\t Total Router num: %d \n",T1); + printf ("\tTotal Router num: %d \n",T1); + printf ("\tEndpoint num per router: %d\n",T3); } -else{ +else if ((strcmp (TOPOLOGY,"TREE")==0)||(strcmp (TOPOLOGY,"FATTREE")==0)){ printf ("\tK: %d \n",T1); printf ("\tL: %d \n",T2); +} else{ //CUSTOM + printf ("\tTotal Endpoints number: %d \n",T1); + printf ("\tTotal Routers number: %d \n",T2); } printf ("\tNumber of Class: %d\n", C); printf ("\tFlit data width: %d \n", Fpay); @@ -572,21 +1172,22 @@ printf ("\tSSA_EN enabled:%s \n",SSA_EN); printf ("\tSwitch allocator arbitration type:%s \n",SWA_ARBITER_TYPE); printf ("\tMinimum supported packet size:%d flit(s) \n",MIN_PCK_SIZE); - - - printf ("\nSimulation parameters\n"); + printf ("\tLoop back is enabled:%s",SELF_LOOP_EN); + printf ("\tNumber of multihop bypass (SMART max):%d \n",SMART_MAX); + printf ("NoC parameters:---------------- \n"); + printf ("\nSimulation parameters-------------\n"); #if(DEBUG_EN) printf ("\tDebuging is enabled\n"); #else printf ("\tDebuging is disabled\n"); #endif - if(strcmp (AVG_LATENCY_METRIC,"HEAD_2_TAIL")==0)printf ("\tOutput is the average latency on sending the packet header until receiving tail\n"); - else printf ("\tOutput is the average latency on sending the packet header until receiving header flit at destination node\n"); + //if(strcmp (AVG_LATENCY_METRIC,"HEAD_2_TAIL")==0)printf ("\tOutput is the average latency on sending the packet header until receiving tail\n"); + //else printf ("\tOutput is the average latency on sending the packet header until receiving header flit at destination node\n"); printf ("\tTraffic pattern:%s\n",TRAFFIC); - if(C>0) printf ("\ttraffic percentage of class 0 is : %d\n", C0_p); - if(C>1) printf ("\ttraffic percentage of class 1 is : %d\n", C1_p); - if(C>2) printf ("\ttraffic percentage of class 2 is : %d\n", C2_p); - if(C>3) printf ("\ttraffic percentage of class 3 is : %d\n", C3_p); + size_t n = sizeof(class_percentage)/sizeof(class_percentage[0]); + for(int p=0;pratio=0; traffic[src]->stop=1; - return src; //disable sending + return INJECT_OFF; //disable sending } if( read(task_graph_data[src],index,&task)==0){ traffic[src]->ratio=0; traffic[src]->stop=1; - return src; //disable sending + return INJECT_OFF; //disable sending } @@ -738,7 +1354,7 @@ task.byte_sent = task.byte_sent + (task.avg_pck_size * (Fpay/8) ); traffic[src]->pck_class_in= pck_class_in_gen(src); - traffic[src]->avg_pck_size_in=task.avg_pck_size; + //traffic[src]->avg_pck_size_in=task.avg_pck_size; traffic[src]->pck_size_in=rnd_between(task.min_pck_size,task.max_pck_size); f= task.injection_rate; @@ -767,12 +1383,12 @@ traffic[src]->ratio=0; traffic[src]->stop=1; if(total_active_routers!=0) total_active_routers--; - return src; + return INJECT_OFF; } if(task_graph_abstract[src].active_index>=task_graph_abstract[src].total_index) task_graph_abstract[src].active_index=0; } - return task.dst; + return endp_addr_encoder(task.dst); }
/simulator.h
0,0 → 1,272
 
#ifndef SIMULATOR_H
#define SIMULATOR_H
 
#if (__cplusplus > 201103L) //"C++11\n";
 
void* operator new(std::size_t size, std::align_val_t align) {
#if defined(_WIN32) || defined(__CYGWIN__)
auto ptr = _aligned_malloc(size, static_cast<std::size_t>(align));
#else
auto ptr = aligned_alloc(static_cast<std::size_t>(align), size);
#endif
 
if (!ptr)
throw std::bad_alloc{};
/*
std::cout << "new: " << size << ", align: "
<< static_cast<std::size_t>(align)
<< ", ptr: " << ptr << '\n';
*/
return ptr;
 
}
 
void operator delete(void* ptr, std::size_t size, std::align_val_t align) noexcept {
/*
std::cout << "delete: " << size << ", align: "
<< static_cast<std::size_t>(align)
<< ", ptr : " << ptr << '\n';
*/
#if defined(_WIN32) || defined(__CYGWIN__)
_aligned_free(ptr);
#else
free(ptr);
#endif
}
 
void operator delete(void* ptr, std::align_val_t align) noexcept {
/* std::cout << "delete: align: "
<< static_cast<std::size_t>(align)
<< ", ptr : " << ptr << '\n';
*/
#if defined(_WIN32) || defined(__CYGWIN__)
_aligned_free(ptr);
#else
free(ptr);
#endif
}
 
#endif
 
 
//traffic type
#define SYNTHETIC 0
#define TASK 1
#define NETRACE 2
#define STND_DEV_EN 1
 
 
int TRAFFIC_TYPE=SYNTHETIC;
 
 
void * addr1;
void * addr2;
int get_router_num (int , int );
 
 
#define ideal_port router_top_v__DOT__router__DOT__router_is_ideal
#define active_port router_top_v__DOT__router__DOT__nb_router_active
#define pck_active_port packet_injector_verilator__DOT__endp_is_active
#define traffic_active_port traffic_gen_top__DOT__endp_is_active
 
#define CHAN_SIZE sizeof(router1[0]->chan_in[0])
 
#define conect_r2r(T1,r1,p1,T2,r2,p2) \
memcpy(&router##T1 [r1]->chan_in[p1] , &router##T2 [r2]->chan_out[p2], CHAN_SIZE );
// router_is_active[get_router_num(T1,r1)] |=(( router##T1 [r1]-> ideal_port!=0) | (router##T2 [r2]-> active_port[p2]==1))
 
#define connect_r2gnd(T,r,p)\
memset(&router##T [r]->chan_in [p],0x00,CHAN_SIZE)
 
#define connect_r2e(T,r,p,e) \
addr1=(TRAFFIC_TYPE==NETRACE)? &pck_inj[e]->chan_out : &traffic[e]->chan_out;\
addr2=(TRAFFIC_TYPE==NETRACE)? &pck_inj[e]->chan_in : &traffic[e]->chan_in;\
memcpy(&router##T [r]->chan_in[p], addr1, CHAN_SIZE );\
memcpy(addr2, &router##T [r]->chan_out[p], CHAN_SIZE );
// router_is_active[get_router_num(T,r)] |= (TRAFFIC_TYPE==NETRACE)? \
(( router##T [r]-> ideal_port!=0) | (pck_inj[e]->pck_active_port==1)):\
(( router##T [r]-> ideal_port!=0) | (traffic[e]->traffic_active_port==1))
 
 
 
 
#define IS_SELF_LOOP_EN (strcmp(SELF_LOOP_EN ,"YES")==0)
 
 
#include "parameter.h"
//alignas(64) int router_is_active [NR]={1};
 
int reset,clk;
 
Vtraffic *traffic[NE]; // for synthetic and trace traffic pattern
Vpck_inj *pck_inj[NE]; // for netrace
 
unsigned int total_rsv_pck_num=0;
unsigned int total_sent_pck_num=0;
unsigned int end_sim_pck_num=0;
unsigned int sim_end_clk_num;
unsigned long int nt_tr_list_pck=0;
int netrace_speed_up =1;
 
unsigned int * rsv_size_array;
int AVG_PACKET_SIZE=5;
int MIN_PACKET_SIZE=5;
int MAX_PACKET_SIZE=5;
 
unsigned int rsvd_core_total_pck_num[NE]= {0};
unsigned int rsvd_core_total_flit_num[NE]= {0};
unsigned int rsvd_core_worst_delay[NE] = {0};
unsigned int sent_core_total_pck_num[NE]= {0};
unsigned int sent_core_total_flit_num[NE]= {0};
unsigned int sent_core_worst_delay[NE] = {0};
unsigned int random_var[NE] = {100};
 
 
typedef struct statistic_struct {
unsigned int pck_num;
unsigned int flit_num;
unsigned int worst_latency;
unsigned int min_latency;
double sum_clk_h2h;
double sum_clk_h2t;
double sum_clk_per_hop;
#if (STND_DEV_EN)
double sum_clk_pow2;
#endif
 
} statistic_t;
 
 
typedef struct avg_st_struct {
double avg_latency_per_hop;
double avg_latency_flit;
double avg_latency_pck;
double avg_throughput;
double avg_pck_siz;
#if (STND_DEV_EN)
double std_dev;
#endif
 
} avg_st_t;
 
#if (C>1)
statistic_t sent_stat [NE][C];
statistic_t rsvd_stat [NE][C];
#else
statistic_t sent_stat [NE];
statistic_t rsvd_stat [NE];
#endif
 
 
 
void update_statistic_at_ejection ( int , unsigned int, unsigned int, unsigned int, unsigned int, unsigned int );
void update_noc_statistic ( int);
unsigned char pck_class_in_gen(unsigned int);
unsigned int pck_dst_gen_task_graph ( unsigned int);
void print_statistic (void);
void print_parameter();
void reset_all_register();
void sim_eval_all (void);
void sim_final_all (void);
void traffic_clk_negedge_event(void);
void traffic_clk_posedge_event(void);
void connect_clk_reset_start_all(void);
unsigned int rnd_between (unsigned int, unsigned int );
void traffic_gen_init( void );
void pck_inj_init(void);
void traffic_gen_final_report(void);
void processArgs (int, char ** );
void task_traffic_init (char * );
int parse_string ( char *, int *);
void update_pck_size(char *);
void update_custom_traffic (char *);
void update_hotspot(char * );
void initial_threads (void);
void print_statistic_new (unsigned long int);
 
 
 
#include "topology_top.h"
#include "traffic_task_graph.h"
#include "traffic_synthetic.h"
#include "netrace_lib.h"
 
 
#define RATIO_INIT 2
#define DISABLE -1
#define MY_VL_SETBIT_W(data,bit) (data[VL_BITWORD_I(bit)] |= (VL_UL(1) << VL_BITBIT_I(bit)))
 
#define RANDOM_RANGE 1
#define RANDOM_discrete 2
 
 
 
 
 
 
 
int HOTSPOT_NUM;
int * class_percentage;
char * TRAFFIC;
char * netrace_file;
unsigned char FIXED_SRC_DST_PAIR;
unsigned char NEw=0;
unsigned long int main_time = 0; // Current simulation time
unsigned int saved_time = 0;
 
unsigned int sum_clk_h2h=0;
unsigned int sum_clk_h2t=0;
double sum_clk_per_hop=0;
const int CC=(C==0)? 1 : C;
unsigned int total_rsv_pck_num_per_class[CC]={0};
unsigned int sum_clk_h2h_per_class[CC]={0};
unsigned int sum_clk_h2t_per_class[CC]={0};
double sum_clk_per_hop_per_class[CC]={0};
 
unsigned int clk_counter,ideal_rsv_cnt;
unsigned int count_en;
unsigned int total_active_endp;
char all_done=0;
unsigned int total_sent_flit_number =0;
unsigned int total_rsv_flit_number =0;
unsigned int total_rsv_flit_number_old=0;
int ratio=RATIO_INIT;
double first_avg_latency_flit,current_avg_latency_flit;
double sc_time_stamp ();
int pow2( int );
char inject_done=0;
char simulation_done=0;
char pck_size_sel=RANDOM_RANGE;
int * discrete_size;
int * discrete_prob;
int verbosity=1;
int thread_num =1;
 
 
 
 
 
 
#if (STND_DEV_EN)
//#include <math.h>
double sqroot (double s){
int i;
double root = s/3;
if (s<=0) return 0;
for(i=0;i<32;i++) root = (root +s/root)/2;
return root;
}
double sum_clk_pow2=0;
double sum_clk_pow2_per_class[C];
double standard_dev( double , unsigned int, double);
#endif
 
 
 
 
#endif
 
/topology/custom/custom1_noc.h
0,0 → 1,155
 
 
 
 
void topology_connect_all_nodes (void){
//Connect R0 input ports 0 to T0 output ports 0
connect_r2e(1,0,0,0);
//Connect R0 input ports 1 to R14 output ports 3
conect_r2r(1,0,1,2,6,3);
//Connect R0 input ports 2 to R13 output ports 3
conect_r2r(1,0,2,2,5,3);
//Connect R1 input ports 0 to T1 output ports 0
connect_r2e(1,1,0,1);
//Connect R1 input ports 1 to R7 output ports 3
conect_r2r(1,1,1,2,3,3);
//Connect R1 input ports 2 to R2 output ports 2
conect_r2r(1,1,2,1,2,2);
//Connect R2 input ports 0 to T2 output ports 0
connect_r2e(1,2,0,2);
//Connect R2 input ports 1 to R15 output ports 2
conect_r2r(1,2,1,2,7,2);
//Connect R2 input ports 2 to R1 output ports 2
conect_r2r(1,2,2,1,1,2);
//Connect R3 input ports 0 to T3 output ports 0
connect_r2e(1,3,0,3);
//Connect R3 input ports 1 to R15 output ports 3
conect_r2r(1,3,1,2,7,3);
//Connect R3 input ports 2 to R4 output ports 2
conect_r2r(1,3,2,2,0,2);
//Connect R4 input ports 0 to T4 output ports 0
connect_r2e(2,0,0,4);
//Connect R4 input ports 1 to R9 output ports 2
conect_r2r(2,0,1,3,1,2);
//Connect R4 input ports 2 to R3 output ports 2
conect_r2r(2,0,2,1,3,2);
//Connect R4 input ports 3 to R6 output ports 3
conect_r2r(2,0,3,2,2,3);
//Connect R5 input ports 0 to T5 output ports 0
connect_r2e(2,1,0,5);
//Connect R5 input ports 1 to R11 output ports 4
conect_r2r(2,1,1,3,3,4);
//Connect R5 input ports 2 to R6 output ports 2
conect_r2r(2,1,2,2,2,2);
//Connect R5 input ports 3 to R13 output ports 2
conect_r2r(2,1,3,2,5,2);
//Connect R6 input ports 0 to T6 output ports 0
connect_r2e(2,2,0,6);
//Connect R6 input ports 1 to R9 output ports 3
conect_r2r(2,2,1,3,1,3);
//Connect R6 input ports 2 to R5 output ports 2
conect_r2r(2,2,2,2,1,2);
//Connect R6 input ports 3 to R4 output ports 3
conect_r2r(2,2,3,2,0,3);
//Connect R7 input ports 0 to T7 output ports 0
connect_r2e(2,3,0,7);
//Connect R7 input ports 1 to R12 output ports 3
conect_r2r(2,3,1,2,4,3);
//Connect R7 input ports 2 to R14 output ports 2
conect_r2r(2,3,2,2,6,2);
//Connect R7 input ports 3 to R1 output ports 1
conect_r2r(2,3,3,1,1,1);
//Connect R12 input ports 0 to T8 output ports 0
connect_r2e(2,4,0,8);
//Connect R12 input ports 1 to R8 output ports 4
conect_r2r(2,4,1,3,0,4);
//Connect R12 input ports 2 to R10 output ports 3
conect_r2r(2,4,2,3,2,3);
//Connect R12 input ports 3 to R7 output ports 1
conect_r2r(2,4,3,2,3,1);
//Connect R13 input ports 0 to T9 output ports 0
connect_r2e(2,5,0,9);
//Connect R13 input ports 1 to R8 output ports 2
conect_r2r(2,5,1,3,0,2);
//Connect R13 input ports 2 to R5 output ports 3
conect_r2r(2,5,2,2,1,3);
//Connect R13 input ports 3 to R0 output ports 2
conect_r2r(2,5,3,1,0,2);
//Connect R14 input ports 0 to T10 output ports 0
connect_r2e(2,6,0,10);
//Connect R14 input ports 1 to R8 output ports 3
conect_r2r(2,6,1,3,0,3);
//Connect R14 input ports 2 to R7 output ports 2
conect_r2r(2,6,2,2,3,2);
//Connect R14 input ports 3 to R0 output ports 1
conect_r2r(2,6,3,1,0,1);
//Connect R15 input ports 0 to T11 output ports 0
connect_r2e(2,7,0,11);
//Connect R15 input ports 1 to R10 output ports 4
conect_r2r(2,7,1,3,2,4);
//Connect R15 input ports 2 to R2 output ports 1
conect_r2r(2,7,2,1,2,1);
//Connect R15 input ports 3 to R3 output ports 1
conect_r2r(2,7,3,1,3,1);
//Connect R8 input ports 0 to T12 output ports 0
connect_r2e(3,0,0,12);
//Connect R8 input ports 1 to R11 output ports 1
conect_r2r(3,0,1,3,3,1);
//Connect R8 input ports 2 to R13 output ports 1
conect_r2r(3,0,2,2,5,1);
//Connect R8 input ports 3 to R14 output ports 1
conect_r2r(3,0,3,2,6,1);
//Connect R8 input ports 4 to R12 output ports 1
conect_r2r(3,0,4,2,4,1);
//Connect R9 input ports 0 to T13 output ports 0
connect_r2e(3,1,0,13);
//Connect R9 input ports 1 to R11 output ports 3
conect_r2r(3,1,1,3,3,3);
//Connect R9 input ports 2 to R4 output ports 1
conect_r2r(3,1,2,2,0,1);
//Connect R9 input ports 3 to R6 output ports 1
conect_r2r(3,1,3,2,2,1);
//Connect R9 input ports 4 to R10 output ports 2
conect_r2r(3,1,4,3,2,2);
//Connect R10 input ports 0 to T14 output ports 0
connect_r2e(3,2,0,14);
//Connect R10 input ports 1 to R11 output ports 2
conect_r2r(3,2,1,3,3,2);
//Connect R10 input ports 2 to R9 output ports 4
conect_r2r(3,2,2,3,1,4);
//Connect R10 input ports 3 to R12 output ports 2
conect_r2r(3,2,3,2,4,2);
//Connect R10 input ports 4 to R15 output ports 1
conect_r2r(3,2,4,2,7,1);
//Connect R11 input ports 0 to T15 output ports 0
connect_r2e(3,3,0,15);
//Connect R11 input ports 1 to R8 output ports 1
conect_r2r(3,3,1,3,0,1);
//Connect R11 input ports 2 to R10 output ports 1
conect_r2r(3,3,2,3,2,1);
//Connect R11 input ports 3 to R9 output ports 1
conect_r2r(3,3,3,3,1,1);
//Connect R11 input ports 4 to R5 output ports 1
conect_r2r(3,3,4,2,1,1);
 
}
 
void topology_init(void){
router1[0]->current_r_addr=0;
router1[1]->current_r_addr=1;
router1[2]->current_r_addr=2;
router1[3]->current_r_addr=3;
router2[0]->current_r_addr=4;
router2[1]->current_r_addr=5;
router2[2]->current_r_addr=6;
router2[3]->current_r_addr=7;
router2[4]->current_r_addr=8;
router2[5]->current_r_addr=9;
router2[6]->current_r_addr=10;
router2[7]->current_r_addr=11;
router3[0]->current_r_addr=12;
router3[1]->current_r_addr=13;
router3[2]->current_r_addr=14;
router3[3]->current_r_addr=15;
 
}
/topology/fattree.h
0,0 → 1,231
#ifndef FATTREE_H
#define FATTREE_H
 
 
 
unsigned int Lw;
unsigned int Kw;
unsigned int LKw;
unsigned int RAw_FATTREE;
unsigned int EAw_FATTREE;
unsigned int NE_FATTREE;
unsigned int NR_FATTREE;
unsigned int DSTPw_FATTREE ;
unsigned int MAX_P_FATTREE ;
 
 
unsigned int NPOS = powi( K, L-1);
unsigned int CHAN_PER_DIRECTION = (K * powi( L , L-1 )); //up or down
unsigned int CHAN_PER_LEVEL = 2*(K * powi( K , L-1 )); //up+down
 
 
 
 
 
 
 
inline void fatree_local_addr (unsigned int t1, unsigned int r1, unsigned int addr){
if (t1==1 ) router1[r1]->current_r_addr = addr;
else router2[r1]->current_r_addr = addr;
}
 
 
unsigned int fattree_addrencode( unsigned int pos, unsigned int k, unsigned int l){
unsigned int pow,i,tmp=0;
unsigned int addrencode=0;
unsigned int kw=0;
while((0x1<<kw) < k)kw++;
pow=1;
for (i = 0; i <l; i=i+1 ) {
tmp=(pos/pow);
tmp=tmp%k;
tmp=tmp<<(i)*kw;
addrencode=addrencode | tmp;
pow=pow * k;
}
return addrencode;
}
 
 
unsigned int fattree_addrdecode(unsigned int addrencode , unsigned int k, unsigned int l){
unsigned int kw=0;
unsigned int mask=0;
unsigned int pow,i,tmp;
unsigned int pos=0;
while((0x1<<kw) < k){
kw++;
mask<<=1;
mask|=0x1;
}
pow=1;
for (i = 0; i <l; i=i+1 ) {
tmp = addrencode & mask;
tmp=(tmp*pow);
pos= pos + tmp;
pow=pow * k;
addrencode>>=kw;
}
return pos;
}
 
unsigned int endp_addr_encoder ( unsigned int id){
return fattree_addrencode(id, T1, T2);
}
 
unsigned int endp_addr_decoder (unsigned int code){
return fattree_addrdecode(code, T1, T2);
}
 
 
void topology_init (void){
unsigned int pos,level,port;
 
Lw= Log2(L);
Kw=Log2(K);
LKw=L*Kw;
RAw_FATTREE = LKw + Lw;
EAw_FATTREE = LKw;
NE_FATTREE = powi( K,L );
NR_FATTREE = L * powi( K , L - 1 ); // total number of routers
DSTPw_FATTREE = K+1;
MAX_P_FATTREE = 2*K;
#define NRL (NE/K) //number of router in each layer
 
unsigned int num = 0;
//connect all down input chanels
for (level = 0; level<L-1; level=level+1) {// : level_c
/* verilator lint_off WIDTH */
unsigned int LEAVE_L = L-1-level;
/* verilator lint_on WIDTH */
//input chanel are numbered interleavely, the interleaev dep}s on level
unsigned int ROUTERS_PER_NEIGHBORHOOD = powi(K,L-1-(level));
unsigned int ROUTERS_PER_BRANCH = powi(K,L-1-(level+1));
unsigned int LEVEL_OFFSET = ROUTERS_PER_NEIGHBORHOOD*K;
for ( pos = 0; pos < NPOS; pos=pos+1 ) {// : pos_c
unsigned int ADRRENCODED=fattree_addrencode(pos,K,L);
unsigned int NEIGHBORHOOD = (pos/ROUTERS_PER_NEIGHBORHOOD);
unsigned int NEIGHBORHOOD_POS = pos % ROUTERS_PER_NEIGHBORHOOD;
for ( port = 0; port < K; port=port+1 ) {// : port_c
unsigned int LINK =
((level+1)*CHAN_PER_LEVEL - CHAN_PER_DIRECTION) //which levellevel
+NEIGHBORHOOD* LEVEL_OFFSET //region in level
+port*ROUTERS_PER_BRANCH*K //sub region in region
+(NEIGHBORHOOD_POS)%ROUTERS_PER_BRANCH*K //router in subregion
+(NEIGHBORHOOD_POS)/ROUTERS_PER_BRANCH; //port on router
 
 
unsigned int L2= (LINK+CHAN_PER_DIRECTION)/CHAN_PER_LEVEL;
unsigned int POS2 = ((LINK+CHAN_PER_DIRECTION) % CHAN_PER_LEVEL)/K;
unsigned int PORT2= (((LINK+CHAN_PER_DIRECTION) % CHAN_PER_LEVEL) %K)+K;
unsigned int ID1 =NRL*level+pos;
unsigned int ID2 =NRL*L2 + POS2;
unsigned int POS_ADR_CODE2= fattree_addrencode(POS2,K,L);
unsigned int POS_ADR_CODE1= fattree_addrencode(pos,K,L);
//fattree_connect(Ti(ID1),Ri(ID1),port,Ti(ID2),Ri(ID2),PORT2);
r2r_cnt_all[num] =(r2r_cnt_table_t){.t1=Ti(ID1), .r1=Ri(ID1), .p1=port, .t2=Ti(ID2), .r2=Ri(ID2), .p2=PORT2 };
unsigned int current_layer_addr = LEAVE_L;
unsigned int current_pos_addr = ADRRENCODED;
unsigned int addr = (current_layer_addr << LKw)| current_pos_addr;
//printf( "[%u] = t1=%u, r1=%u, p1=%u, t2=%u, r2=%u, p2=%u \n", num, r2r_cnt_all[num].t1, r2r_cnt_all[num].r1, r2r_cnt_all[num].p1, r2r_cnt_all[num].t2, r2r_cnt_all[num].r2, r2r_cnt_all[num].p2 );
//assign current_r_addr [ID1] = {current_layer_addr [ID1],current_pos_addr[ID1]};
fatree_local_addr(Ti(ID1),Ri(ID1), addr);
 
if(level==L-2){//
current_layer_addr =0;
current_pos_addr = POS_ADR_CODE2;
addr = (current_layer_addr << LKw)| current_pos_addr;
//assign current_r_addr [ID2] = {current_layer_addr [ID2],current_pos_addr[ID2]};
fatree_local_addr(Ti(ID2),Ri(ID2), addr);
}//if
num++;
}
}
}
for ( pos = 0; pos < NE; pos=pos+1 ) {// : }points
unsigned int RID= NRL*(L-1)+(pos/K);
unsigned int RPORT = pos%K;
//connected router encoded address
unsigned int CURRENTPOS= fattree_addrencode(pos/K,K,L);
//assign router_chan_out [RID][RPORT] = chan_in_all [pos];
//assign chan_out_all [pos] = router_chan_in [RID][RPORT];
//assign er_addr [pos] = CURRENTPOS [RAw-1 : 0];
r2e_cnt_all[pos].r1=Ri(RID);
r2e_cnt_all[pos].p1=RPORT;
er_addr [pos] = CURRENTPOS;
 
//printf( "[%u] =r1=%u,p1=%u\n",pos,r2e_cnt_all[pos].r1,r2e_cnt_all[pos].p1);
 
//connect_r2e(2,Ri(RID),RPORT,pos);
}
}
 
 
 
 
 
 
 
 
void topology_connect_all_nodes (void){
 
unsigned int pos,level,port;
unsigned int num = 0;
for (level = 0; level<L-1; level=level+1) {// : level_c
for ( pos = 0; pos < NPOS; pos=pos+1 ) {// : pos_c
for ( port = 0; port < K; port=port+1 ) {// : port_c
fattree_connect(r2r_cnt_all[num]);
num++;
}
}
}
for ( pos = 0; pos < NE; pos=pos+1 ) {// : }points
connect_r2e(2,r2e_cnt_all[pos].r1,r2e_cnt_all[pos].p1,pos);
 
}
}
 
 
 
unsigned int get_mah_distance ( unsigned int id1, unsigned int id2){
 
unsigned int k =T1;
unsigned int l =T2;
 
unsigned int pow,tmp1,tmp2;
unsigned int distance=0;
pow=1;
for (unsigned int i = 0; i <l; i=i+1 ) {
tmp1=(id1/pow);
tmp2=(id2/pow);
tmp1=tmp1 % k;
tmp2=tmp2 % k;
pow=pow * k;
if(tmp1!=tmp2) distance= (i+1)*2-1 ; //distance obtained based on the highest level index which differ
 
}
return distance;
}
 
 
 
 
 
#endif
/topology/mesh.h
0,0 → 1,324
#ifndef MESH_H
#define MESH_H
 
#define LOCAL 0
#define EAST 1
#define NORTH 2
#define WEST 3
#define SOUTH 4
 
//ring line
#define FORWARD 1
#define BACKWARD 2
#define router_id(x,y) ((y * T1) + x)
#define endp_id(x,y,l) ((y * T1) + x) * T3 + l
 
 
 
unsigned int nxw=0;
unsigned int nyw=0;
unsigned int maskx=0;
unsigned int masky=0;
 
 
 
void mesh_tori_addrencod_sep(unsigned int id, unsigned int *x, unsigned int *y, unsigned int *l){
(*l)=id%T3; // id%NL
(*x)=(id/T3)%T1;// (id/NL)%NX
(*y)=(id/T3)/T1;// (id/NL)/NX
}
 
 
void mesh_tori_addr_sep(unsigned int code, unsigned int *x, unsigned int *y, unsigned int *l){
(*x) = code & maskx;
code>>=nxw;
(*y) = code & masky;
code>>=nyw;
(*l) = code;
}
 
 
 
unsigned int mesh_tori_addr_join(unsigned int x, unsigned int y, unsigned int l){
 
unsigned int addrencode=0;
addrencode =(T3==1)? (y<<nxw | x) : (l<<(nxw+nyw)| (y<<nxw) | x);
return addrencode;
}
 
unsigned int mesh_tori_addrencode (unsigned int id){
unsigned int y, x, l;
mesh_tori_addrencod_sep(id,&x,&y,&l);
return mesh_tori_addr_join(x,y,l);
}
 
 
void fmesh_addrencod_sep(unsigned int id, unsigned int *x, unsigned int *y, unsigned int *p){
unsigned int l, diff,mul,addrencode;
mul = T1*T2*T3;
if(id < mul) {
*y = ((id/T3) / T1 );
*x = ((id/T3) % T1 );
l = (id % T3);
*p = (l==0)? LOCAL : 4+l;
}else{
diff = id - mul ;
if( diff < T1) { //top mesh edge
*y = 0;
*x = diff;
*p = NORTH;
} else if ( diff < 2* T1) { //bottom mesh edge
*y = T2-1;
*x = diff-T1;
*p = SOUTH;
} else if ( diff < (2* T1) + T2 ) { //left mesh edge
*y = diff - (2* T1);
*x = 0;
*p = WEST;
} else { //right mesh edge
*y = diff - (2* T1) -T2;
*x = T1-1;
*p = EAST;
}
}
 
}
 
 
unsigned int fmesh_addrencode(unsigned int id){
//input integer in,nx,nxw,nl,nyw,ny;
unsigned int y, x, p, addrencode;
fmesh_addrencod_sep(id, &x, &y, &p);
addrencode = ( p<<(nxw+nyw) | (y<<nxw) | x);
return addrencode;
}
 
 
unsigned int fmesh_endp_addr_decoder (unsigned int code){
unsigned int x, y, p;
mesh_tori_addr_sep(code,&x,&y,&p);
if(p== LOCAL) return ((y*T1)+x)*T3;
if(p > SOUTH) return ((y*T1)+x)*T3+(p-SOUTH);
if(p== NORTH) return ((T1*T2*T3) + x);
if(p== SOUTH) return ((T1*T2*T3) + T1 + x);
if(p== WEST ) return ((T1*T2*T3) + 2*T1 + y);
if(p== EAST ) return ((T1*T2*T3) + 2*T1 + T2 + y);
return 0;//should not reach here
}
 
 
 
 
 
 
unsigned int mesh_tori_endp_addr_decoder (unsigned int code){
unsigned int x, y, l;
mesh_tori_addr_sep(code,&x,&y,&l);
//if(code==0x1a) printf("code=%x,x=%u,y=%u,l=%u\n",code,x,y,l);
return ((y*T1)+x)*T3+l;
}
 
 
unsigned int endp_addr_encoder ( unsigned int id){
#if defined (IS_MESH) || defined (IS_TORUS) || defined (IS_LINE) || defined (IS_RING )
return mesh_tori_addrencode(id);
#endif
return fmesh_addrencode(id);
}
 
 
unsigned int endp_addr_decoder (unsigned int code){
#if defined (IS_MESH) || defined (IS_TORUS) || defined (IS_LINE) || defined (IS_RING )
return mesh_tori_endp_addr_decoder (code);
#endif
return fmesh_endp_addr_decoder (code);
}
 
 
 
 
void topology_connect_all_nodes (void){
 
unsigned int x,y,l;
#if defined (IS_LINE) || defined (IS_RING )
#define R2R_CHANELS_MESH_TORI 2
for (x=0; x<T1; x=x+1) {
router1[x]->current_r_addr = x;
if(x < T1-1){// not_last_node
//assign router_chan_in[x][FORWARD] = router_chan_out [(x+1)][BACKWARD];
conect_r2r(1,x,FORWARD,1,(x+1),BACKWARD);
 
} else { //last_node
#if defined (IS_LINE) // : line_last_x
//assign router_chan_in[x][FORWARD]= {SMARTFLIT_CHANEL_w{1'b0}};
connect_r2gnd(1,x,FORWARD);
#else // : ring_last_x
//assign router_chan_in[x][FORWARD]= router_chan_out [0][BACKWARD];
conect_r2r(1,x,FORWARD,1,0,BACKWARD);
#endif
}
if(x>0){// :not_first_x
//assign router_chan_in[x][BACKWARD]= router_chan_out [(x-1)][FORWARD];
conect_r2r(1,x,BACKWARD,1,(x-1),FORWARD);
}else {// :first_x
#if defined (IS_LINE) // : line_first_x
//assign router_chan_in[x][BACKWARD]={SMARTFLIT_CHANEL_w{1'b0}};
connect_r2gnd(1,x,BACKWARD);
#else // : ring_first_x
//assign router_chan_in[x][BACKWARD]= router_chan_out [(NX-1)][FORWARD];
conect_r2r(1,x,BACKWARD,1,(T1-1),FORWARD);
#endif
}
// connect other local ports
for (l=0; l<T3; l=l+1) {// :locals
unsigned int ENDPID = endp_id(x,0,l);
unsigned int LOCALP = (l==0) ? l : l + R2R_CHANELS_MESH_TORI; // first local port is connected to router port 0. The rest are connected at the }
//assign router_chan_in[x][LOCALP]= chan_in_all [ENDPID];
//assign chan_out_all [ENDPID] = router_chan_out[x][LOCALP];
connect_r2e(1,x,LOCALP,ENDPID);
er_addr [ENDPID] = x;
}// locals
}//x
#else // :mesh_torus
#define R2R_CHANELS_MESH_TORI 4
for (y=0; y<T2; y=y+1) {//: y_loop
for (x=0; x<T1; x=x+1) {// :x_loop
unsigned int R_ADDR = (y<<nxw) + x;
unsigned int ROUTER_NUM = (y * T1) + x;
//assign current_r_addr [ROUTER_NUM] = R_ADDR[RAw-1 :0];
router1[ROUTER_NUM]->current_r_addr = R_ADDR;
if(x < T1-1) {//: not_last_x
//assign router_chan_in[`router_id(x,y)][EAST]= router_chan_out [`router_id(x+1,y)][WEST];
conect_r2r(1,router_id(x,y),EAST,1,router_id(x+1,y),WEST);
}else {// :last_x
#if defined (IS_MESH) // :last_x_mesh
// assign router_chan_in[`router_id(x,y)][EAST] = {SMARTFLIT_CHANEL_w{1'b0}};
connect_r2gnd(1,router_id(x,y),EAST);
#elif defined (IS_TORUS) // : last_x_torus
//assign router_chan_in[`router_id(x,y)][EAST] = router_chan_out [`router_id(0,y)][WEST];
conect_r2r(1,router_id(x,y),EAST,1,router_id(0,y),WEST);
#elif defined (IS_FMESH) //:last_x_fmesh
//connect to endp
unsigned int EAST_ID = T1*T2*T3 + 2*T1 + T2 + y;
connect_r2e(1,router_id(x,y),EAST,EAST_ID);
er_addr [EAST_ID] = R_ADDR;
#endif//topology
}
if(y>0) {// : not_first_y
//assign router_chan_in[`router_id(x,y)][NORTH] = router_chan_out [`router_id(x,(y-1))][SOUTH];
conect_r2r(1,router_id(x,y),NORTH,1,router_id(x,(y-1)),SOUTH);
}else {// :first_y
#if defined (IS_MESH) // : first_y_mesh
//assign router_chan_in[`router_id(x,y)][NORTH] = {SMARTFLIT_CHANEL_w{1'b0}};
connect_r2gnd(1,router_id(x,y),NORTH);
#elif defined (IS_TORUS)// :first_y_torus
//assign router_chan_in[`router_id(x,y)][NORTH] = router_chan_out [`router_id(x,(T2-1))][SOUTH];
conect_r2r(1,router_id(x,y),NORTH,1,router_id(x,(T2-1)),SOUTH);
#elif defined (IS_FMESH) // :first_y_fmesh
unsigned int NORTH_ID = T1*T2*T3 + x;
connect_r2e(1,router_id(x,y),NORTH,NORTH_ID);
er_addr [NORTH_ID] = R_ADDR;
#endif//topology
}//y>0
if(x>0){// :not_first_x
//assign router_chan_in[`router_id(x,y)][WEST] = router_chan_out [`router_id((x-1),y)][EAST];
conect_r2r(1,router_id(x,y),WEST,1,router_id((x-1),y),EAST);
}else {// :first_x
#if defined (IS_MESH) // :first_x_mesh
//assign router_chan_in[`router_id(x,y)][WEST] = {SMARTFLIT_CHANEL_w{1'b0}};
connect_r2gnd(1,router_id(x,y),WEST);
#elif defined (IS_TORUS) // :first_x_torus
//assign router_chan_in[`router_id(x,y)][WEST] = router_chan_out [`router_id((NX-1),y)][EAST] ;
conect_r2r(1,router_id(x,y),WEST,1,router_id((T1-1),y),EAST);
#elif defined (IS_FMESH) // :first_x_fmesh
unsigned int WEST_ID = T1*T2*T3 + 2*T1 + y;
connect_r2e(1,router_id(x,y),WEST,WEST_ID);
er_addr [WEST_ID] = R_ADDR;
#endif//topology
}
if(y < T2-1) {// : firsty
//assign router_chan_in[`router_id(x,y)][SOUTH] = router_chan_out [`router_id(x,(y+1))][NORTH];
conect_r2r(1,router_id(x,y),SOUTH,1,router_id(x,(y+1)),NORTH);
}else {// : lasty
#if defined (IS_MESH) // :ly_mesh
//assign router_chan_in[`router_id(x,y)][SOUTH]= {SMARTFLIT_CHANEL_w{1'b0}};
connect_r2gnd(1,router_id(x,y),SOUTH);
#elif defined (IS_TORUS) // :ly_torus
//assign router_chan_in[`router_id(x,y)][SOUTH]= router_chan_out [`router_id(x,0)][NORTH];
conect_r2r(1,router_id(x,y),SOUTH,1,router_id(x,0),NORTH);
#elif defined (IS_FMESH) // :ly_Fmesh
unsigned int SOUTH_ID = T1*T2*T3 + T1 + x;
connect_r2e(1,router_id(x,y),SOUTH,SOUTH_ID);
er_addr [SOUTH_ID] = R_ADDR;
#endif//topology
}
// endpoint(s) connection
// connect other local ports
for (l=0; l<T3; l=l+1) {// :locals
unsigned int ENDPID = endp_id(x,y,l);
unsigned int LOCALP = (l==0) ? l : l + R2R_CHANELS_MESH_TORI; // first local port is connected to router port 0. The rest are connected at the }
//assign router_chan_in [`router_id(x,y)][LOCALP] = chan_in_all [ENDPID];
//assign chan_out_all [ENDPID] = router_chan_out [`router_id(x,y)][LOCALP];
//assign er_addr [ENDPID] = R_ADDR;
connect_r2e(1,router_id(x,y),LOCALP,ENDPID);
er_addr [ENDPID] = R_ADDR;
}// locals
}//y
}//x
#endif
}
 
 
void topology_init(void){
nxw=Log2(T1);
nyw=Log2(T2);
maskx = (0x1<<nxw)-1;
masky = (0x1<<nyw)-1;
}
 
 
unsigned int get_mah_distance ( unsigned int id1, unsigned int id2){
#if defined (IS_FMESH)
unsigned int x1,y1,p1,x2,y2,p2;
fmesh_addrencod_sep ( id1, &x1, &y1, &p1);
fmesh_addrencod_sep ( id2, &x2, &y2, &p2);
#else
unsigned int x1,y1,l1,x2,y2,l2;
mesh_tori_addrencod_sep(id1, &x1, &y1, &l1);
mesh_tori_addrencod_sep(id2, &x2, &y2, &l2);
#endif
 
unsigned int x_diff = (x1 > x2) ? (x1 - x2) : (x2 - x1);
unsigned int y_diff = (y1 > y2) ? (y1 - y2) : (y2 - y1);
return x_diff + y_diff;
}
 
 
#endif
/topology/star.h
0,0 → 1,35
#ifndef STAR_H
#define STAR_H
 
 
void topology_connect_all_nodes (void){
router1[0]->current_r_addr = 0;
 
unsigned int pos;
for ( pos = 0; pos < NE; pos=pos+1 ) {// : endpoints
 
//assign router_chan_out [0][pos] = chan_in_all [pos];
//assign chan_out_all [pos] = router_chan_in [0][pos];
connect_r2e(1,0,pos,pos);
er_addr [pos] = 0;
}//pos
}
 
 
 
unsigned int endp_addr_encoder ( unsigned int id){
return id;
}
 
unsigned int endp_addr_decoder (unsigned int code){
return id;
}
 
void topology_init (void){
 
}
 
#endif
 
/topology/topology_top.h
0,0 → 1,129
#ifndef TOPOLOGY_TOP_H
#define TOPOLOGY_TOP_H
 
int get_router_num (int NR_num, int NR_id){
int offset=0;
if(NR_num* sizeof(int) > sizeof(router_NRs)){
fprintf(stderr,"ERROR: NR%u is not defined\n",NR_num);
exit(1);
}
while (NR_num > 1) {
NR_num-=1;
offset += router_NRs[NR_num];
}
return offset + NR_id;
}
 
 
unsigned int er_addr [NE+1];
char start_i=0;
char start_o[NE+1]={0};
 
unsigned int Log2 (unsigned int n){
unsigned int l=1;
while((0x1<<l) < n)l++;
return l;
}
 
unsigned int powi (unsigned int x, unsigned int y){ // x^y
unsigned int i;
unsigned int pow=1;
for (int i = 0; i <y; i=i+1 ) {
pow=pow * x;
}
return pow;
}
 
unsigned int sum_powi (unsigned int x, unsigned int y){//x^(y-1) + x^(y-2) + ...+ 1;
unsigned int i;
unsigned int sum = 0;
for (i = 0; i < y; i=i+1){
sum = sum + powi( x, i );
}
return sum;
}
 
#if defined (IS_FATTREE) || defined (IS_TREE)
inline unsigned int Ti( unsigned int id){
return (id < NR1)? 1 : 2;
}
inline unsigned int Ri(unsigned int id){
return (id < NR1)? id : id-NR1;
}
#define K T1
#define L T2
#define CNT_R2R_SIZ ((NR1+NR2+1)*(K+1))
#define CNT_R2E_SIZ (NE+1)
typedef struct R2R_CNT_TABLE {
unsigned int t1;
unsigned int r1;
unsigned int p1;
unsigned int t2;
unsigned int r2;
unsigned int p2;
} r2r_cnt_table_t;
 
r2r_cnt_table_t r2r_cnt_all[CNT_R2R_SIZ];
 
typedef struct R2E_CNT_TABLE {
unsigned int r1;
unsigned int p1;
} r2e_cnt_table_t;
 
r2e_cnt_table_t r2e_cnt_all[CNT_R2E_SIZ];
 
inline void fattree_connect ( r2r_cnt_table_t in){
unsigned int t1 = in.t1;
unsigned int r1 = in.r1;
unsigned int p1 = in.p1;
unsigned int t2 = in.t2;
unsigned int r2 = in.r2;
unsigned int p2 = in.p2;
 
if (t1==1 && t2 == 1) {
conect_r2r(1,r1,p1,1,r2,p2);
conect_r2r(1,r2,p2,1,r1,p1);
}
else if (t1==1 && t2 == 2) {
conect_r2r(1,r1,p1,2,r2,p2);
conect_r2r(2,r2,p2,1,r1,p1);
}
else if (t1==2 && t2 == 1){
conect_r2r(2,r1,p1,1,r2,p2);
conect_r2r(1,r2,p2,2,r1,p1);
}
else{
conect_r2r(2,r1,p1,2,r2,p2);
conect_r2r(2,r2,p2,2,r1,p1);
}
}
#endif
 
 
 
#if defined (IS_MESH) || defined (IS_FMESH) || defined (IS_TORUS) || defined (IS_LINE) || defined (IS_RING )
#include "mesh.h"
#elif defined (IS_FATTREE)
#include "fattree.h"
#elif defined (IS_TREE)
#include "tree.h"
#elif defined (IS_STAR)
#include "star.h"
#else
//custom not coded
unsigned int endp_addr_encoder ( unsigned int id){
return id;
}
 
unsigned int endp_addr_decoder (unsigned int code){
return code;
}
 
#endif
 
 
#endif
 
/topology/tree.h
0,0 → 1,211
#ifndef BINTREE_H
#define BINTREE_H
 
 
 
#define ROOT_L (L-1)
#define ROOT_ID 0
 
 
unsigned int Lw;
unsigned int Kw;
unsigned int LKw;
 
 
 
 
 
 
 
 
 
 
unsigned int bintree_addrencode( unsigned int pos, unsigned int k, unsigned int l){
unsigned int pow,i,tmp=0;
unsigned int addrencode=0;
unsigned int kw=0;
while((0x1<<kw) < k)kw++;
pow=1;
for (i = 0; i <l; i=i+1 ) {
tmp=(pos/pow);
tmp=tmp%k;
tmp=tmp<<(i)*kw;
addrencode=addrencode | tmp;
pow=pow * k;
}
return addrencode;
}
 
 
unsigned int bintree_addrdecode(unsigned int addrencode , unsigned int k, unsigned int l){
unsigned int kw=0;
unsigned int mask=0;
unsigned int pow,i,tmp;
unsigned int pos=0;
while((0x1<<kw) < k){
kw++;
mask<<=1;
mask|=0x1;
}
pow=1;
for (i = 0; i <l; i=i+1 ) {
tmp = addrencode & mask;
tmp=(tmp*pow);
pos= pos + tmp;
pow=pow * k;
addrencode>>=kw;
}
return pos;
}
 
 
 
unsigned int endp_addr_encoder ( unsigned int id){
return bintree_addrencode(id, T1, T2);
}
 
unsigned int endp_addr_decoder (unsigned int code){
return bintree_addrdecode(code, T1, T2);
}
 
void topology_init (void){
Lw=Log2(L);
Kw=Log2(K);
LKw=L*Kw;
//assign current_layer_addr [ROOT_ID] = ROOT_L;
//assign current_pos_addr [ROOT_ID] = {LKw{1'b0}};
unsigned int addr = ROOT_L << LKw;
router1[ROOT_ID]->current_r_addr = addr;
 
unsigned int pos,level;
unsigned int num = 0;
//connect all up connections
for (level = 1; level<L; level=level+1) { // : level_c
unsigned int L1 = L-1-level;
unsigned int level2= level - 1;
unsigned int L2 = L-1-level2;
unsigned int NPOS = powi(K,level); // number of routers in this level
for ( pos = 0; pos < NPOS; pos=pos+1 ) { // : pos_c
unsigned int ID1 = sum_powi ( K,level) + pos;
unsigned int BINTREE_EQ_POS1 = pos* powi(K,L1);
unsigned int ADR_CODE1=bintree_addrencode(BINTREE_EQ_POS1,K,L);
unsigned int POS2 = pos /K ;
unsigned int ID2 = sum_powi ( K,level-1) + (pos/K);
unsigned int PORT2= pos % K;
unsigned int BINTREE_EQ_POS2 = POS2*powi(K,L2);
unsigned int ADR_CODE2=bintree_addrencode(BINTREE_EQ_POS2,K,L);
 
// node_connection('Router[id1][k] to router[id2][pos%k];
//assign router_chan_out [ID1][K] = router_chan_in [ID2][PORT2];
//assign router_chan_out [ID2][PORT2]= router_chan_in[ID1][K];
//bintree_connect(Ti(ID1),Ri(ID1),port,Ti(ID2),Ri(ID2),PORT2);
r2r_cnt_all[num] =(r2r_cnt_table_t){.t1=Ti(ID1), .r1=Ri(ID1), .p1=K, .t2=Ti(ID2), .r2=Ri(ID2), .p2=PORT2 };
 
unsigned int current_layer_addr = L1;
unsigned int current_pos_addr = ADR_CODE1;
//assign current_r_addr [ID1] = {current_layer_addr [ID1],current_pos_addr[ID1]};
unsigned int addr = (current_layer_addr << LKw)| current_pos_addr;
router2[Ri(ID1)]->current_r_addr = addr;
//printf( "[%u] =(addr=%x), t1=%u, r1=%u, p1=%u, t2=%u, r2=%u, p2=%u \n", num,addr, r2r_cnt_all[num].t1, r2r_cnt_all[num].r1, r2r_cnt_all[num].p1, r2r_cnt_all[num].t2, r2r_cnt_all[num].r2, r2r_cnt_all[num].p2 );
 
 
 
 
 
num++;
}// pos
} //level
 
 
// connect }points
for ( pos = 0; pos < NE; pos=pos+1 ) { // : }points
// node_connection T[pos] R[rid][pos %k];
unsigned int RID= sum_powi(K,L-1)+(pos/K);
unsigned int RPORT = pos%K;
unsigned int CURRENTPOS= bintree_addrencode(pos/K,K,L);
//assign router_chan_out [RID][RPORT] = chan_in_all [pos];
//assign chan_out_all [pos] = router_chan_in [RID][RPORT];
r2e_cnt_all[pos].r1=Ri(RID);
r2e_cnt_all[pos].p1=RPORT;
 
er_addr [pos] = CURRENTPOS;
} //pos
}
 
void topology_connect_all_nodes (void){
unsigned int pos,level;
unsigned int num=0;
//connect all up connections
for (level = 1; level<L; level=level+1) { // : level_c
unsigned int NPOS = powi(K,level); // number of routers in this level
for ( pos = 0; pos < NPOS; pos=pos+1 ) { // : pos_c
fattree_connect(r2r_cnt_all[num]);
num++;
}// pos
} //level
 
 
// connect }points
for ( pos = 0; pos < NE; pos=pos+1 ) { // : }points
connect_r2e(2,r2e_cnt_all[pos].r1,r2e_cnt_all[pos].p1,pos);
}
}
 
 
 
unsigned int get_mah_distance ( unsigned int id1, unsigned int id2){
 
unsigned int k =T1;
unsigned int l =T2;
 
unsigned int pow,tmp1,tmp2;
unsigned int distance=0;
pow=1;
for (unsigned int i = 0; i <l; i=i+1 ) {
tmp1=(id1/pow);
tmp2=(id2/pow);
tmp1=tmp1 % k;
tmp2=tmp2 % k;
pow=pow * k;
if(tmp1!=tmp2) distance= (i+1)*2-1; //distance obtained based on the highest level index which differ
 
}
return distance;
}
 
 
 
 
#endif
 
 
/traffic_synthetic.h
2,16 → 2,18
#define TRAFFIC_SYNTHETIC_H
 
 
#include "topology.h"
#define INJECT_OFF -1
 
//#include "topology.h"
 
 
extern int TRAFFIC_TYPE;
extern int HOTSPOT_NUM;
extern char * TRAFFIC;
extern unsigned char NEw;
 
int custom_traffic_table[NE];
 
 
typedef struct HOTSPOT_NODE {
int ip_num;
char send_enable;
20,8 → 22,8
 
hotspot_st * hotspots;
unsigned int pck_dst_gen_1D (unsigned int);
 
 
// number, b:bit location W: number width log2(num)
int getBit(int num, int b, int W)
{
43,9 → 45,16
}
 
unsigned int get_rnd_ip (unsigned int core_num){
unsigned int rnd=rand()%NE;
if(IS_SELF_LOOP_EN) return rnd;
//make sure its not same as sender core
while (rnd==core_num) rnd=rand()%NE;
return rnd;
}
 
#if (defined (IS_MESH) || defined (IS_TORUS) || defined (IS_LINE) || defined (IS_RING) )
 
 
unsigned int pck_dst_gen_2D (unsigned int core_num){
//for mesh-tori
unsigned int current_l,current_x, current_y;
58,22 → 67,20
int i;
 
if((strcmp (TRAFFIC,"RANDOM")==0) || (strcmp (TRAFFIC,"random")==0)){
do{
rnd=rand()%NE;
}while (rnd==core_num); // get a random IP core, make sure its not same as sender core
return endp_addr_encoder(rnd);
//get a random IP core
return endp_addr_encoder(get_rnd_ip(core_num));
}
 
if ((strcmp(TRAFFIC,"HOTSPOT")==0) || (strcmp (TRAFFIC,"hot spot")==0)){
unsigned int rnd1000=0;
do{
rnd=rand()%NE;
}while (rnd==core_num); // get a random IP core, make sure its not same as sender core
rnd=get_rnd_ip(core_num);
 
rnd1000=rand()%1000; // generate a random number between 0 & 1000
for (i=0;i<HOTSPOT_NUM; i++){
if ( hotspots[i].send_enable == 0 && core_num ==hotspots[i].ip_num){
rnd = core_num; // turn off the core
return endp_addr_encoder(rnd);
//rnd = core_num; // turn off the core
//return endp_addr_encoder(rnd);
return INJECT_OFF;
}
}
for (i=0;i<HOTSPOT_NUM; i++){
142,34 → 149,26
return mesh_tori_addr_join(dest_x,dest_y,dest_l);
}
if( strcmp(TRAFFIC ,"CUSTOM") == 0){
//[(x+(k/2-1)) mod k, (y+(k/2-1)) mod k],
if(current_x ==0 && current_y == 0 && current_l==0 ){
// dest_x = T1-1;
// dest_y = T2-1;
// dest_l = T3-1;
dest_x = 0;
dest_y = 0;
dest_l = 1;
return mesh_tori_addr_join(dest_x,dest_y,dest_l);
}// make it invalid
dest_x = current_x;
dest_y = current_y;
dest_l = current_l;
return mesh_tori_addr_join(dest_x,dest_y,dest_l);
if(( strcmp(TRAFFIC ,"CUSTOM") == 0)|| (strcmp (TRAFFIC,"custom")==0)){
if (custom_traffic_table[core_num]== INJECT_OFF) return INJECT_OFF;
return endp_addr_encoder(custom_traffic_table[core_num]);
 
}
 
printf ("traffic %s is an unsupported traffic pattern\n",TRAFFIC);
dest_x = current_x;
dest_y = current_y;
dest_l = current_l;
return mesh_tori_addr_join(dest_x,dest_y,dest_l);
fprintf (stderr,"ERROR: traffic %s is an unsupported traffic pattern\n",TRAFFIC);
return INJECT_OFF;
 
}
 
#else
 
unsigned int pck_dst_gen_2D (unsigned int core_num){
return pck_dst_gen_1D (core_num);
}
 
#endif
 
 
unsigned int pck_dst_gen_1D (unsigned int core_num){
 
unsigned int rnd=0;
179,24 → 178,18
if((strcmp (TRAFFIC,"RANDOM")==0) || (strcmp (TRAFFIC,"random")==0)){
do{
rnd=rand()%NE;
}while (rnd==core_num); // get a random IP core, make sure its not same as sender core
 
return endp_addr_encoder(rnd);
return endp_addr_encoder(get_rnd_ip(core_num));
}
if ((strcmp(TRAFFIC,"HOTSPOT")==0) || (strcmp (TRAFFIC,"hot spot")==0)){
unsigned int rnd1000=0;
int i;
do{
rnd=rand()%NE;
}while (rnd==core_num); // get a random IP core, make sure its not same as sender core
rnd=get_rnd_ip(core_num);
rnd1000=rand()%1000; // generate a random number between 0 & 1000
for (i=0;i<HOTSPOT_NUM; i++){
if ( hotspots[i].send_enable == 0 && core_num ==hotspots[i].ip_num){
rnd = core_num; // turn off the core
return endp_addr_encoder(rnd);
 
return INJECT_OFF;
}
}
254,14 → 247,14
return endp_addr_encoder((core_num + 1)%NE);
}
if( strcmp(TRAFFIC ,"CUSTOM") == 0){
//[(x+(k/2-1)) mod k, (y+(k/2-1)) mod k],
if(core_num ==2 ) return endp_addr_encoder(6);
return endp_addr_encoder(core_num);
}
if(( strcmp(TRAFFIC ,"CUSTOM") == 0)|| (strcmp (TRAFFIC,"custom")==0)){
if (custom_traffic_table[core_num]== INJECT_OFF) return INJECT_OFF;
return endp_addr_encoder(custom_traffic_table[core_num]);
 
printf ("traffic %s is an unsupported traffic pattern\n",TRAFFIC);
return endp_addr_encoder(core_num);
}
 
fprintf (stderr,"ERROR: traffic %s is an unsupported traffic pattern\n",TRAFFIC);
return INJECT_OFF;
}
 
 
/traffic_task_graph.h
23,7 → 23,7
typedef struct TRAFFIC_TASK {
char enable;
unsigned int src;
unsigned int dst; // ID of the destination node (PE)
unsigned int dst; // ID of the destination endpoint (PE)
unsigned int bytes;
unsigned int initial_weight;
unsigned int min_pck_size; //in flit
42,55 → 42,58
 
 
 
typedef struct node {
typedef struct endpt {
task_t task;
struct node * next;
} node_t;
struct endpt * next;
} endpt_t;
 
 
 
unsigned int total_active_routers=0;
unsigned int task_graph_total_pck_num=0;
node_t * task_graph_data[NE];
unsigned int task_graph_min_pck_size=999999;
unsigned int task_graph_max_pck_size=0;
 
endpt_t * task_graph_data[NE];
index_t task_graph_abstract[NE];
 
 
 
 
void push(node_t ** head, task_t task) {
node_t * new_node;
new_node = (node_t *) malloc(sizeof(node_t));
if( new_node == NULL){
printf("Error: cannot allocate memory in push function\n");
void push(endpt_t ** head, task_t task) {
endpt_t * new_endpt;
new_endpt = (endpt_t *) malloc(sizeof(endpt_t));
if( new_endpt == NULL){
printf("ERROR: cannot allocate memory in push function\n");
exit(1);
}
new_node->task=task;
new_node->next = *head;
*head = new_node;
new_endpt->task=task;
new_endpt->next = *head;
*head = new_endpt;
}
 
int pop(node_t ** head) {
int pop(endpt_t ** head) {
// int retval = -1;
node_t * next_node = NULL;
endpt_t * next_endpt = NULL;
 
if (*head == NULL) {
return -1;
}
 
next_node = (*head)->next;
next_endpt = (*head)->next;
//retval = (*head)->val;
free(*head);
*head = next_node;
*head = next_endpt;
return 1;
//return retval;
}
 
 
int remove_by_index(node_t ** head, int n) {
int remove_by_index(endpt_t ** head, int n) {
int i = 0;
// int retval = -1;
node_t * current = *head;
node_t * temp_node = NULL;
endpt_t * current = *head;
endpt_t * temp_endpt = NULL;
 
if (n == 0) {
return pop(head);
103,17 → 106,17
current = current->next;
}
 
temp_node = current->next;
//retval = temp_node->val;
current->next = temp_node->next;
free(temp_node);
temp_endpt = current->next;
//retval = temp_endpt->val;
current->next = temp_endpt->next;
free(temp_endpt);
return 1;
 
}
 
 
int update_by_index(node_t * head,int loc, task_t task) {
node_t * current = head;
int update_by_index(endpt_t * head,int loc, task_t task) {
endpt_t * current = head;
int i;
for (i=0;i<loc && current != NULL;i++){
current = current->next;
126,8 → 129,8
}
 
 
int read(node_t * head, int loc, task_t * task ) {
node_t * current = head;
int read(endpt_t * head, int loc, task_t * task ) {
endpt_t * current = head;
int i;
for (i=0;i<loc && current != NULL;i++){
current = current->next;
154,7 → 157,7
{
unsigned int src;
unsigned int dst; // ID of the destination node (PE)
unsigned int dst; // ID of the destination endpt (PE)
unsigned int bytes;
unsigned int initial_weight;
unsigned int min_pck_size; //in flit
182,6 → 185,8
st->estimated_total_pck_num = (bytes*8) /(st->avg_pck_size*Fpay);
if(st->estimated_total_pck_num==0) st->estimated_total_pck_num= 1;
task_graph_total_pck_num=task_graph_total_pck_num+st->estimated_total_pck_num;
if(task_graph_min_pck_size > st->min_pck_size ) task_graph_min_pck_size= st->min_pck_size;
if(task_graph_max_pck_size < st->max_pck_size ) task_graph_max_pck_size= st->max_pck_size;
 
st->pck_sent=0;
st->byte_sent=0;
190,7 → 195,7
return 1;
}
 
int calcualte_traffic_parameters(node_t * head[NE],index_t (* info)){
int calcualte_traffic_parameters(endpt_t * head[NE],index_t (* info)){
int i,j;
task_t task;
239,7 → 244,7
 
 
 
void load_traffic_file(char * file, node_t * head[NE], index_t (* info)){
void load_traffic_file(char * file, endpt_t * head[NE], index_t (* info)){
FILE * in;
char * line = NULL;
249,8 → 254,8
int n,i;
if(in == NULL){
printf("Error: cannot open %s file in read mode!\n",file);
exit(1);
fprintf(stderr,"ERROR: cannot open %s file in read mode!\n",file);
exit(1);
}
 
for(i=0;i<NE;i++){

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.