110152Satgutier@umich.edu/*****************************************************************************
210152Satgutier@umich.edu *                                McPAT/CACTI
310152Satgutier@umich.edu *                      SOFTWARE LICENSE AGREEMENT
410152Satgutier@umich.edu *            Copyright 2012 Hewlett-Packard Development Company, L.P.
510234Syasuko.eckert@amd.com *            Copyright (c) 2010-2013 Advanced Micro Devices, Inc.
610152Satgutier@umich.edu *                          All Rights Reserved
710152Satgutier@umich.edu *
810152Satgutier@umich.edu * Redistribution and use in source and binary forms, with or without
910152Satgutier@umich.edu * modification, are permitted provided that the following conditions are
1010152Satgutier@umich.edu * met: redistributions of source code must retain the above copyright
1110152Satgutier@umich.edu * notice, this list of conditions and the following disclaimer;
1210152Satgutier@umich.edu * redistributions in binary form must reproduce the above copyright
1310152Satgutier@umich.edu * notice, this list of conditions and the following disclaimer in the
1410152Satgutier@umich.edu * documentation and/or other materials provided with the distribution;
1510152Satgutier@umich.edu * neither the name of the copyright holders nor the names of its
1610152Satgutier@umich.edu * contributors may be used to endorse or promote products derived from
1710152Satgutier@umich.edu * this software without specific prior written permission.
1810152Satgutier@umich.edu
1910152Satgutier@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2010152Satgutier@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2110152Satgutier@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2210152Satgutier@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2310152Satgutier@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2410152Satgutier@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2510152Satgutier@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2610152Satgutier@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2710152Satgutier@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2810152Satgutier@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2910234Syasuko.eckert@amd.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3010152Satgutier@umich.edu *
3110152Satgutier@umich.edu ***************************************************************************/
3210152Satgutier@umich.edu
3310152Satgutier@umich.edu
3410152Satgutier@umich.edu#ifndef __UCACHE_H__
3510152Satgutier@umich.edu#define __UCACHE_H__
3610152Satgutier@umich.edu
3710152Satgutier@umich.edu#include <list>
3810152Satgutier@umich.edu
3910152Satgutier@umich.edu#include "area.h"
4010152Satgutier@umich.edu#include "nuca.h"
4110152Satgutier@umich.edu#include "router.h"
4210152Satgutier@umich.edu
4310234Syasuko.eckert@amd.comclass min_values_t {
4410234Syasuko.eckert@amd.compublic:
4510152Satgutier@umich.edu    double min_delay;
4610152Satgutier@umich.edu    double min_dyn;
4710152Satgutier@umich.edu    double min_leakage;
4810152Satgutier@umich.edu    double min_area;
4910152Satgutier@umich.edu    double min_cyc;
5010152Satgutier@umich.edu
5110152Satgutier@umich.edu    min_values_t() : min_delay(BIGNUM), min_dyn(BIGNUM), min_leakage(BIGNUM), min_area(BIGNUM), min_cyc(BIGNUM) { }
5210152Satgutier@umich.edu
5310152Satgutier@umich.edu    void update_min_values(const min_values_t * val);
5410152Satgutier@umich.edu    void update_min_values(const uca_org_t & res);
5510152Satgutier@umich.edu    void update_min_values(const nuca_org_t * res);
5610152Satgutier@umich.edu    void update_min_values(const mem_array * res);
5710152Satgutier@umich.edu};
5810152Satgutier@umich.edu
5910152Satgutier@umich.edu
6010152Satgutier@umich.edu
6110234Syasuko.eckert@amd.comstruct solution {
6210234Syasuko.eckert@amd.com    int    tag_array_index;
6310234Syasuko.eckert@amd.com    int    data_array_index;
6410234Syasuko.eckert@amd.com    list<mem_array *>::iterator tag_array_iter;
6510234Syasuko.eckert@amd.com    list<mem_array *>::iterator data_array_iter;
6610234Syasuko.eckert@amd.com    double access_time;
6710234Syasuko.eckert@amd.com    double cycle_time;
6810234Syasuko.eckert@amd.com    double area;
6910234Syasuko.eckert@amd.com    double efficiency;
7010234Syasuko.eckert@amd.com    powerDef total_power;
7110152Satgutier@umich.edu};
7210152Satgutier@umich.edu
7310152Satgutier@umich.edu
7410152Satgutier@umich.edu
7510152Satgutier@umich.edubool calculate_time(
7610152Satgutier@umich.edu    bool is_tag,
7710152Satgutier@umich.edu    int pure_ram,
7810152Satgutier@umich.edu    bool pure_cam,
7910152Satgutier@umich.edu    double Nspd,
8010152Satgutier@umich.edu    unsigned int Ndwl,
8110152Satgutier@umich.edu    unsigned int Ndbl,
8210152Satgutier@umich.edu    unsigned int Ndcm,
8310152Satgutier@umich.edu    unsigned int Ndsam_lev_1,
8410152Satgutier@umich.edu    unsigned int Ndsam_lev_2,
8510152Satgutier@umich.edu    mem_array *ptr_array,
8610152Satgutier@umich.edu    int flag_results_populate,
8710152Satgutier@umich.edu    results_mem_array *ptr_results,
8810152Satgutier@umich.edu    uca_org_t *ptr_fin_res,
8910152Satgutier@umich.edu    bool is_main_mem);
9010152Satgutier@umich.eduvoid update(uca_org_t *fin_res);
9110152Satgutier@umich.edu
9210152Satgutier@umich.eduvoid solve(uca_org_t *fin_res);
9310152Satgutier@umich.eduvoid init_tech_params(double tech, bool is_tag);
9410152Satgutier@umich.edu
9510152Satgutier@umich.edu
9610234Syasuko.eckert@amd.comstruct calc_time_mt_wrapper_struct {
9710234Syasuko.eckert@amd.com    uint32_t tid;
9810234Syasuko.eckert@amd.com    bool     is_tag;
9910234Syasuko.eckert@amd.com    bool     pure_ram;
10010234Syasuko.eckert@amd.com    bool     pure_cam;
10110234Syasuko.eckert@amd.com    bool     is_main_mem;
10210234Syasuko.eckert@amd.com    double   Nspd_min;
10310152Satgutier@umich.edu
10410234Syasuko.eckert@amd.com    min_values_t * data_res;
10510234Syasuko.eckert@amd.com    min_values_t * tag_res;
10610152Satgutier@umich.edu
10710234Syasuko.eckert@amd.com    list<mem_array *> data_arr;
10810234Syasuko.eckert@amd.com    list<mem_array *> tag_arr;
10910152Satgutier@umich.edu};
11010152Satgutier@umich.edu
11110152Satgutier@umich.eduvoid *calc_time_mt_wrapper(void * void_obj);
11210152Satgutier@umich.edu
11310152Satgutier@umich.edu#endif
114