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#ifndef __HTREE2_H__
35#define __HTREE2_H__
36
37#include "assert.h"
38#include "basic_circuit.h"
39#include "cacti_interface.h"
40#include "component.h"
41#include "parameter.h"
42#include "subarray.h"
43#include "wire.h"
44
45// leakge power includes entire htree in a bank (when uca_tree == false)
46// leakge power includes only part to one bank when uca_tree == true
47
48class Htree2 : public Component {
49public:
50    Htree2(enum Wire_type wire_model,
51           double mat_w, double mat_h, int add, int data_in, int search_data_in, int data_out, int search_data_out, int bl, int wl,
52           enum Htree_type h_type, bool uca_tree_ = false, bool search_tree_ = false,
53           TechnologyParameter::DeviceType *dt = &(g_tp.peri_global));
54    ~Htree2() {};
55
56    void in_htree();
57    void out_htree();
58
59    // repeaters only at h-tree nodes
60    void limited_in_htree();
61    void limited_out_htree();
62    void input_nand(double s1, double s2, double l);
63    void output_buffer(double s1, double s2, double l);
64
65    double in_rise_time, out_rise_time;
66
67    void set_in_rise_time(double rt) {
68        in_rise_time = rt;
69    }
70
71    double max_unpipelined_link_delay;
72    powerDef power_bit;
73
74
75private:
76    double wire_bw;
77    double init_wire_bw;  // bus width at root
78    enum Htree_type tree_type;
79    double htree_hnodes;
80    double htree_vnodes;
81    double mat_width;
82    double mat_height;
83    int add_bits;
84    int data_in_bits;
85    int search_data_in_bits;
86    int data_out_bits;
87    int search_data_out_bits;
88    int ndbl, ndwl;
89    bool uca_tree; // should have full bandwidth to access all banks in the array simultaneously
90    bool search_tree;
91
92    enum Wire_type wt;
93    double min_w_nmos;
94    double min_w_pmos;
95
96    TechnologyParameter::DeviceType *deviceType;
97
98};
99
100#endif
101