00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef _SIM_POWER_PERMU_H
00035 #define _SIM_POWER_PERMU_H
00036
00037 #include "SIM_parameter.h"
00038
00039 #define FIRST_STG 0x01
00040 #define SECOND_STG 0x02
00041 #define THIRD_STG 0x04
00042 #define FOURTH_STG 0x08
00043 #define ALL_PASS 0x0F
00044 #define is_omega(x) (!(x))
00045 #define is_flip(x) (x)
00046
00047 typedef struct {
00048 u_int data_width;
00049 LIB_Type_max_uint n_chg_in;
00050 LIB_Type_max_uint n_chg_out;
00051 LIB_Type_max_uint n_chg_stg;
00052 LIB_Type_max_uint n_chg_int;
00053 LIB_Type_max_uint n_chg_pass;
00054 LIB_Type_max_uint n_chg_ctr;
00055 double e_chg_in;
00056 double e_chg_out;
00057 double e_chg_stg;
00058 double e_chg_int;
00059 double e_chg_pass;
00060 double e_chg_ctr;
00061
00062 LIB_Type_max_uint in;
00063 LIB_Type_max_uint out;
00064 LIB_Type_max_uint stg[3];
00065 LIB_Type_max_uint inn[4];
00066 uint pass;
00067 LIB_Type_max_uint ctr[4];
00068
00069 LIB_Type_max_uint data_mask;
00070 LIB_Type_max_uint ctr_mask;
00071 } SIM_omflip_t;
00072
00073 #define ZBIT 1
00074 #define WBIT 0
00075 #define N_ONEHOT (32 + 16 + 8 + 4 + 2 + 1)
00076
00077
00078 typedef struct {
00079 u_int data_width;
00080 LIB_Type_max_uint n_chg_in;
00081 LIB_Type_max_uint n_chg_zin[6];
00082 LIB_Type_max_uint n_chg_lin[6];
00083 LIB_Type_max_uint n_chg_rin[6];
00084 LIB_Type_max_uint n_chg_oin;
00085 LIB_Type_max_uint n_chg_out;
00086 double e_chg_in;
00087 double e_chg_zin[6];
00088 double e_chg_lin[6];
00089 double e_chg_rin[6];
00090 double e_chg_oin;
00091 double e_chg_out;
00092
00093 LIB_Type_max_uint in;
00094 LIB_Type_max_uint zin[6];
00095 LIB_Type_max_uint win[6];
00096
00097 u_int lin[N_ONEHOT];
00098 u_int rin[N_ONEHOT];
00099 LIB_Type_max_uint zoin;
00100 LIB_Type_max_uint woin;
00101 LIB_Type_max_uint out;
00102
00103 u_int n_stg;
00104 LIB_Type_max_uint mask;
00105 } SIM_grp_t;
00106
00107 typedef struct {
00108 int model;
00109 union {
00110 SIM_omflip_t omflip;
00111 SIM_grp_t grp;
00112 } u;
00113 } SIM_permu_t;
00114
00115
00116 extern int SIM_permu_init(SIM_permu_t *permu, int model, u_int data_width);
00117 extern int SIM_permu_record(SIM_permu_t *permu, LIB_Type_max_uint in, u_int mode, LIB_Type_max_uint op, int reset);
00118 extern LIB_Type_max_uint SIM_permu_record_test(SIM_permu_t *permu, LIB_Type_max_uint in, u_int mode, LIB_Type_max_uint op);
00119 extern double SIM_permu_report(SIM_permu_t *permu);
00120 extern double SIM_permu_max_energy(SIM_permu_t *permu);
00121
00122 #endif