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#ifndef __CONST_H__
34#define __CONST_H__
35
36#include <math.h>
37#include <stdint.h>
38#include <stdio.h>
39#include <stdlib.h>
40#include <string.h>
41
42/*  The following are things you might want to change
43 *  when compiling
44 */
45
46/*
47 * Address bits in a word, and number of output bits from the cache
48 */
49
50/*
51was: #define ADDRESS_BITS 32
52now: I'm using 42 bits as in the Power4,
53since that's bigger then the 36 bits on the Pentium 4
54and 40 bits on the Opteron
55*/
56const int ADDRESS_BITS = 42;
57
58/*dt: In addition to the tag bits, the tags also include 1 valid bit, 1 dirty bit, 2 bits for a 4-state
59  cache coherency protocoll (MESI), 1 bit for MRU (change this to log(ways) for full LRU).
60  So in total we have 1 + 1 + 2 + 1 = 5 */
61const int EXTRA_TAG_BITS = 5;
62
63/* limits on the various N parameters */
64
65const unsigned int MAXDATAN     = 512;      // maximum for Ndwl and Ndbl
66const unsigned int MAXSUBARRAYS = 1048576;  // maximum subarrays for data and tag arrays
67const unsigned int MAXDATASPD   = 256;      // maximum for Nspd
68const unsigned int MAX_COL_MUX  = 256;
69
70
71
72#define ROUTER_TYPES 3
73#define WIRE_TYPES 6
74
75const double Cpolywire = 0;
76
77
78/* Threshold voltages (as a proportion of Vdd)
79   If you don't know them, set all values to 0.5 */
80#define VTHFA1         0.452
81#define VTHFA2         0.304
82#define VTHFA3         0.420
83#define VTHFA4         0.413
84#define VTHFA5         0.405
85#define VTHFA6         0.452
86#define VSINV          0.452
87#define VTHCOMPINV     0.437
88#define VTHMUXNAND     0.548  // TODO : this constant must be revisited
89#define VTHEVALINV     0.452
90#define VTHSENSEEXTDRV 0.438
91
92
93//WmuxdrvNANDn and WmuxdrvNANDp are no longer being used but it's part of the old
94//delay_comparator function which we are using exactly as it used to be, so just setting these to 0
95const double WmuxdrvNANDn = 0;
96const double WmuxdrvNANDp = 0;
97
98
99/*===================================================================*/
100/*
101 * The following are things you probably wouldn't want to change.
102 */
103
104#define BIGNUM 1e30
105#define INF 9999999
106#define MAX(a,b) (((a)>(b))?(a):(b))
107#define MIN(a,b) (((a)<(b))?(a):(b))
108
109/* Used to communicate with the horowitz model */
110#define RISE 1
111#define FALL 0
112#define NCH  1
113#define PCH  0
114
115
116#define EPSILON 0.5 //v4.1: This constant is being used in order to fix floating point -> integer
117//conversion problems that were occuring within CACTI. Typical problem that was occuring was
118//that with different compilers a floating point number like 3.0 would get represented as either
119//2.9999....or 3.00000001 and then the integer part of the floating point number (3.0) would
120//be computed differently depending on the compiler. What we are doing now is to replace
121//int (x) with (int) (x+EPSILON) where EPSILON is 0.5. This would fix such problems. Note that
122//this works only when x is an integer >= 0.
123/*
124 * Sheng thinks this is more a solution to solve the simple truncate problem
125 * (http://www.cs.tut.fi/~jkorpela/round.html) rather than the problem mentioned above.
126 * Unfortunately, this solution causes nasty bugs (different results when using O0 and O3).
127 * Moreover, round is not correct in CACTI since when an extra fraction of bit/line is needed,
128 * we need to provide a complete bit/line even the fraction is just 0.01.
129 * So, in later version than 6.5 we use (int)ceil() to get double to int conversion.
130 */
131
132#define EPSILON2 0.1
133#define EPSILON3 0.6
134
135
136#define MINSUBARRAYROWS 16 //For simplicity in modeling, for the row decoding structure, we assume
137//that each row predecode block is composed of at least one 2-4 decoder. When the outputs from the
138//row predecode blocks are combined this means that there are at least 4*4=16 row decode outputs
139#define MAXSUBARRAYROWS 262144 //Each row predecode block produces a max of 2^9 outputs. So
140//the maximum number of row decode outputs will be 2^9*2^9
141#define MINSUBARRAYCOLS 2
142#define MAXSUBARRAYCOLS 262144
143
144
145#define INV 0
146#define NOR 1
147#define NAND 2
148
149
150#define NUMBER_TECH_FLAVORS 4
151
152#define NUMBER_INTERCONNECT_PROJECTION_TYPES 2 //aggressive and conservative
153//0 = Aggressive projections, 1 = Conservative projections
154#define NUMBER_WIRE_TYPES 4 //local, semi-global and global
155//1 = 'Semi-global' wire type, 2 = 'Global' wire type
156
157
158const int dram_cell_tech_flavor = 3;
159
160
161#define VBITSENSEMIN 0.08 //minimum bitline sense voltage is fixed to be 80 mV.
162
163#define fopt 4.0
164
165#define INPUT_WIRE_TO_INPUT_GATE_CAP_RATIO 0
166#define BUFFER_SEPARATION_LENGTH_MULTIPLIER 1
167#define NUMBER_MATS_PER_REDUNDANT_MAT 8
168
169#define NUMBER_STACKED_DIE_LAYERS 1
170
171// this variable can be set to carry out solution optimization for
172// a maximum area allocation.
173#define STACKED_DIE_LAYER_ALLOTED_AREA_mm2 0 //6.24 //6.21//71.5
174
175// this variable can also be employed when solution optimization
176// with maximum area allocation is carried out.
177#define MAX_PERCENT_AWAY_FROM_ALLOTED_AREA 50
178
179// this variable can also be employed when solution optimization
180// with maximum area allocation is carried out.
181#define MIN_AREA_EFFICIENCY 20
182
183// this variable can be employed when solution with a desired
184// aspect ratio is required.
185#define STACKED_DIE_LAYER_ASPECT_RATIO 1
186
187// this variable can be employed when solution with a desired
188// aspect ratio is required.
189#define MAX_PERCENT_AWAY_FROM_ASPECT_RATIO 101
190
191// this variable can be employed to carry out solution optimization
192// for a certain target random cycle time.
193#define TARGET_CYCLE_TIME_ns 1000000000
194
195#define NUMBER_PIPELINE_STAGES 4
196
197// this can be used to model the length of interconnect
198// between a bank and a crossbar
199#define LENGTH_INTERCONNECT_FROM_BANK_TO_CROSSBAR 0 //3791 // 2880//micron
200
201#define IS_CROSSBAR 0
202#define NUMBER_INPUT_PORTS_CROSSBAR 8
203#define NUMBER_OUTPUT_PORTS_CROSSBAR 8
204#define NUMBER_SIGNALS_PER_PORT_CROSSBAR 256
205
206
207#define MAT_LEAKAGE_REDUCTION_DUE_TO_SLEEP_TRANSISTORS_FACTOR 1
208#define LEAKAGE_REDUCTION_DUE_TO_LONG_CHANNEL_HP_TRANSISTORS_FACTOR 1
209
210#define PAGE_MODE 0
211
212#define MAIN_MEM_PER_CHIP_STANDBY_CURRENT_mA 60
213// We are actually not using this variable in the CACTI code. We just want to acknowledge that
214// this current should be multiplied by the DDR(n) system VDD value to compute the standby power
215// consumed during precharge.
216
217
218const double VDD_STORAGE_LOSS_FRACTION_WORST = 0.125;
219const double CU_RESISTIVITY = 0.022; //ohm-micron
220const double BULK_CU_RESISTIVITY = 0.018; //ohm-micron
221const double PERMITTIVITY_FREE_SPACE = 8.854e-18; //F/micron
222
223const static uint32_t sram_num_cells_wl_stitching_ = 16;
224const static uint32_t dram_num_cells_wl_stitching_ = 64;
225const static uint32_t comm_dram_num_cells_wl_stitching_ = 256;
226const static double num_bits_per_ecc_b_          = 8.0;
227
228const double    bit_to_byte  = 8.0;
229
230#define MAX_NUMBER_GATES_STAGE 20
231#define MAX_NUMBER_HTREE_NODES 20
232#define NAND2_LEAK_STACK_FACTOR 0.2
233#define NAND3_LEAK_STACK_FACTOR 0.2
234#define NOR2_LEAK_STACK_FACTOR 0.2
235#define INV_LEAK_STACK_FACTOR  0.5
236#define MAX_NUMBER_ARRAY_PARTITIONS 1000000
237
238// abbreviations used in this project
239// ----------------------------------
240//
241//  num  : number
242//  rw   : read/write
243//  rd   : read
244//  wr   : write
245//  se   : single-ended
246//  sz   : size
247//  F    : feature
248//  w    : width
249//  h    : height or horizontal
250//  v    : vertical or velocity
251
252
253enum ram_cell_tech_type_num {
254    itrs_hp   = 0,
255    itrs_lstp = 1,
256    itrs_lop  = 2,
257    lp_dram   = 3,
258    comm_dram = 4
259};
260
261const double pppm[4]      = {1, 1, 1, 1};
262const double pppm_lkg[4]  = {0, 1, 1, 0};
263const double pppm_dyn[4]  = {1, 0, 0, 0};
264const double pppm_Isub[4] = {0, 1, 0, 0};
265const double pppm_Ig[4]   = {0, 0, 1, 0};
266const double pppm_sc[4]   = {0, 0, 0, 1};
267
268
269
270#endif
271