Ucache.h revision 10234
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 __UCACHE_H__
35#define __UCACHE_H__
36
37#include <list>
38
39#include "area.h"
40#include "nuca.h"
41#include "router.h"
42
43class min_values_t {
44public:
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    int    tag_array_index;
63    int    data_array_index;
64    list<mem_array *>::iterator tag_array_iter;
65    list<mem_array *>::iterator data_array_iter;
66    double access_time;
67    double cycle_time;
68    double area;
69    double efficiency;
70    powerDef total_power;
71};
72
73
74
75bool calculate_time(
76    bool is_tag,
77    int pure_ram,
78    bool pure_cam,
79    double Nspd,
80    unsigned int Ndwl,
81    unsigned int Ndbl,
82    unsigned int Ndcm,
83    unsigned int Ndsam_lev_1,
84    unsigned int Ndsam_lev_2,
85    mem_array *ptr_array,
86    int flag_results_populate,
87    results_mem_array *ptr_results,
88    uca_org_t *ptr_fin_res,
89    bool is_main_mem);
90void update(uca_org_t *fin_res);
91
92void solve(uca_org_t *fin_res);
93void init_tech_params(double tech, bool is_tag);
94
95
96struct calc_time_mt_wrapper_struct {
97    uint32_t tid;
98    bool     is_tag;
99    bool     pure_ram;
100    bool     pure_cam;
101    bool     is_main_mem;
102    double   Nspd_min;
103
104    min_values_t * data_res;
105    min_values_t * tag_res;
106
107    list<mem_array *> data_arr;
108    list<mem_array *> tag_arr;
109};
110
111void *calc_time_mt_wrapper(void * void_obj);
112
113#endif
114