?? io.c.svn-base
字號:
/*------------------------------------------------------------
* CACTI 4.0
* Copyright 2005 Hewlett-Packard Development Corporation
* All Rights Reserved
*
* Permission to use, copy, and modify this software and its documentation is
* hereby granted only under the following terms and conditions. Both the
* above copyright notice and this permission notice must appear in all copies
* of the software, derivative works or modified versions, and any portions
* thereof, and both notices must appear in supporting documentation.
*
* Users of this software agree to the terms and conditions set forth herein, and
* hereby grant back to Hewlett-Packard Company and its affiliated companies ("HP")
* a non-exclusive, unrestricted, royalty-free right and license under any changes,
* enhancements or extensions made to the core functions of the software, including
* but not limited to those affording compatibility with other hardware or software
* environments, but excluding applications which incorporate this software.
* Users further agree to use their best efforts to return to HP any such changes,
* enhancements or extensions that they make and inform HP of noteworthy uses of
* this software. Correspondence should be provided to HP at:
*
* Director of Intellectual Property Licensing
* Office of Strategy and Technology
* Hewlett-Packard Company
* 1501 Page Mill Road
* Palo Alto, California 94304
*
* This software may be distributed (but not offered for sale or transferred
* for compensation) to third parties, provided such third parties agree to
* abide by the terms and conditions of this notice.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND HP DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL HP
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*------------------------------------------------------------*/
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "def.h"
#include "areadef.h"
#include "basic_circuit.h"
#include "leakage.h"
#include "time.h"
#define NEXTINT(a) skip(); scanf("%d",&(a));
#define NEXTFLOAT(a) skip(); scanf("%lf",&(a));
/*---------------------------------------------------------------*/
//v4.1: No longer using calculate_area function as area has already been
//computed for the given tech node
//extern double calculate_area(area_type,double);
int input_data(int argc,char *argv[])
{
int C,B,A,ERP,EWP,RWP,NSER, NSubbanks, fully_assoc;
double tech;
double logbanks, assoc;
double logbanksfloor, assocfloor;
int bits_output = 64;
/*if ((argc!=6) && (argc!=9)) {
printf("Cmd-line parameters: C B A TECH NSubbanks\n");
printf(" OR: C B A TECH RWP ERP EWP NSubbanks\n");
exit(0);
}*/
if ((argc!=6) && (argc!=9)&& (argc!=15)) {
printf("Cmd-line parameters: C B A TECH NSubbanks\n");
printf(" OR: C B A TECH RWP ERP EWP NSubbanks\n");
exit(1);
}
B = atoi(argv[2]);
if ((B < 1)) {
printf("Block size must >=1\n");
exit(1);
}
if (argc==9)
{
if ((B*8 < bits_output)) {
printf("Block size must be at least %d\n", bits_output/8);
exit(1);
}
tech = atof(argv[4]);
if ((tech <= 0)) {
printf("Feature size must be > 0\n");
exit(1);
}
if ((tech > 0.8)) {
printf("Feature size must be <= 0.80 (um)\n");
exit(1);
}
RWP = atoi(argv[5]);
ERP = atoi(argv[6]);
EWP = atoi(argv[7]);
NSER = 0;
if ((RWP < 0) || (EWP < 0) || (ERP < 0)) {
printf("Ports must >=0\n");
exit(1);
}
if (RWP > 2) {
printf("Maximum of 2 read/write ports\n");
exit(1);
}
if ((RWP+ERP+EWP) < 1) {
printf("Must have at least one port\n");
exit(1);
}
NSubbanks = atoi(argv[8]);
if (NSubbanks < 1 ) {
printf("Number of subbanks should be greater than or equal to 1 and should be a power of 2\n");
exit(1);
}
logbanks = logtwo((double)(NSubbanks));
logbanksfloor = floor(logbanks);
if(logbanks > logbanksfloor){
printf("Number of subbanks should be greater than or equal to 1 and should be a power of 2\n");
exit(1);
}
}
else if(argc==6)
{
if ((B*8 < bits_output)) {
printf("Block size must be at least %d\n", bits_output/8);
exit(1);
}
tech = atof(argv[4]);
if ((tech <= 0)) {
printf("Feature size must be > 0\n");
exit(1);
}
if ((tech > 0.8)) {
printf("Feature size must be <= 0.80 (um)\n");
exit(1);
}
RWP=1;
ERP=0;
EWP=0;
NSER=0;
NSubbanks = atoi(argv[5]);
if (NSubbanks < 1 ) {
printf("Number of subbanks should be greater than or equal to 1 and should be a power of 2\n");
exit(1);
}
logbanks = logtwo((double)(NSubbanks));
logbanksfloor = floor(logbanks);
if(logbanks > logbanksfloor){
printf("Number of subbanks should be greater than or equal to 1 and should be a power of 2\n");
exit(1);
}
}
else
{
tech = atof(argv[9]);
NSubbanks = atoi(argv[8]);
if ((tech <= 0)) {
printf("Feature size must be > 0\n");
exit(1);
}
if ((tech > 0.8)) {
printf("Feature size must be <= 0.80 (um)\n");
exit(1);
}
}
C = atoi(argv[1])/((int) (NSubbanks));
if (atoi(argv[1]) < 64) {
printf("Cache size must be greater than 32!\n");
exit(1);
}
if ((strcmp(argv[3],"FA") == 0) || (argv[3][0] == '0'))
{
A=C/B;
fully_assoc = 1;
}
else
{
if (strcmp(argv[3],"DM") == 0)
{
A=1;
fully_assoc = 0;
}
else
{
fully_assoc = 0;
A = atoi(argv[3]);
if ((A < 0)||(A > 16)) {
printf("Associativity must be 1,2,4,8,16 or 0(fully associative)\n");
exit(1);
}
assoc = logtwo((double)(A));
assocfloor = floor(assoc);
if(assoc > assocfloor){
printf("Associativity should be a power of 2\n");
exit(1);
}
}
}
if (!fully_assoc && C/(B*A) < 1) {
printf("Number of sets is less than 1:\n Need to either increase cache size, or decrease associativity or block size\n (or use fully associative cache)\n");
exit(1);
}
return(OK);
}
void output_time_components(result_type *result,parameter_type *parameters)
{
int A;
printf(" address routing delay (ns): %g\n",result->subbank_address_routing_delay/1e-9);
//printf(" address routing power (nJ): %g\n",result->subbank_address_routing_power*1e9);
A=parameters->tag_associativity;
if (!parameters->fully_assoc)
{
printf(" decode_data (ns): %g\n",result->decoder_delay_data/1e-9);
printf(" dyn. energy (nJ): %g\n",result->decoder_power_data.readOp.dynamic*1e9);
printf(" leak. power (mW): %g\n",result->decoder_power_data.readOp.leakage*1e3);
}
else
{
printf(" tag_comparison (ns): %g\n",result->decoder_delay_data/1e-9);
printf(" dyn. energy (nJ): %g\n",result->decoder_power_data.readOp.dynamic*1e9);
printf(" leak. power (mW): %g\n",result->decoder_power_data.readOp.leakage*1e3);
}
printf(" wordline and bitline data (ns): %g\n",(result->wordline_delay_data+result->bitline_delay_data)/1e-9);
printf(" dyn. wordline energy (nJ): %g\n",(result->wordline_power_data.readOp.dynamic)*1e9);
printf(" leak. wordline power (mW): %g\n",(result->wordline_power_data.readOp.leakage)*1e3);
printf(" dyn. read data bitline energy (nJ): %g\n",(result->bitline_power_data.readOp.dynamic)*1e9);
printf(" dyn. write data bitline energy (nJ): %g\n",(result->bitline_power_data.writeOp.dynamic)*1e9);
printf(" leak. data bitline power (mW): %g\n",(result->bitline_power_data.writeOp.leakage)*1e3);
printf(" sense_amp_data (ns): %g\n",result->sense_amp_delay_data/1e-9);
printf(" dyn. energy (nJ): %g\n",result->sense_amp_power_data.readOp.dynamic*1e9);
printf(" leak. power (mW): %g\n",result->sense_amp_power_data.readOp.leakage*1e3);
if (!parameters->fully_assoc)
{
printf(" decode_tag (ns): %g\n",result->decoder_delay_tag/1e-9);
printf(" dyn. energy (nJ): %g\n",result->decoder_power_tag.readOp.dynamic*1e9);
printf(" leak. power (mW): %g\n",result->decoder_power_tag.readOp.leakage*1e3);
printf(" wordline and bitline tag (ns): %g\n",(result->wordline_delay_tag+result->bitline_delay_tag)/1e-9);
printf(" dyn. wordline energy (nJ): %g\n",(result->wordline_power_tag.readOp.dynamic)*1e9);
printf(" leak. wordline power (mW): %g\n",(result->wordline_power_tag.readOp.leakage)*1e3);
printf(" dyn. read data bitline energy (nJ): %g\n",(result->bitline_power_tag.readOp.dynamic)*1e9);
printf(" dyn. write data bitline energy (nJ): %g\n",(result->bitline_power_tag.writeOp.dynamic)*1e9);
printf(" leak. data bitline power (mW): %g\n",(result->bitline_power_tag.writeOp.leakage)*1e3);
printf(" sense_amp_tag (ns): %g\n",result->sense_amp_delay_tag/1e-9);
printf(" dyn. read energy (nJ): %g\n",result->sense_amp_power_tag.readOp.dynamic*1e9);
printf(" leak. read power (mW): %g\n",result->sense_amp_power_tag.readOp.leakage*1e3);
printf(" compare (ns): %g\n",result->compare_part_delay/1e-9);
printf(" dyn. read energy (nJ): %g\n",result->compare_part_power.readOp.dynamic*1e9);
printf(" leak. read power (mW): %g\n",result->compare_part_power.readOp.leakage*1e3);
if (A == 1)
{
printf(" valid signal driver (ns): %g\n",result->drive_valid_delay/1e-9);
printf(" dyn. read energy (nJ): %g\n",result->drive_valid_power.readOp.dynamic*1e9);
printf(" leak. read power (mW): %g\n",result->drive_valid_power.readOp.leakage*1e3);
}
else {
printf(" mux driver (ns): %g\n",result->drive_mux_delay/1e-9);
printf(" dyn. read energy (nJ): %g\n",result->drive_mux_power.readOp.dynamic*1e9);
printf(" leak. read power (mW): %g\n",result->drive_mux_power.readOp.leakage*1e3);
printf(" sel inverter (ns): %g\n",result->selb_delay/1e-9);
printf(" dyn. read energy (nJ): %g\n",result->selb_power.readOp.dynamic*1e9);
printf(" leak. read power (mW): %g\n",result->selb_power.readOp.leakage*1e3);
}
}
printf(" data output driver (ns): %g\n",result->data_output_delay/1e-9);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -