Ucache.h revision 10152:52c552138ba1
1/*****************************************************************************
2 *                                McPAT/CACTI
3 *                      SOFTWARE LICENSE AGREEMENT
4 *            Copyright 2012 Hewlett-Packard Development Company, L.P.
5 *                          All Rights Reserved
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
9 * met: redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer;
11 * redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution;
14 * neither the name of the copyright holders nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.”
29 *
30 ***************************************************************************/
31
32
33#ifndef __UCACHE_H__
34#define __UCACHE_H__
35
36#include <list>
37
38#include "area.h"
39#include "nuca.h"
40#include "router.h"
41
42class min_values_t
43{
44  public:
45    double min_delay;
46    double min_dyn;
47    double min_leakage;
48    double min_area;
49    double min_cyc;
50
51    min_values_t() : min_delay(BIGNUM), min_dyn(BIGNUM), min_leakage(BIGNUM), min_area(BIGNUM), min_cyc(BIGNUM) { }
52
53    void update_min_values(const min_values_t * val);
54    void update_min_values(const uca_org_t & res);
55    void update_min_values(const nuca_org_t * res);
56    void update_min_values(const mem_array * res);
57};
58
59
60
61struct solution
62{
63  int    tag_array_index;
64  int    data_array_index;
65  list<mem_array *>::iterator tag_array_iter;
66  list<mem_array *>::iterator data_array_iter;
67  double access_time;
68  double cycle_time;
69  double area;
70  double efficiency;
71  powerDef total_power;
72};
73
74
75
76bool calculate_time(
77    bool is_tag,
78    int pure_ram,
79    bool pure_cam,
80    double Nspd,
81    unsigned int Ndwl,
82    unsigned int Ndbl,
83    unsigned int Ndcm,
84    unsigned int Ndsam_lev_1,
85    unsigned int Ndsam_lev_2,
86    mem_array *ptr_array,
87    int flag_results_populate,
88    results_mem_array *ptr_results,
89    uca_org_t *ptr_fin_res,
90    bool is_main_mem);
91void update(uca_org_t *fin_res);
92
93void solve(uca_org_t *fin_res);
94void init_tech_params(double tech, bool is_tag);
95
96
97struct calc_time_mt_wrapper_struct
98{
99  uint32_t tid;
100  bool     is_tag;
101  bool     pure_ram;
102  bool     pure_cam;
103  bool     is_main_mem;
104  double   Nspd_min;
105
106  min_values_t * data_res;
107  min_values_t * tag_res;
108
109  list<mem_array *> data_arr;
110  list<mem_array *> tag_arr;
111};
112
113void *calc_time_mt_wrapper(void * void_obj);
114
115#endif
116