110152Satgutier@umich.edu/*****************************************************************************
210152Satgutier@umich.edu *                                McPAT/CACTI
310152Satgutier@umich.edu *                      SOFTWARE LICENSE AGREEMENT
410152Satgutier@umich.edu *            Copyright 2012 Hewlett-Packard Development Company, L.P.
510234Syasuko.eckert@amd.com *            Copyright (c) 2010-2013 Advanced Micro Devices, Inc.
610152Satgutier@umich.edu *                          All Rights Reserved
710152Satgutier@umich.edu *
810152Satgutier@umich.edu * Redistribution and use in source and binary forms, with or without
910152Satgutier@umich.edu * modification, are permitted provided that the following conditions are
1010152Satgutier@umich.edu * met: redistributions of source code must retain the above copyright
1110152Satgutier@umich.edu * notice, this list of conditions and the following disclaimer;
1210152Satgutier@umich.edu * redistributions in binary form must reproduce the above copyright
1310152Satgutier@umich.edu * notice, this list of conditions and the following disclaimer in the
1410152Satgutier@umich.edu * documentation and/or other materials provided with the distribution;
1510152Satgutier@umich.edu * neither the name of the copyright holders nor the names of its
1610152Satgutier@umich.edu * contributors may be used to endorse or promote products derived from
1710152Satgutier@umich.edu * this software without specific prior written permission.
1810152Satgutier@umich.edu
1910152Satgutier@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2010152Satgutier@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2110152Satgutier@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2210152Satgutier@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2310152Satgutier@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2410152Satgutier@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2510152Satgutier@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2610152Satgutier@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2710152Satgutier@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2810152Satgutier@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2910234Syasuko.eckert@amd.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3010152Satgutier@umich.edu *
3110152Satgutier@umich.edu ***************************************************************************/
3210152Satgutier@umich.edu
3310152Satgutier@umich.edu
3410152Satgutier@umich.edu
3510152Satgutier@umich.edu#ifndef __ROUTER_H__
3610152Satgutier@umich.edu#define __ROUTER_H__
3710152Satgutier@umich.edu
3810152Satgutier@umich.edu#include <assert.h>
3910152Satgutier@umich.edu
4010152Satgutier@umich.edu#include <iostream>
4110152Satgutier@umich.edu
4210152Satgutier@umich.edu#include "arbiter.h"
4310152Satgutier@umich.edu#include "basic_circuit.h"
4410152Satgutier@umich.edu#include "cacti_interface.h"
4510152Satgutier@umich.edu#include "component.h"
4610152Satgutier@umich.edu#include "crossbar.h"
4710152Satgutier@umich.edu#include "mat.h"
4810152Satgutier@umich.edu#include "parameter.h"
4910152Satgutier@umich.edu#include "wire.h"
5010152Satgutier@umich.edu
5110234Syasuko.eckert@amd.comclass Router : public Component {
5210234Syasuko.eckert@amd.compublic:
5310152Satgutier@umich.edu    Router(
5410152Satgutier@umich.edu        double flit_size_,
5510152Satgutier@umich.edu        double vc_buf, /* vc size = vc_buffer_size * flit_size */
5610152Satgutier@umich.edu        double vc_count,
5710152Satgutier@umich.edu        TechnologyParameter::DeviceType *dt = &(g_tp.peri_global),
5810152Satgutier@umich.edu        double I_ = 5,
5910152Satgutier@umich.edu        double O_ = 5,
6010152Satgutier@umich.edu        double M_ = 0.6);
6110152Satgutier@umich.edu    ~Router();
6210152Satgutier@umich.edu
6310152Satgutier@umich.edu
6410152Satgutier@umich.edu    void print_router();
6510152Satgutier@umich.edu
6610152Satgutier@umich.edu    Component arbiter, crossbar, buffer;
6710152Satgutier@umich.edu
6810152Satgutier@umich.edu    double cycle_time, max_cyc;
6910152Satgutier@umich.edu    double flit_size;
7010152Satgutier@umich.edu    double vc_count;
7110152Satgutier@umich.edu    double vc_buffer_size; /* vc size = vc_buffer_size * flit_size */
7210152Satgutier@umich.edu
7310234Syasuko.eckert@amd.comprivate:
7410234Syasuko.eckert@amd.com    TechnologyParameter::DeviceType *deviceType;
7510234Syasuko.eckert@amd.com    double FREQUENCY; // move this to config file --TODO
7610152Satgutier@umich.edu    double Cw3(double len);
7710152Satgutier@umich.edu    double gate_cap(double w);
7810152Satgutier@umich.edu    double diff_cap(double w, int type /*0 for n-mos and 1 for p-mos*/, double stack);
7910152Satgutier@umich.edu    enum Wire_type wtype;
8010152Satgutier@umich.edu    enum Wire_placement wire_placement;
8110152Satgutier@umich.edu    //corssbar
8210152Satgutier@umich.edu    double NTtr, PTtr, wt, ht, I, O, NTi, PTi, NTid, PTid, NTod, PTod, TriS1, TriS2;
8310152Satgutier@umich.edu    double M; //network load
8410152Satgutier@umich.edu    double transmission_buf_inpcap();
8510152Satgutier@umich.edu    double transmission_buf_outcap();
8610152Satgutier@umich.edu    double transmission_buf_ctrcap();
8710152Satgutier@umich.edu    double crossbar_inpline();
8810152Satgutier@umich.edu    double crossbar_outline();
8910152Satgutier@umich.edu    double crossbar_ctrline();
9010152Satgutier@umich.edu    double tr_crossbar_power();
9110152Satgutier@umich.edu    void  cb_stats ();
9210152Satgutier@umich.edu    double arb_power();
9310152Satgutier@umich.edu    void  arb_stats ();
9410152Satgutier@umich.edu    double buffer_params();
9510152Satgutier@umich.edu    void buffer_stats();
9610152Satgutier@umich.edu
9710152Satgutier@umich.edu
9810152Satgutier@umich.edu    //arbiter
9910152Satgutier@umich.edu
10010152Satgutier@umich.edu    //buffer
10110152Satgutier@umich.edu
10210152Satgutier@umich.edu    //router params
10310152Satgutier@umich.edu    double Vdd;
10410152Satgutier@umich.edu
10510152Satgutier@umich.edu    void calc_router_parameters();
10610152Satgutier@umich.edu    void get_router_area();
10710152Satgutier@umich.edu    void get_router_power();
10810152Satgutier@umich.edu    void get_router_delay();
10910152Satgutier@umich.edu
11010152Satgutier@umich.edu    double min_w_pmos;
11110152Satgutier@umich.edu
11210152Satgutier@umich.edu
11310152Satgutier@umich.edu};
11410152Satgutier@umich.edu
11510152Satgutier@umich.edu#endif
116