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#ifndef __CONST_H__
3410152Satgutier@umich.edu#define __CONST_H__
3510152Satgutier@umich.edu
3610152Satgutier@umich.edu#include <math.h>
3710152Satgutier@umich.edu#include <stdint.h>
3810152Satgutier@umich.edu#include <stdio.h>
3910152Satgutier@umich.edu#include <stdlib.h>
4010152Satgutier@umich.edu#include <string.h>
4110152Satgutier@umich.edu
4210152Satgutier@umich.edu/*  The following are things you might want to change
4310152Satgutier@umich.edu *  when compiling
4410152Satgutier@umich.edu */
4510152Satgutier@umich.edu
4610152Satgutier@umich.edu/*
4710152Satgutier@umich.edu * Address bits in a word, and number of output bits from the cache
4810152Satgutier@umich.edu */
4910152Satgutier@umich.edu
5010152Satgutier@umich.edu/*
5110152Satgutier@umich.eduwas: #define ADDRESS_BITS 32
5210152Satgutier@umich.edunow: I'm using 42 bits as in the Power4,
5310152Satgutier@umich.edusince that's bigger then the 36 bits on the Pentium 4
5410152Satgutier@umich.eduand 40 bits on the Opteron
5510152Satgutier@umich.edu*/
5610152Satgutier@umich.educonst int ADDRESS_BITS = 42;
5710152Satgutier@umich.edu
5810152Satgutier@umich.edu/*dt: In addition to the tag bits, the tags also include 1 valid bit, 1 dirty bit, 2 bits for a 4-state
5910152Satgutier@umich.edu  cache coherency protocoll (MESI), 1 bit for MRU (change this to log(ways) for full LRU).
6010152Satgutier@umich.edu  So in total we have 1 + 1 + 2 + 1 = 5 */
6110152Satgutier@umich.educonst int EXTRA_TAG_BITS = 5;
6210152Satgutier@umich.edu
6310152Satgutier@umich.edu/* limits on the various N parameters */
6410152Satgutier@umich.edu
6510152Satgutier@umich.educonst unsigned int MAXDATAN     = 512;      // maximum for Ndwl and Ndbl
6610152Satgutier@umich.educonst unsigned int MAXSUBARRAYS = 1048576;  // maximum subarrays for data and tag arrays
6710152Satgutier@umich.educonst unsigned int MAXDATASPD   = 256;      // maximum for Nspd
6810152Satgutier@umich.educonst unsigned int MAX_COL_MUX  = 256;
6910152Satgutier@umich.edu
7010152Satgutier@umich.edu
7110152Satgutier@umich.edu
7210152Satgutier@umich.edu#define ROUTER_TYPES 3
7310152Satgutier@umich.edu#define WIRE_TYPES 6
7410152Satgutier@umich.edu
7510152Satgutier@umich.educonst double Cpolywire = 0;
7610152Satgutier@umich.edu
7710152Satgutier@umich.edu
7810152Satgutier@umich.edu/* Threshold voltages (as a proportion of Vdd)
7910152Satgutier@umich.edu   If you don't know them, set all values to 0.5 */
8010152Satgutier@umich.edu#define VTHFA1         0.452
8110152Satgutier@umich.edu#define VTHFA2         0.304
8210152Satgutier@umich.edu#define VTHFA3         0.420
8310152Satgutier@umich.edu#define VTHFA4         0.413
8410152Satgutier@umich.edu#define VTHFA5         0.405
8510152Satgutier@umich.edu#define VTHFA6         0.452
8610152Satgutier@umich.edu#define VSINV          0.452
8710152Satgutier@umich.edu#define VTHCOMPINV     0.437
8810152Satgutier@umich.edu#define VTHMUXNAND     0.548  // TODO : this constant must be revisited
8910152Satgutier@umich.edu#define VTHEVALINV     0.452
9010152Satgutier@umich.edu#define VTHSENSEEXTDRV 0.438
9110152Satgutier@umich.edu
9210152Satgutier@umich.edu
9310152Satgutier@umich.edu//WmuxdrvNANDn and WmuxdrvNANDp are no longer being used but it's part of the old
9410152Satgutier@umich.edu//delay_comparator function which we are using exactly as it used to be, so just setting these to 0
9510152Satgutier@umich.educonst double WmuxdrvNANDn = 0;
9610152Satgutier@umich.educonst double WmuxdrvNANDp = 0;
9710152Satgutier@umich.edu
9810152Satgutier@umich.edu
9910152Satgutier@umich.edu/*===================================================================*/
10010152Satgutier@umich.edu/*
10110152Satgutier@umich.edu * The following are things you probably wouldn't want to change.
10210152Satgutier@umich.edu */
10310152Satgutier@umich.edu
10410152Satgutier@umich.edu#define BIGNUM 1e30
10510152Satgutier@umich.edu#define INF 9999999
10610152Satgutier@umich.edu#define MAX(a,b) (((a)>(b))?(a):(b))
10710152Satgutier@umich.edu#define MIN(a,b) (((a)<(b))?(a):(b))
10810152Satgutier@umich.edu
10910152Satgutier@umich.edu/* Used to communicate with the horowitz model */
11010152Satgutier@umich.edu#define RISE 1
11110152Satgutier@umich.edu#define FALL 0
11210152Satgutier@umich.edu#define NCH  1
11310152Satgutier@umich.edu#define PCH  0
11410152Satgutier@umich.edu
11510152Satgutier@umich.edu
11610152Satgutier@umich.edu#define EPSILON 0.5 //v4.1: This constant is being used in order to fix floating point -> integer
11710152Satgutier@umich.edu//conversion problems that were occuring within CACTI. Typical problem that was occuring was
11810152Satgutier@umich.edu//that with different compilers a floating point number like 3.0 would get represented as either
11910152Satgutier@umich.edu//2.9999....or 3.00000001 and then the integer part of the floating point number (3.0) would
12010152Satgutier@umich.edu//be computed differently depending on the compiler. What we are doing now is to replace
12110152Satgutier@umich.edu//int (x) with (int) (x+EPSILON) where EPSILON is 0.5. This would fix such problems. Note that
12210152Satgutier@umich.edu//this works only when x is an integer >= 0.
12310152Satgutier@umich.edu/*
12410152Satgutier@umich.edu * Sheng thinks this is more a solution to solve the simple truncate problem
12510152Satgutier@umich.edu * (http://www.cs.tut.fi/~jkorpela/round.html) rather than the problem mentioned above.
12610152Satgutier@umich.edu * Unfortunately, this solution causes nasty bugs (different results when using O0 and O3).
12710152Satgutier@umich.edu * Moreover, round is not correct in CACTI since when an extra fraction of bit/line is needed,
12810152Satgutier@umich.edu * we need to provide a complete bit/line even the fraction is just 0.01.
12910152Satgutier@umich.edu * So, in later version than 6.5 we use (int)ceil() to get double to int conversion.
13010152Satgutier@umich.edu */
13110152Satgutier@umich.edu
13210152Satgutier@umich.edu#define EPSILON2 0.1
13310152Satgutier@umich.edu#define EPSILON3 0.6
13410152Satgutier@umich.edu
13510152Satgutier@umich.edu
13610152Satgutier@umich.edu#define MINSUBARRAYROWS 16 //For simplicity in modeling, for the row decoding structure, we assume
13710152Satgutier@umich.edu//that each row predecode block is composed of at least one 2-4 decoder. When the outputs from the
13810152Satgutier@umich.edu//row predecode blocks are combined this means that there are at least 4*4=16 row decode outputs
13910152Satgutier@umich.edu#define MAXSUBARRAYROWS 262144 //Each row predecode block produces a max of 2^9 outputs. So
14010152Satgutier@umich.edu//the maximum number of row decode outputs will be 2^9*2^9
14110152Satgutier@umich.edu#define MINSUBARRAYCOLS 2
14210152Satgutier@umich.edu#define MAXSUBARRAYCOLS 262144
14310152Satgutier@umich.edu
14410152Satgutier@umich.edu
14510152Satgutier@umich.edu#define INV 0
14610152Satgutier@umich.edu#define NOR 1
14710152Satgutier@umich.edu#define NAND 2
14810152Satgutier@umich.edu
14910152Satgutier@umich.edu
15010152Satgutier@umich.edu#define NUMBER_TECH_FLAVORS 4
15110152Satgutier@umich.edu
15210152Satgutier@umich.edu#define NUMBER_INTERCONNECT_PROJECTION_TYPES 2 //aggressive and conservative
15310152Satgutier@umich.edu//0 = Aggressive projections, 1 = Conservative projections
15410152Satgutier@umich.edu#define NUMBER_WIRE_TYPES 4 //local, semi-global and global
15510152Satgutier@umich.edu//1 = 'Semi-global' wire type, 2 = 'Global' wire type
15610152Satgutier@umich.edu
15710152Satgutier@umich.edu
15810152Satgutier@umich.educonst int dram_cell_tech_flavor = 3;
15910152Satgutier@umich.edu
16010152Satgutier@umich.edu
16110152Satgutier@umich.edu#define VBITSENSEMIN 0.08 //minimum bitline sense voltage is fixed to be 80 mV.
16210152Satgutier@umich.edu
16310152Satgutier@umich.edu#define fopt 4.0
16410152Satgutier@umich.edu
16510152Satgutier@umich.edu#define INPUT_WIRE_TO_INPUT_GATE_CAP_RATIO 0
16610152Satgutier@umich.edu#define BUFFER_SEPARATION_LENGTH_MULTIPLIER 1
16710152Satgutier@umich.edu#define NUMBER_MATS_PER_REDUNDANT_MAT 8
16810152Satgutier@umich.edu
16910152Satgutier@umich.edu#define NUMBER_STACKED_DIE_LAYERS 1
17010152Satgutier@umich.edu
17110152Satgutier@umich.edu// this variable can be set to carry out solution optimization for
17210152Satgutier@umich.edu// a maximum area allocation.
17310152Satgutier@umich.edu#define STACKED_DIE_LAYER_ALLOTED_AREA_mm2 0 //6.24 //6.21//71.5
17410152Satgutier@umich.edu
17510152Satgutier@umich.edu// this variable can also be employed when solution optimization
17610152Satgutier@umich.edu// with maximum area allocation is carried out.
17710152Satgutier@umich.edu#define MAX_PERCENT_AWAY_FROM_ALLOTED_AREA 50
17810152Satgutier@umich.edu
17910152Satgutier@umich.edu// this variable can also be employed when solution optimization
18010152Satgutier@umich.edu// with maximum area allocation is carried out.
18110152Satgutier@umich.edu#define MIN_AREA_EFFICIENCY 20
18210152Satgutier@umich.edu
18310152Satgutier@umich.edu// this variable can be employed when solution with a desired
18410152Satgutier@umich.edu// aspect ratio is required.
18510152Satgutier@umich.edu#define STACKED_DIE_LAYER_ASPECT_RATIO 1
18610152Satgutier@umich.edu
18710152Satgutier@umich.edu// this variable can be employed when solution with a desired
18810152Satgutier@umich.edu// aspect ratio is required.
18910152Satgutier@umich.edu#define MAX_PERCENT_AWAY_FROM_ASPECT_RATIO 101
19010152Satgutier@umich.edu
19110152Satgutier@umich.edu// this variable can be employed to carry out solution optimization
19210152Satgutier@umich.edu// for a certain target random cycle time.
19310152Satgutier@umich.edu#define TARGET_CYCLE_TIME_ns 1000000000
19410152Satgutier@umich.edu
19510152Satgutier@umich.edu#define NUMBER_PIPELINE_STAGES 4
19610152Satgutier@umich.edu
19710152Satgutier@umich.edu// this can be used to model the length of interconnect
19810152Satgutier@umich.edu// between a bank and a crossbar
19910152Satgutier@umich.edu#define LENGTH_INTERCONNECT_FROM_BANK_TO_CROSSBAR 0 //3791 // 2880//micron
20010152Satgutier@umich.edu
20110152Satgutier@umich.edu#define IS_CROSSBAR 0
20210152Satgutier@umich.edu#define NUMBER_INPUT_PORTS_CROSSBAR 8
20310152Satgutier@umich.edu#define NUMBER_OUTPUT_PORTS_CROSSBAR 8
20410152Satgutier@umich.edu#define NUMBER_SIGNALS_PER_PORT_CROSSBAR 256
20510152Satgutier@umich.edu
20610152Satgutier@umich.edu
20710152Satgutier@umich.edu#define MAT_LEAKAGE_REDUCTION_DUE_TO_SLEEP_TRANSISTORS_FACTOR 1
20810152Satgutier@umich.edu#define LEAKAGE_REDUCTION_DUE_TO_LONG_CHANNEL_HP_TRANSISTORS_FACTOR 1
20910152Satgutier@umich.edu
21010152Satgutier@umich.edu#define PAGE_MODE 0
21110152Satgutier@umich.edu
21210152Satgutier@umich.edu#define MAIN_MEM_PER_CHIP_STANDBY_CURRENT_mA 60
21310152Satgutier@umich.edu// We are actually not using this variable in the CACTI code. We just want to acknowledge that
21410152Satgutier@umich.edu// this current should be multiplied by the DDR(n) system VDD value to compute the standby power
21510152Satgutier@umich.edu// consumed during precharge.
21610152Satgutier@umich.edu
21710152Satgutier@umich.edu
21810152Satgutier@umich.educonst double VDD_STORAGE_LOSS_FRACTION_WORST = 0.125;
21910152Satgutier@umich.educonst double CU_RESISTIVITY = 0.022; //ohm-micron
22010152Satgutier@umich.educonst double BULK_CU_RESISTIVITY = 0.018; //ohm-micron
22110152Satgutier@umich.educonst double PERMITTIVITY_FREE_SPACE = 8.854e-18; //F/micron
22210152Satgutier@umich.edu
22310152Satgutier@umich.educonst static uint32_t sram_num_cells_wl_stitching_ = 16;
22410152Satgutier@umich.educonst static uint32_t dram_num_cells_wl_stitching_ = 64;
22510152Satgutier@umich.educonst static uint32_t comm_dram_num_cells_wl_stitching_ = 256;
22610152Satgutier@umich.educonst static double num_bits_per_ecc_b_          = 8.0;
22710152Satgutier@umich.edu
22810152Satgutier@umich.educonst double    bit_to_byte  = 8.0;
22910152Satgutier@umich.edu
23010152Satgutier@umich.edu#define MAX_NUMBER_GATES_STAGE 20
23110152Satgutier@umich.edu#define MAX_NUMBER_HTREE_NODES 20
23210152Satgutier@umich.edu#define NAND2_LEAK_STACK_FACTOR 0.2
23310152Satgutier@umich.edu#define NAND3_LEAK_STACK_FACTOR 0.2
23410152Satgutier@umich.edu#define NOR2_LEAK_STACK_FACTOR 0.2
23510152Satgutier@umich.edu#define INV_LEAK_STACK_FACTOR  0.5
23610152Satgutier@umich.edu#define MAX_NUMBER_ARRAY_PARTITIONS 1000000
23710152Satgutier@umich.edu
23810152Satgutier@umich.edu// abbreviations used in this project
23910152Satgutier@umich.edu// ----------------------------------
24010152Satgutier@umich.edu//
24110152Satgutier@umich.edu//  num  : number
24210152Satgutier@umich.edu//  rw   : read/write
24310152Satgutier@umich.edu//  rd   : read
24410152Satgutier@umich.edu//  wr   : write
24510152Satgutier@umich.edu//  se   : single-ended
24610152Satgutier@umich.edu//  sz   : size
24710152Satgutier@umich.edu//  F    : feature
24810152Satgutier@umich.edu//  w    : width
24910152Satgutier@umich.edu//  h    : height or horizontal
25010152Satgutier@umich.edu//  v    : vertical or velocity
25110152Satgutier@umich.edu
25210152Satgutier@umich.edu
25310234Syasuko.eckert@amd.comenum ram_cell_tech_type_num {
25410234Syasuko.eckert@amd.com    itrs_hp   = 0,
25510234Syasuko.eckert@amd.com    itrs_lstp = 1,
25610234Syasuko.eckert@amd.com    itrs_lop  = 2,
25710234Syasuko.eckert@amd.com    lp_dram   = 3,
25810234Syasuko.eckert@amd.com    comm_dram = 4
25910152Satgutier@umich.edu};
26010152Satgutier@umich.edu
26110234Syasuko.eckert@amd.comconst double pppm[4]      = {1, 1, 1, 1};
26210234Syasuko.eckert@amd.comconst double pppm_lkg[4]  = {0, 1, 1, 0};
26310234Syasuko.eckert@amd.comconst double pppm_dyn[4]  = {1, 0, 0, 0};
26410234Syasuko.eckert@amd.comconst double pppm_Isub[4] = {0, 1, 0, 0};
26510234Syasuko.eckert@amd.comconst double pppm_Ig[4]   = {0, 0, 1, 0};
26610234Syasuko.eckert@amd.comconst double pppm_sc[4]   = {0, 0, 0, 1};
26710152Satgutier@umich.edu
26810152Satgutier@umich.edu
26910152Satgutier@umich.edu
27010152Satgutier@umich.edu#endif
271