• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

sst/core/techModels/libsim-panalyzer/libpa_lv1/panalyzer.h

00001 /*
00002 * panalyzer.c - basic power analyzer data types, strcutres and 
00003 * thier manipulation functions. 
00004 *
00005 * This file is a part of the PowerAnalyzer tool suite written by
00006 * Nam Sung Kim as a part of the PowerAnalyzer Project.
00007 *  
00008 * The tool suite is currently maintained by Nam Sung Kim.
00009 * 
00010 * Copyright (C) 2001 by Nam Sung Kim
00011 *
00012 * This source file is distributed "as is" in the hope that it will be
00013 * useful.  The tool set comes with no warranty, and no author or
00014 * distributor accepts any responsibility for the consequences of its
00015 * use. 
00016 * 
00017 * Everyone is granted permission to copy, modify and redistribute
00018 * this tool set under the following conditions:
00019 * 
00020 *    This source code is distributed for non-commercial use only. 
00021 *    Please contact the maintainer for restrictions applying to 
00022 *    commercial use.
00023 *
00024 *    Permission is granted to anyone to make or distribute copies
00025 *    of this source code, either as received or modified, in any
00026 *    medium, provided that all copyright notices, permission and
00027 *    nonwarranty notices are preserved, and that the distributor
00028 *    grants the recipient permission for further redistribution as
00029 *    permitted by this document.
00030 *
00031 *    Permission is granted to distribute this file in compiled
00032 *    or executable form under the same conditions that apply for
00033 *    source code, provided that either:
00034 *
00035 *    A. it is accompanied by the corresponding machine-readable
00036 *       source code,
00037 *    B. it is accompanied by a written offer, with no time limit,
00038 *       to give anyone a machine-readable copy of the corresponding
00039 *       source code in return for reimbursement of the cost of
00040 *       distribution.  This written offer must permit verbatim
00041 *       duplication by anyone, or
00042 *    C. it is distributed by someone who received only the
00043 *       executable form, and is accompanied by a copy of the
00044 *       written offer of source code that they received concurrently.
00045 *
00046 * In other words, you are welcome to use, share and improve this
00047 * source file.  You are forbidden to forbid anyone else to use, share
00048 * and improve what you give them.
00049 */
00050 
00051 #ifndef PANALYZER_H
00052 #define PANALYZER_H
00053 
00054 #include "../host.h"
00055 #include "../memory.h"
00056 
00057 /* power monitoring windows */
00058 #define MaxPMWindows 512
00059 /* activity factor */
00060 #define afactor 0.2
00061 
00062 /* simplescalar data type alias and interfaces */
00063 typedef enum mem_cmd fu_mcommand_t;
00064 typedef md_addr_t fu_address_t;
00065 typedef byte_t buffer_t; 
00066 
00067 /* custom data types */
00068 /* fu: funtional unit */
00069 /* power model mode type */
00070 typedef enum _fu_pmodel_mode_t {
00071         Analytical,
00072         Empirical
00073 } fu_pmodel_mode_t;
00074 
00075 /* dimension type */
00076 typedef struct _fu_dimension_t{
00077         double height;
00078         double width;
00079         double area;
00080 } fu_dimension_t;
00081 
00082 /* effective capacitances type for power dissipation components */
00083 typedef struct _fu_Ceffs_t {
00084         double sCeff;           /* external switching effective capacitance */
00085         double iCeff;           /* internal switching effective capacitance */
00086         double lCeff;           /* leakage effective capacitance */
00087         double cnodeCeff;       /* clocked node capacitance */
00088 } fu_Ceffs_t;
00089 
00090 /* power dissipation type */
00091 typedef struct _fu_pdissipation_t {
00092         double switching;       /* switching power dissipation */
00093         double internal;        /* internal switching power dissipation */
00094         double leakage;         /* leakage power dissipation */
00095         double pdissipation;/* switching + internal + leakage */
00096         double peak;            /* peak power dissipation */
00097 } fu_pdissipation_t;
00098 
00099 /* create/converte to buffer_t type data structure for various data types.
00100  * return an allocated location pointer.
00101  * caution: please deallocate the memory space  */
00102 buffer_t *
00103 create_buffer_t(
00104         void *val,      /* target conversion value */
00105         int bsize       /* conversion value data type size in bytes */);
00106 
00107 /* copy buffer_t type data structure */
00108 void
00109 copy_buffer_t(
00110         buffer_t *ibus, /* the source bus */ 
00111         buffer_t *jbus, /* the destination bus */
00112         unsigned bsize /* size of the bus in bytes */);
00113 
00114 /* return number of switching for the give previous bus and the current bus */
00115 unsigned
00116 obtain_nswitchings(
00117         buffer_t *ibus, /* the current bus */ 
00118         buffer_t *jbus, /* the previous bus */
00119         unsigned bsize /* size of the bus in bytes */);
00120 
00121 /* obtain in switching power from fu_pdissipation_t data structure */
00122 double
00123 obtain_switching(
00124         unsigned pmwindex, /* power monitoring access index */
00125         fu_pdissipation_t *pmwindow /* power monitoring window */);
00126 
00127 /* obtain internal power from fu_pdissipation_t data structure */
00128 double
00129 obtain_internal(
00130         unsigned pmwindex, /* power monitoring access index */
00131         fu_pdissipation_t *pmwindow /* power monitoring window */);
00132 
00133 /* obtain leakage power from fu_pdissipation_t data structure */
00134 double
00135 obtain_leakage(
00136         unsigned pmwindex, /* power monitoring access index */
00137         fu_pdissipation_t *pmwindow);
00138         /* power monitoring window */
00139 
00140 /* initialize pdissipation stat */
00141 void 
00142 initialize_fu_pdissipation(
00143         fu_pdissipation_t *pdissipation /* pdissipation stat ptr */);
00144 
00145 /* initialize pmwindow */
00146 void 
00147 initialize_fu_pmwindow(
00148         unsigned pmwindex, /* fu power monitoring window index */
00149         fu_pdissipation_t *pmwindow /* fu power monitoring window */);
00150 
00151 /* integrate the current power dissipation of fu from power monitoring windows 
00152  * to pdissipation stat db. */ 
00153 double 
00154 integrate_fu_pdissipation(
00155         unsigned pmwindex,      /* fu power monitoring window index */
00156         fu_pdissipation_t *pmwindow,    /* fu power monitoring window */
00157         fu_pdissipation_t *pdissipation /* fu power dissipation statistics */);
00158 
00159 /* summate x/y switching + internal + leakage pdissipation of the current cycle.
00160  * return the summated pdissipation */
00161 double 
00162 summate_fu_pdissipation(
00163         unsigned pmwindex,      /* fu power monitoring window index */
00164         fu_pdissipation_t *pmwindow     /* fu power monitoring window */);
00165 
00166 /* return pdissipation 
00167  * caution: this function must incorporate with ntransitions */
00168 double 
00169 estimate_pdissipation(
00170         double Ceff, /* effective capacitance */
00171         double opfreq, /* operating frequency */
00172         double svolt /* supply voltage */);
00173 
00174 /* assign effective capacitance values to fu_Ceffs_t data structure */
00175 fu_Ceffs_t
00176 assign_fu_Ceffs(
00177         double sCeff,
00178         double iCeff,
00179         double lCeff,
00180         double cnodeCeff);
00181 
00182 /* power analyzer stats register */
00183 void
00184 panalyzer_reg_stats(
00185         char *name, /* fu name */
00186         fu_pdissipation_t *pdissipation, /* fu pdissipation  statistics db ptr */
00187          struct stat_sdb_t *sdb /* stats db ptr */);
00188 #endif

Generated on Fri Oct 22 2010 11:02:20 for SST by  doxygen 1.7.1