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 __NUCA_H__
35#define __NUCA_H__
36
37#include <iostream>
38
39#include "assert.h"
40#include "basic_circuit.h"
41#include "cacti_interface.h"
42#include "component.h"
43#include "io.h"
44#include "mat.h"
45#include "parameter.h"
46#include "router.h"
47#include "wire.h"
48
49class nuca_org_t {
50public:
51    ~nuca_org_t();
52//    int size;
53    /* area, power, access time, and cycle time stats */
54    Component nuca_pda;
55    Component bank_pda;
56    Component wire_pda;
57    Wire *h_wire;
58    Wire *v_wire;
59    Router *router;
60    /* for particular network configuration
61     * calculated based on a cycle accurate
62     * simulation Ref: CACTI 6 - Tech report
63     */
64    double contention;
65
66    /* grid network stats */
67    double avg_hops;
68    int rows;
69    int columns;
70    int bank_count;
71};
72
73
74
75class Nuca : public Component {
76public:
77    Nuca(
78        TechnologyParameter::DeviceType *dt);
79    void print_router();
80    ~Nuca();
81    void sim_nuca();
82    void init_cont();
83    int calc_cycles(double lat, double oper_freq);
84    void calculate_nuca_area (nuca_org_t *nuca);
85    int check_nuca_org (nuca_org_t *n, min_values_t *minval);
86    nuca_org_t * find_optimal_nuca (list<nuca_org_t *> *n, min_values_t *minval);
87    void print_nuca(nuca_org_t *n);
88    void print_cont_stats();
89
90private:
91
92    TechnologyParameter::DeviceType *deviceType;
93    int wt_min, wt_max;
94    Wire *wire_vertical[WIRE_TYPES],
95    *wire_horizontal[WIRE_TYPES];
96
97};
98
99
100#endif
101