1/*****************************************************************************
2 *                                McPAT/CACTI
3 *                      SOFTWARE LICENSE AGREEMENT
4 *            Copyright 2012 Hewlett-Packard Development Company, L.P.
5 *            Copyright (c) 2010-2013 Advanced Micro Devices, Inc.
6 *                          All Rights Reserved
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met: redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer;
12 * redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution;
15 * neither the name of the copyright holders nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 ***************************************************************************/
32
33
34
35#ifndef __ROUTER_H__
36#define __ROUTER_H__
37
38#include <assert.h>
39
40#include <iostream>
41
42#include "arbiter.h"
43#include "basic_circuit.h"
44#include "cacti_interface.h"
45#include "component.h"
46#include "crossbar.h"
47#include "mat.h"
48#include "parameter.h"
49#include "wire.h"
50
51class Router : public Component {
52public:
53    Router(
54        double flit_size_,
55        double vc_buf, /* vc size = vc_buffer_size * flit_size */
56        double vc_count,
57        TechnologyParameter::DeviceType *dt = &(g_tp.peri_global),
58        double I_ = 5,
59        double O_ = 5,
60        double M_ = 0.6);
61    ~Router();
62
63
64    void print_router();
65
66    Component arbiter, crossbar, buffer;
67
68    double cycle_time, max_cyc;
69    double flit_size;
70    double vc_count;
71    double vc_buffer_size; /* vc size = vc_buffer_size * flit_size */
72
73private:
74    TechnologyParameter::DeviceType *deviceType;
75    double FREQUENCY; // move this to config file --TODO
76    double Cw3(double len);
77    double gate_cap(double w);
78    double diff_cap(double w, int type /*0 for n-mos and 1 for p-mos*/, double stack);
79    enum Wire_type wtype;
80    enum Wire_placement wire_placement;
81    //corssbar
82    double NTtr, PTtr, wt, ht, I, O, NTi, PTi, NTid, PTid, NTod, PTod, TriS1, TriS2;
83    double M; //network load
84    double transmission_buf_inpcap();
85    double transmission_buf_outcap();
86    double transmission_buf_ctrcap();
87    double crossbar_inpline();
88    double crossbar_outline();
89    double crossbar_ctrline();
90    double tr_crossbar_power();
91    void  cb_stats ();
92    double arb_power();
93    void  arb_stats ();
94    double buffer_params();
95    void buffer_stats();
96
97
98    //arbiter
99
100    //buffer
101
102    //router params
103    double Vdd;
104
105    void calc_router_parameters();
106    void get_router_area();
107    void get_router_power();
108    void get_router_delay();
109
110    double min_w_pmos;
111
112
113};
114
115#endif
116