?? area.c.svn-base
字號:
if (i == iter_height)
{
total_height =
2 * inter_height + data / blocks * multiplier +
fixed_tracks_external;
total_width =
2 * inter_width + data / (2 * blocks) * multiplier +
fixed_tracks_internal;}
else
{
total_height =
2 * inter_height + data / blocks * multiplier +
fixed_tracks_internal;
total_width =
2 * inter_width + data / (2 * blocks) * multiplier +
fixed_tracks_internal;
inter_height = total_height;
inter_width = total_width;
multiplier = multiplier * 4;
}
}
}
else
{
htree_half = htree - 1;
iter_height = htree_half / 2;
for (i = 0; i <= iter_height; i++)
{
total_height =
2 * inter_height + data / blocks * multiplier +
fixed_tracks_internal;
total_width =
2 * inter_width + data / (2 * blocks) * multiplier +
fixed_tracks_internal;
inter_height = total_height;
inter_width = total_width;
multiplier = multiplier * 4;
}
total_width =
2 * inter_width + data / (2 * blocks) * multiplier +
fixed_tracks_external;
}
}
dataarray_area.width = total_width;
dataarray_area.height = total_height;
temp.height = dataarray_area.width;
temp.width = dataarray_area.height;
temp_aspect =
((temp.height / temp.width) >
1.0) ? (temp.height / temp.width) : 1.0 / (temp.height / temp.width);
aspect_ratio_data =
((dataarray_area.height / dataarray_area.width) >
1.0) ? (dataarray_area.height / dataarray_area.width) : 1.0 /
(dataarray_area.height / dataarray_area.width);
if (aspect_ratio_data > temp_aspect)
{
dataarray_area.height = temp.height;
dataarray_area.width = temp.width;
}
aspect_ratio_data =
((dataarray_area.height / dataarray_area.width) >
1.0) ? (dataarray_area.height / dataarray_area.width) : 1.0 /
(dataarray_area.height / dataarray_area.width);
return (dataarray_area);
}
area_type
tagsubarray (int baddr,int C,int B,int A,int Ndbl,int Ndwl,double Nspd,double NSubbanks,int RWP,int ERP,int EWP,int NSER,
double techscaling_factor)
{
int conservative_NSER;
area_type tagsubarray_area, tag_area, postdecode_area, colmux_area,
precharge_area, senseamp_area, comp_area;
conservative_NSER = 0;
tag_area =
subarraytag_area (baddr, C, B, A, Ndbl, Ndwl, Nspd, NSubbanks, RWP, ERP,
EWP, conservative_NSER, techscaling_factor);
postdecode_area =
decodetag_row (baddr, C, B, A, Ndbl, Nspd, Ndwl, NSubbanks, RWP, ERP,
EWP);
colmux_area = colmux (Ndbl, Nspd, RWP, ERP, EWP, conservative_NSER);
precharge_area = precharge (Ndbl, Nspd, RWP, ERP, EWP, conservative_NSER);
senseamp_area = senseamp (Ndbl, Nspd, RWP, ERP, EWP, conservative_NSER);
comp_area = comparatorbit (RWP, ERP, EWP);
tagsubarray_area.height =
tag_area.height + colmux_area.height + precharge_area.height +
senseamp_area.height + comp_area.height;
tagsubarray_area.width = tag_area.width + postdecode_area.width;
return (tagsubarray_area);
}
area_type
tagsubblock (int baddr,int C,int B,int A,int Ndbl,int Ndwl,double Nspd,double NSubbanks,int SB,int RWP,int ERP,int EWP,
int NSER,double techscaling_factor)
{
int N3to8, T;
int SB_;
//int colmuxtracks_rem, writeseltracks_rem;
int colmuxtracks_rem;
double tracks_h, tracks_w;
area_type tagsubarray_area, tagsubblock_area;
int conservative_NSER;
conservative_NSER = 0;
SB_ = SB;
if (SB_ == 0)
{
SB_ = 1;
}
//v4.1: using integer casting below
//N3to8 =
//ceil ((1.0 / 3.0) * logtwo_area ((double) (C / (B * A * Ndbl * Nspd))));
N3to8 =
(int) (ceil ((1.0 / 3.0) * logtwo_area ((double) (C / (B * A * Ndbl * Nspd)))));
if (N3to8 == 0)
{
N3to8 = 1;
}
//v4.1: Fixing double->int type conversion problems. EPSILON is added below to make sure
//the final int value is the correct one
//T =
//baddr - logtwo_area ((double) (C)) + logtwo_area ((double) (A)) + 2 -
//logtwo_area ((double) (NSubbanks));
T =
(int) (baddr - logtwo_area ((double) (C)) + logtwo_area ((double) (A)) + 2 -
logtwo_area ((double) (NSubbanks)) + EPSILON);
colmuxtracks_rem =
(Ndbl * Nspd >
tracks_precharge_p) ? (Ndbl * Nspd - tracks_precharge_p) : 0;
/*writeseltracks_rem = ((2*B*A)/(b0) > tracks_precharge_nx2) ? ((2*B*A)/(b0)-tracks_precharge_nx2) : 0; */
tracks_h =
Widthtrack * (N3to8 * 8 * (RWP + ERP + EWP) +
(RWP + EWP) * colmuxtracks_rem + Ndbl * Nspd * ERP + (RWP +
ERP +
EWP) *
T / SB_ + (ERP + RWP) * A);
tracks_w = Widthtrack * (N3to8 * 8) * (RWP + ERP + EWP);
tagsubarray_area =
tagsubarray (baddr, C, B, A, Ndbl, Ndwl, Nspd, NSubbanks, RWP, ERP, EWP,
conservative_NSER, techscaling_factor);
tagsubblock_area.height = 2 * tagsubarray_area.height + tracks_h;
tagsubblock_area.width = 2 * tagsubarray_area.width + tracks_w;
return (tagsubblock_area);
}
area_type
tagarray (int baddr,int C,int B,int A,int Ndbl,int Ndwl,double Nspd,double NSubbanks,int RWP,int ERP,int EWP,int NSER,
double techscaling_factor)
{
//int SB, CSB, N3to8, T;
int SB, N3to8, T;
area_type tagarray_area, tagsubarray_area, tagsubblock_area;
area_type temp;
double temp_aspect;
int conservative_NSER;
double fixed_tracks_internal, fixed_tracks_external, variable_tracks;
double tag, assoc, colmux, predecode, addresslines;
int blocks, htree, htree_half, i, multiplier, iter_height;
double inter_height, inter_width, total_height, total_width;
conservative_NSER = 0;
SB = Ndwl * Ndbl / 4;
//v4.1: using integer casting below
//N3to8 =
//ceil ((1.0 / 3.0) * logtwo_area ((double) (C / (B * A * Ndbl * Nspd))));
N3to8 =
(int) (ceil ((1.0 / 3.0) * logtwo_area ((double) (C / (B * A * Ndbl * Nspd)))));
if (N3to8 == 0)
{
N3to8 = 1;
}
//Added by Shyam to make area model sensitive to "change tag" feature
//v4.1: Fixing double->int type conversion problems. EPSILON is added below to make sure
//the final int value is the correct one
if(!force_tag) {
//T = ADDRESS_BITS + EXTRA_TAG_BITS-(int)logtwo((double)C)+(int)logtwo((double)A)-(int)(logtwo(NSubbanks));
T = (int) (ADDRESS_BITS + EXTRA_TAG_BITS-(int)logtwo((double)C)+(int)logtwo((double)A)-(int)(logtwo(NSubbanks)) + EPSILON);
}
else {
T = force_tag_size;
}
//Commented by Shyam T =
//baddr - logtwo_area ((double) (C)) + logtwo_area ((double) (A)) + 2 -
//logtwo_area ((double) (NSubbanks));
tag = T * (RWP + ERP + EWP) * Widthtrack;
assoc = (RWP + ERP) * A * Widthtrack;
colmux = Ndbl * Nspd * (RWP + EWP + ERP) * Widthtrack;
predecode = (RWP + ERP + EWP) * N3to8 * 8 * Widthtrack;
addresslines = ADDRESS_BITS * (RWP + ERP + EWP) * Widthtrack;
tagsubarray_area =
tagsubarray (baddr, C, B, A, Ndbl, Ndwl, Nspd, NSubbanks, RWP, ERP, EWP,
conservative_NSER, techscaling_factor);
tagsubblock_area =
tagsubblock (baddr, C, B, A, Ndbl, Ndwl, Nspd, NSubbanks, SB, RWP, ERP,
EWP, conservative_NSER, techscaling_factor);
//area_all_tagsubarrays =
//Ndbl * Ndwl * calculate_area (tagsubarray_area,
//techscaling_factor) * CONVERT_TO_MMSQUARE;
area_all_tagsubarrays = Ndbl * Ndwl * tagsubarray_area.height * tagsubarray_area.width * CONVERT_TO_MMSQUARE;
fixed_tracks_internal = colmux + predecode + assoc;
fixed_tracks_external = colmux + assoc + addresslines;
variable_tracks = tag;
if (SB == 0)
{
if (Ndbl * Ndwl == 1)
{
total_height =
tagsubarray_area.height + fixed_tracks_external + tag;
total_width = tagsubarray_area.width + predecode;
}
else
{
total_height =
2 * tagsubarray_area.height + fixed_tracks_external + tag;
total_width = tagsubarray_area.width + predecode;
}
}
if (SB == 1)
{
total_height = tagsubblock_area.height;
total_width = tagsubblock_area.width;
}
if (SB == 2)
{
total_height = tagsubblock_area.height;
total_width = 2 * tagsubblock_area.width + fixed_tracks_external + tag;
}
if (SB == 4)
{
total_height =
2 * tagsubblock_area.height + fixed_tracks_external + tag;
total_width =
2 * tagsubblock_area.width + fixed_tracks_internal +
variable_tracks / 2;
}
if (SB == 8)
{
total_height =
2 * tagsubblock_area.height + fixed_tracks_internal +
variable_tracks / 2;
total_width =
2 * (2 * tagsubblock_area.width + variable_tracks / 4) +
fixed_tracks_external + tag;
}
if (SB > 8)
{
blocks = SB / 4;
//v4.1: Fixing double->int type conversion problems. EPSILON is added below to make sure
//the final int value is the correct one
//htree = (int) (logtwo_area ((double) (blocks)));
htree = (int) (logtwo_area ((double) (blocks)) + EPSILON);
inter_height = tagsubblock_area.height;
inter_width = tagsubblock_area.width;
multiplier = 1;
if (htree % 2 == 0)
{
iter_height = htree / 2;
}
if (htree % 2 == 0)
{
for (i = 0; i <= iter_height; i++)
{
if (i == iter_height)
{
total_height =
2 * inter_height + tag / blocks * multiplier +
fixed_tracks_external;
total_width =
2 * inter_width + tag / (2 * blocks) * multiplier +
fixed_tracks_internal;}
else
{
total_height =
2 * inter_height + tag / blocks * multiplier +
fixed_tracks_internal;
total_width =
2 * inter_width + tag / (2 * blocks) * multiplier +
fixed_tracks_internal;
inter_height = total_height;
inter_width = total_width;
multiplier = multiplier * 4;
}
}
}
else
{
htree_half = htree - 1;
iter_height = htree_half / 2;
for (i = 0; i <= iter_height; i++)
{
total_height =
2 * inter_height + tag / blocks * multiplier +
fixed_tracks_internal;
total_width =
2 * inter_width + tag / (2 * blocks) * multiplier +
fixed_tracks_internal;
inter_height = total_height;
inter_width = total_width;
multiplier = multiplier * 4;
}
total_width =
2 * inter_width + tag / (2 * blocks) * multiplier +
fixed_tracks_external;
}
}
tagarray_area.width = total_width;
tagarray_area.height = total_height;
temp.height = tagarray_area.width;
temp.width = tagarray_area.height;
temp_aspect =
((temp.height / temp.width) >
1.0) ? (temp.height / temp.width) : 1.0 / (temp.height / temp.width);
aspect_ratio_tag =
((tagarray_area.height / tagarray_area.width) >
1.0) ? (tagarray_area.height / tagarray_area.width) : 1.0 /
(tagarray_area.height / tagarray_area.width);
if (aspect_ratio_tag > temp_aspect)
{
tagarray_area.height = temp.height;
tagarray_area.width = temp.width;
}
aspect_ratio_tag =
((tagarray_area.height / tagarray_area.width) >
1.0) ? (tagarray_area.height / tagarray_area.width) : 1.0 /
(tagarray_area.height / tagarray_area.width);
return (tagarray_area);
}
void
area (int baddr,int b0,int Ndbl,int Ndwl,double Nspd,int Ntbl,int Ntwl,int Ntspd,double NSubbanks,parameter_type *parameters,
arearesult_type *result)
{
int rows_datasubarray;
//v4.1. Making colns_datasubarray double datatype since it is dependent on Nspd
//which is double. Note that based on its usage below colns_datasubarray is a misnomer.
//colns_datasubarray is actually the degree of output muxing.
double colns_datasubarray;
int rows_tagsubarray, colns_tagsubarray;
rows_datasubarray =
(parameters->cache_size /
((parameters->block_size) * (parameters->data_associativity) * Ndbl * Nspd));
colns_datasubarray = (Ndbl * Nspd);
rows_tagsubarray =
(parameters->cache_size /
((parameters->block_size) * (parameters->tag_associativity) * Ntbl * Ntspd));
colns_tagsubarray = (Ntbl * Ntspd);
result->dataarray_area =
dataarray (parameters->cache_size, parameters->block_size,
parameters->data_associativity, Ndbl, Ndwl, Nspd, b0,
parameters->num_readwrite_ports, parameters->num_read_ports,
parameters->num_write_ports,
parameters->num_single_ended_read_ports,
parameters->fudgefactor);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -