/* stats.h -- Header file for stats.c
|
/* stats.h -- Header file for stats.c
|
Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
|
Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
|
|
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
|
|
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
(at your option) any later version.
|
(at your option) any later version.
|
|
|
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
GNU General Public License for more details.
|
GNU General Public License for more details.
|
|
|
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
|
#define DSTATS_LEN 3000
|
#define DSTATS_LEN 3000
|
#define SSTATS_LEN 300
|
#define SSTATS_LEN 300
|
#define FSTATS_LEN 200
|
#define FSTATS_LEN 200
|
#define RAW_RANGE 13
|
#define RAW_RANGE 13
|
|
|
/* Used by safe division - increment divisor by one if it is zero */
|
/* Used by safe division - increment divisor by one if it is zero */
|
#define SD(X) (X != 0 ? X : 1)
|
#define SD(X) (X != 0 ? X : 1)
|
|
|
struct dstats_entry {
|
struct dstats_entry {
|
char insn1[OPERANDNAME_LEN];
|
char insn1[OPERANDNAME_LEN];
|
char insn2[OPERANDNAME_LEN];
|
char insn2[OPERANDNAME_LEN];
|
int cnt_dynamic;
|
int cnt_dynamic;
|
int depend;
|
int depend;
|
};
|
};
|
|
|
struct sstats_entry {
|
struct sstats_entry {
|
char insn[OPERANDNAME_LEN];
|
char insn[OPERANDNAME_LEN];
|
int cnt_static;
|
int cnt_static;
|
int cnt_dynamic;
|
int cnt_dynamic;
|
}; /* single stats */
|
}; /* single stats */
|
|
|
struct fstats_entry {
|
struct fstats_entry {
|
enum insn_type insn1;
|
enum insn_type insn1;
|
enum insn_type insn2;
|
enum insn_type insn2;
|
int cnt_dynamic;
|
int cnt_dynamic;
|
int depend;
|
int depend;
|
}; /* functional units stats */
|
}; /* functional units stats */
|
|
|
struct branchstat {
|
struct branchstat {
|
int taken;
|
int taken;
|
int nottaken;
|
int nottaken;
|
int forward;
|
int forward;
|
int backward;
|
int backward;
|
};
|
};
|
|
|
struct staticbp_stat {
|
struct staticbp_stat {
|
int correct;
|
int correct;
|
int all;
|
int all;
|
};
|
};
|
|
|
struct bpbstat {
|
struct bpbstat {
|
int hit;
|
int hit;
|
int miss;
|
int miss;
|
int correct;
|
int correct;
|
int incorrect;
|
int incorrect;
|
};
|
};
|
|
|
struct bticstat {
|
struct bticstat {
|
int hit;
|
int hit;
|
int miss;
|
int miss;
|
};
|
};
|
|
|
struct mstats_entry {
|
struct mstats_entry {
|
int byteadd;
|
int byteadd;
|
struct branchstat beqz;
|
struct branchstat beqz;
|
struct branchstat bnez;
|
struct branchstat bnez;
|
struct staticbp_stat sbp_bf;
|
struct staticbp_stat sbp_bf;
|
struct staticbp_stat sbp_bnf;
|
struct staticbp_stat sbp_bnf;
|
struct bpbstat bpb;
|
struct bpbstat bpb;
|
struct bticstat btic;
|
struct bticstat btic;
|
}; /* misc units stats */
|
}; /* misc units stats */
|
|
|
struct cachestats_entry {
|
struct cachestats_entry {
|
int readhit;
|
int readhit;
|
int readmiss;
|
int readmiss;
|
int writehit;
|
int writehit;
|
int writemiss;
|
int writemiss;
|
}; /* cache stats */
|
}; /* cache stats */
|
|
|
struct raw_stats {
|
struct raw_stats {
|
int reg[64];
|
int reg[64];
|
int range[RAW_RANGE];
|
int range[RAW_RANGE];
|
}; /* RAW hazard stats */
|
}; /* RAW hazard stats */
|
|
|
|
#define SLP_MEMREAD 0
|
|
#define SLP_MEMWRITE 1
|
|
struct slp_stats {
|
|
int maxdepth;
|
|
int curdepth;
|
|
int calls;
|
|
int supercalls;
|
|
int supercnt;
|
|
struct memaccess {
|
|
struct memaccess *next;
|
|
unsigned long addr;
|
|
char type; /* bit 0: read; bit 1: write */
|
|
};
|
|
}; /* SLP */
|
|
|
extern struct mstats_entry mstats;
|
extern struct mstats_entry mstats;
|
extern struct sstats_entry sstats[SSTATS_LEN];
|
extern struct sstats_entry sstats[SSTATS_LEN];
|
extern struct dstats_entry dstats[DSTATS_LEN];
|
extern struct dstats_entry dstats[DSTATS_LEN];
|
extern struct fstats_entry fstats[FSTATS_LEN];
|
extern struct fstats_entry fstats[FSTATS_LEN];
|
extern struct cachestats_entry ic_stats;
|
extern struct cachestats_entry ic_stats;
|
extern struct cachestats_entry dc_stats;
|
extern struct cachestats_entry dc_stats;
|
extern struct raw_stats raw_stats;
|
extern struct raw_stats raw_stats;
|
|
extern struct slp_stats slp_stats;
|
|
|
extern int check_depend();
|
extern int check_depend();
|
extern void addsstats(char *item, int cnt_dynamic, int cnt_static);
|
extern void addsstats(char *item, int cnt_dynamic, int cnt_static);
|
extern void adddstats(char *item1, char *item2, int cnt_dynamic, int depend);
|
extern void adddstats(char *item1, char *item2, int cnt_dynamic, int depend);
|
extern void addfstats(enum insn_type item1, enum insn_type item2, int cnt_dynamic, int depend);
|
extern void addfstats(enum insn_type item1, enum insn_type item2, int cnt_dynamic, int depend);
|
extern void initstats();
|
extern void initstats();
|
extern void printstats();
|
extern void printstats();
|
|
|