static void insn_check_options(void) { /* Start this guy */ insn_progress = insn_progress_update; if (!mystricmp(insn_dumpfile, "none")) fdump = NULL; else fdump = fopen(insn_dumpfile, "w+"); insn_sample[sample_ON] = insn_sample[sample_OFF] = insn_sample[sample_WARM] = 0; if (mystricmp(insn_sample_str, "no")) { if (sscanf(insn_sample_str, "%llu:%llu:%llu", &insn_sample[sample_OFF], &insn_sample[sample_WARM], &insn_sample[sample_ON]) != 3) fatal("unrecognized sampling format '%s'", insn_sample); } insn_sample_first[sample_ON] = insn_sample_first[sample_OFF] = insn_sample_first[sample_WARM] = 0; if (mystricmp(insn_sample_first_str, "no")) { if (sscanf(insn_sample_first_str, "%llu:%llu:%llu", &insn_sample_first[sample_OFF], &insn_sample_first[sample_WARM], &insn_sample_first[sample_ON]) != 3) fatal("unrecognized sampling format '%s'", insn_sample_first); } }
/****************************************************************** Shows a given mail (part) *******************************************************************/ static void show_mail(struct Read_Data *data, struct mail *m) { char *buf; int buf_len; mail_decode(m); mail_decoded_data(m,(void**)&buf,&buf_len); if (!mystricmp(m->content_type,"text") && !mystricmp(m->content_subtype,"plain")) { char *html_mail; html_mail = text2html(buf, buf_len,TEXT2HTML_ENDBODY_TAG|TEXT2HTML_FIXED_FONT/*|(user.config.read_wordwrap?0:TEXT2HTML_NOWRAP)*/,"");//<FONT FACE=\"fixedmail\" SIZE=\"+1\">"); if (html_mail) { #if 0 GtkTextBuffer *buffer; GtkTextIter iter; buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(data->text_view)); gtk_text_buffer_get_iter_at_line(buffer,&iter,0); gtk_text_buffer_insert(buffer,&iter,m->html_header,strlen(m->html_header)); gtk_text_buffer_insert(buffer,&iter,html_mail,strlen(html_mail)); #else html_document_clear(data->html_document); if (html_document_open_stream(data->html_document, "text/html")) { if (m->html_header) html_document_write_stream(data->html_document, m->html_header, strlen(m->html_header)-14 /* FIXME: hacky, remove </BODY></HTML>*/); html_document_write_stream(data->html_document, html_mail, strlen(html_mail)); html_document_close_stream(data->html_document); } //printf("%s%s\n",m->html_header,html_mail); #endif } } else { #if 0 GtkTextBuffer *buffer; GtkTextIter iter; buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(data->text_view)); gtk_text_buffer_get_iter_at_line(buffer,&iter,0); gtk_text_buffer_insert(buffer,&iter,m->html_header,strlen(m->html_header)); gtk_text_buffer_insert(buffer,&iter,html_mail,strlen(html_mail)); gtk_text_buffer_insert(buffer,&iter,buf,buf_len); #endif } #if 0 if (!data->attachments_group) { mail_decode(m); insert_text(data, m); } else { DoMethod(data->attachments_group, MUIM_SetUDataOnce, m, MUIA_Selected, 1); } #endif }
void CR_putcontents(FILE* out, Set4Node* s4list) { int i; int j; int flag; struct tm *t; time_t now; char day[7][5] = {"SUN","MON","TUE","WED","THU","FRI","SAT"}; char* chtmp = NULL; Set4Node* s4tmp = NULL; now=time(NULL); t=localtime(&now); fprintf(out, "<body>\n\n"); // time fprintf(out, "Time : %d.%d.%d [%s] %d:%d \n\n <br><br>\n", t->tm_year+1990, t->tm_mon+1, t->tm_mday, day[t->tm_wday], t->tm_hour, t->tm_min); for(i=0; i<rear_word; i++){ // wordlist[i] flag = 0; s4tmp = s4list; while( s4tmp->next != NULL){ if( mystricmp(wordlist[i], s4tmp->keyword) == 0){ flag=1; } s4tmp = s4tmp->next; } if(flag){ fprintf(out, "<h1>[ %s ]</h1><hr>\n", wordlist[i]); s4tmp = s4list; while( s4tmp->next != NULL){ if( mystricmp(s4tmp->keyword, wordlist[i]) == 0 ){ fprintf(out, "<b>%s :: [ <a href=\"%s\">Link</a> ]</b><br>\n", s4tmp->title, s4tmp->url); // shortening content text if( strlen(s4tmp->contents) > 100 ){ fwrite(s4tmp->contents, sizeof(char), 100, out); } else { fprintf(out, "%s", (s4tmp->contents)?s4tmp->contents:"No Text"); } fprintf(out, "<br><br>\n"); } s4tmp = s4tmp->next; } } } fprintf(out, "\n\n</body>\n"); }
/* _qsort_btoc_helper: * qsort helper. BTOC elements are sorted through the name value. */ static int _qsort_btoc_helper(const void *e1, const void *e2) { BTOC *s1 = (BTOC *)e1; BTOC *s2 = (BTOC *)e2; return mystricmp(s1->name, s2->name); }
/* scmp: */ int scmp(const void *e1, const void *e2) { char *s1 = *((char **)e1); char *s2 = *((char **)e2); return mystricmp(s1, s2); }
/* check simulator-specific option values */ void sim_check_options(void) /* command line arguments */ { /* use a level 1 D-cache? */ if (mystricmp(cache_dl1_opt.opt, "none")) { cache_check_options(&cache_dl1_opt); cache_dl1 = cache_create(&cache_dl1_opt); } /* use a level 1 I-cache? */ if (mystricmp(cache_il1_opt.opt, "none")) { if (!mystricmp(cache_il1_opt.opt, "dl1")) { if (!cache_dl1) fatal("L1 I-cache cannot access L1 D-cache as it's undefined"); cache_il1 = cache_dl1; } else /* il1 is defined */ { cache_check_options(&cache_il1_opt); cache_il1 = cache_create(&cache_il1_opt); } } if (mystricmp(cache_l2_opt.opt, "none")) { if (!cache_dl1 && !cache_il1) fatal("can't have an L2 D-cache without an L1 D-cache or I-cache!"); cache_check_options(&cache_l2_opt); cache_l2 = cache_create(&cache_l2_opt); } /* use a D-TLB? */ if (mystricmp(dtlb_opt.opt, "none")) { cache_check_options(&dtlb_opt); dtlb = cache_create(&dtlb_opt); } /* use an I-TLB? */ if (mystricmp(itlb_opt.opt, "none")) { if (!mystricmp(itlb_opt.opt, "dtlb")) { if (!dtlb) fatal("I-TLB cannot use D-TLB as it is undefined"); itlb = dtlb; } else { cache_check_options(&itlb_opt); itlb = cache_create(&itlb_opt); } } }
/****************************************************************** inserts the mime informations (uses ugly recursion) *******************************************************************/ static void insert_mail(struct Read_Data *data, struct mail *mail) { int i; if (mail->num_multiparts == 0) { g_slist_append(data->mail_list,mail); #if 0 Object *group, *icon, *context_menu; context_menu = data->attachment_standard_menu; if (!mystricmp(mail->content_subtype,"html")) context_menu = data->attachment_html_menu; group = VGroup, Child, icon = IconObject, MUIA_InputMode, MUIV_InputMode_Immediate, MUIA_Icon_MimeType, mail->content_type, MUIA_Icon_MimeSubType, mail->content_subtype, MUIA_UserData, mail, MUIA_ContextMenu, context_menu, End, Child, TextObject, MUIA_Font, MUIV_Font_Tiny, MUIA_Text_Contents, mail->filename, MUIA_Text_PreParse, "\33c", End, End; if (icon) { DoMethod(data->attachments_group, OM_ADDMEMBER, group); DoMethod(icon, MUIM_Notify, MUIA_ContextMenuTrigger, MUIV_EveryTime, App, 6, MUIM_CallHook, &hook_standard, context_menu_trigger, data, mail, MUIV_TriggerValue); } DoMethod(icon, MUIM_Notify, MUIA_Selected, TRUE, App, 5, MUIM_CallHook, &hook_standard, icon_selected, data, icon); #endif } for (i=0;i<mail->num_multiparts;i++) { insert_mail(data,mail->multipart_array[i]); } }
static int lookupelem( char* name ) { int i; for (i=0; i<nelems && mystricmp(name, elems[i].name); i++ ); return i<nelems ? i : nelems-1; }
/* check simulator-specific option values */ void sim_check_options(struct opt_odb_t *odb, /* options database */ int argc, char **argv) /* command line arguments */ { char name[128], c; int nsets, bsize, assoc; int prefetch_type; /* this specifies the type of the prefetcher */ /* use a level 1 D-cache? */ if (!mystricmp(cache_dl1_opt, "none")) { cache_dl1 = NULL; /* the level 2 D-cache cannot be defined */ if (strcmp(cache_dl2_opt, "none")) fatal("the l1 data cache must defined if the l2 cache is defined"); cache_dl2 = NULL; } else /* dl1 is defined */ { if (sscanf(cache_dl1_opt, "%[^:]:%d:%d:%d:%c:%d", name, &nsets, &bsize, &assoc, &c, &prefetch_type) != 6) fatal("bad l1 D-cache parms: <name>:<nsets>:<bsize>:<assoc>:<repl>:<pref>"); cache_dl1 = cache_create(name, nsets, bsize, /* balloc */FALSE, /* usize */0, assoc, cache_char2policy(c), dl1_access_fn, /* hit latency */1, prefetch_type); /* is the level 2 D-cache defined? */ if (!mystricmp(cache_dl2_opt, "none")) cache_dl2 = NULL; else { if (sscanf(cache_dl2_opt, "%[^:]:%d:%d:%d:%c:%d", name, &nsets, &bsize, &assoc, &c, &prefetch_type) != 6) fatal("bad l2 D-cache parms: " "<name>:<nsets>:<bsize>:<assoc>:<repl>:<pref>"); cache_dl2 = cache_create(name, nsets, bsize, /* balloc */FALSE, /* usize */0, assoc, cache_char2policy(c), dl2_access_fn, /* hit latency */1, prefetch_type); } } /* use a level 1 I-cache? */ if (!mystricmp(cache_il1_opt, "none")) { cache_il1 = NULL; /* the level 2 I-cache cannot be defined */ if (strcmp(cache_il2_opt, "none")) fatal("the l1 inst cache must defined if the l2 cache is defined"); cache_il2 = NULL; } else if (!mystricmp(cache_il1_opt, "dl1")) { if (!cache_dl1) fatal("I-cache l1 cannot access D-cache l1 as it's undefined"); cache_il1 = cache_dl1; /* the level 2 I-cache cannot be defined */ if (strcmp(cache_il2_opt, "none")) fatal("the l1 inst cache must defined if the l2 cache is defined"); cache_il2 = NULL; } else if (!mystricmp(cache_il1_opt, "dl2")) { if (!cache_dl2) fatal("I-cache l1 cannot access D-cache l2 as it's undefined"); cache_il1 = cache_dl2; /* the level 2 I-cache cannot be defined */ if (strcmp(cache_il2_opt, "none")) fatal("the l1 inst cache must defined if the l2 cache is defined"); cache_il2 = NULL; } else /* il1 is defined */ { if (sscanf(cache_il1_opt, "%[^:]:%d:%d:%d:%c:%d", name, &nsets, &bsize, &assoc, &c,&prefetch_type) != 6) fatal("bad l1 I-cache parms: <name>:<nsets>:<bsize>:<assoc>:<repl>:<pref>"); cache_il1 = cache_create(name, nsets, bsize, /* balloc */FALSE, /* usize */0, assoc, cache_char2policy(c), il1_access_fn, /* hit latency */1, prefetch_type); /* is the level 2 D-cache defined? */ if (!mystricmp(cache_il2_opt, "none")) cache_il2 = NULL; else if (!mystricmp(cache_il2_opt, "dl2")) { if (!cache_dl2) fatal("I-cache l2 cannot access D-cache l2 as it's undefined"); cache_il2 = cache_dl2; } else { if (sscanf(cache_il2_opt, "%[^:]:%d:%d:%d:%c:%d", name, &nsets, &bsize, &assoc, &c, &prefetch_type) != 6) fatal("bad l2 I-cache parms: " "<name>:<nsets>:<bsize>:<assoc>:<repl>:<pref>"); cache_il2 = cache_create(name, nsets, bsize, /* balloc */FALSE, /* usize */0, assoc, cache_char2policy(c), il2_access_fn, /* hit latency */1, prefetch_type); } } /* use an I-TLB? */ if (!mystricmp(itlb_opt, "none")) itlb = NULL; else { if (sscanf(itlb_opt, "%[^:]:%d:%d:%d:%c:%d", name, &nsets, &bsize, &assoc, &c, &prefetch_type) != 6) fatal("bad TLB parms: <name>:<nsets>:<page_size>:<assoc>:<repl>:<pref>"); itlb = cache_create(name, nsets, bsize, /* balloc */FALSE, /* usize */sizeof(md_addr_t), assoc, cache_char2policy(c), itlb_access_fn, /* hit latency */1, prefetch_type); } /* use a D-TLB? */ if (!mystricmp(dtlb_opt, "none")) dtlb = NULL; else { if (sscanf(dtlb_opt, "%[^:]:%d:%d:%d:%c:%d", name, &nsets, &bsize, &assoc, &c, &prefetch_type) != 6) fatal("bad TLB parms: <name>:<nsets>:<page_size>:<assoc>:<repl>:<pref>"); dtlb = cache_create(name, nsets, bsize, /* balloc */FALSE, /* usize */sizeof(md_addr_t), assoc, cache_char2policy(c), dtlb_access_fn, /* hit latency */1, prefetch_type); } }
/* check simulator-specific option values */ void sim_check_options(struct opt_odb_t *odb, int argc, char **argv) { if (!mystricmp(pred_type, "taken")) { pred = bpred_create_taken(); } else if (!mystricmp(pred_type, "nottaken")) { pred = bpred_create_not_taken(); } else if (!mystricmp(pred_type, "smartstatic")) { pred = bpred_create_smart_static(); } else if (!mystricmp(pred_type, "bimod")) { if (bimod_nelt != 2) fatal("bad bimod predictor config (<num bits> <table_size>)"); if (btb_nelt != 2) fatal("bad btb config (<num_sets> <associativity>)"); /* bimodal predictor, bpred_create() checks BTB_SIZE */ pred = bpred_create_nbit( bimod_config[0], // num saturating counter bits bimod_config[1], // bimod table size btb_config[0], // btb sets btb_config[1], // btb assoc ras_size); // ret-addr stack size } else if (!mystricmp(pred_type, "2lev")) { /* 2-level adaptive predictor, bpred_create() checks args */ if (twolev_nelt != 5) fatal("bad 2-level pred config (<num bits> <l1size> <l2size> <hist_size> <xor>)"); if (btb_nelt != 2) fatal("bad btb config (<num_sets> <associativity>)"); pred = bpred_create_2level( twolev_config[0], // num bits twolev_config[1], // l1 size twolev_config[2], // l2 size twolev_config[3], // history register size twolev_config[4], // history xor address btb_config[0], // btb sets btb_config[1], // btb assoc ras_size); // ret-addr stack size } else if (!mystricmp(pred_type, "comb")) { /* combining predictor, bpred_create() checks args */ if (twolev_nelt != 5) fatal("bad 2-level pred config (<num bits> <l1size> <l2size> <hist_size> <xor>)"); if (bimod_nelt != 2) fatal("bad bimod predictor config (<num bits> <table_size>)"); if (comb_nelt != 1) fatal("bad combining predictor config (<meta_table_size>)"); if (btb_nelt != 2) fatal("bad btb config (<num_sets> <associativity>)"); pred = bpred_create_comb( bimod_config[1], // bimod table size twolev_config[1], // l1 size twolev_config[2], // l2 size comb_config[0], // meta table size twolev_config[3], // history register size twolev_config[4], // history xor size btb_config[0], // btb sets btb_config[1], // btb assoc ras_size); // ret-addr stack size } else { fatal("cannot parse predictor type `%s'", pred_type); } }
/* check simulator-specific option values */ void sim_check_options(struct opt_odb_t *odb, int argc, char **argv) { if (!mystricmp(pred_type, "taken")) { /* static predictor, not taken */ pred = bpred_create(BPredTaken, 0, 0, 0, 0, 0, 0, 0, 0, 0); } else if (!mystricmp(pred_type, "nottaken")) { /* static predictor, taken */ pred = bpred_create(BPredNotTaken, 0, 0, 0, 0, 0, 0, 0, 0, 0); } else if (!mystricmp(pred_type, "bimod")) { if (bimod_nelt != 1) fatal("bad bimod predictor config (<table_size>)"); if (btb_nelt != 2) fatal("bad btb config (<num_sets> <associativity>)"); /* bimodal predictor, bpred_create() checks BTB_SIZE */ pred = bpred_create(BPred2bit, /* bimod table size */bimod_config[0], /* 2lev l1 size */0, /* 2lev l2 size */0, /* meta table size */0, /* history reg size */0, /* history xor address */0, /* btb sets */btb_config[0], /* btb assoc */btb_config[1], /* ret-addr stack size */ras_size); } else if (!mystricmp(pred_type, "2lev")) { /* 2-level adaptive predictor, bpred_create() checks args */ if (twolev_nelt != 4) fatal("bad 2-level pred config (<l1size> <l2size> <hist_size> <xor>)"); if (btb_nelt != 2) fatal("bad btb config (<num_sets> <associativity>)"); pred = bpred_create(BPred2Level, /* bimod table size */0, /* 2lev l1 size */twolev_config[0], /* 2lev l2 size */twolev_config[1], /* meta table size */0, /* history reg size */twolev_config[2], /* history xor address */twolev_config[3], /* btb sets */btb_config[0], /* btb assoc */btb_config[1], /* ret-addr stack size */ras_size); } else if (!mystricmp(pred_type, "comb")) { /* combining predictor, bpred_create() checks args */ if (twolev_nelt != 4) fatal("bad 2-level pred config (<l1size> <l2size> <hist_size> <xor>)"); if (bimod_nelt != 1) fatal("bad bimod predictor config (<table_size>)"); if (comb_nelt != 1) fatal("bad combining predictor config (<meta_table_size>)"); if (btb_nelt != 2) fatal("bad btb config (<num_sets> <associativity>)"); pred = bpred_create(BPredComb, /* bimod table size */bimod_config[0], /* l1 size */twolev_config[0], /* l2 size */twolev_config[1], /* meta table size */comb_config[0], /* history reg size */twolev_config[2], /* history xor address */twolev_config[3], /* btb sets */btb_config[0], /* btb assoc */btb_config[1], /* ret-addr stack size */ras_size); } else fatal("cannot parse predictor type `%s'", pred_type); }
/* initialize the Dynamic power module */ void power_init() { /* TECH_POINT180nm */ GEN_POWER_FACTOR = 1.31; if (!mystricmp(TECH_FACTOR, "TECH_180")) { CSCALE = 19.7172; /* wire capacitance scaling factor */ RSCALE = 20.0000 ;/* wire resistance scaling factor */ LSCALE = 0.2250 ; /* length (feature) scaling factor */ ASCALE = LSCALE*LSCALE; /* area scaling factor */ VSCALE = 0.4 ; /* voltage scaling factor */ VTSCALE = 0.5046; /* threshold voltage scaling factor */ SSCALE = 0.85 ; /* sense voltage scaling factor */ TECH_LENGTH = 0.18 ; /* TECH LENGTH */ Mhz = 1000e6; GEN_POWER_SCALE = 1; } /* TECH_POINT130nm */ else if (!mystricmp(TECH_FACTOR, "TECH_130")) { CSCALE = 40.00; /* wire capacitance scaling factor */ RSCALE = 40.0000; /* wire resistance scaling factor */ LSCALE = 0.1440; /* length (feature) scaling factor */ ASCALE = LSCALE*LSCALE; /* area scaling factor */ VSCALE = 0.3; /* voltage scaling factor */ VTSCALE = 0.4980 ; /* threshold voltage scaling factor */ SSCALE = 0.825 ; /* sense voltage scaling factor */ Mhz = 1700e6; TECH_LENGTH = 0.13; /* TECH LENGTH */ GEN_POWER_SCALE= 1; } /* TECH_POINT100nm */ else if (!mystricmp(TECH_FACTOR, "TECH_100")) { CSCALE = 84.2172; /* wire capacitance scaling factor */ /* linear: 51.7172, predicted: 84.2172 */ RSCALE = 80.0000; /* wire resistance scaling factor */ LSCALE = 0.1250; /* length (feature) scaling factor */ ASCALE = LSCALE*LSCALE; /* area scaling factor */ VSCALE = 0.24; /* voltage scaling factor */ VTSCALE = 0.49 ; /* threshold voltage scaling factor */ SSCALE = 0.80; /* sense voltage scaling factor */ TECH_LENGTH = 0.10 ; /* TECH LENGTH */ Mhz = 3000e6; GEN_POWER_SCALE = (1/GEN_POWER_FACTOR); } else if (!mystricmp(TECH_FACTOR, "TECH_070")) { CSCALE = 160.2172; /* wire capacitance scaling factor */ /* linear: 51.7172, predicted: 84.2172 */ RSCALE = (160.0000); /* wire resistance scaling factor */ LSCALE = 0.0800 ; /* length (feature) scaling factor */ ASCALE = (LSCALE*LSCALE); /* area scaling factor */ VSCALE = 0.20; /* voltage scaling factor */ VTSCALE = 0.45; /* threshold voltage scaling factor */ SSCALE = 0.775; /* sense voltage scaling factor */ TECH_LENGTH = 0.07; /* TECH LENGTH */ Mhz = 5600e6; GEN_POWER_SCALE = (1/GEN_POWER_FACTOR); } /* * CMOS 0.8um model parameters * - from Appendix II of Cacti tech report */ /* corresponds to 8um of m3 @ 225ff/um */ Cwordmetal = (1.8e-15 * (CSCALE * ASCALE)) ; /* corresponds to 16um of m2 @ 275ff/um */ Cbitmetal = (4.4e-15 * (CSCALE * ASCALE)) ; /* corresponds to 1um of m2 @ 275ff/um */ Cmetal = Cbitmetal/16 ; CM3metal = Cbitmetal/16 ; CM2metal = Cbitmetal/16 ; /* Cmetal 1.222e-15 */ /* fF/um2 at 1.5V */ Cndiffarea = 0.137e-15; /* FIXME: ??? */ /* fF/um2 at 1.5V */ Cpdiffarea = 0.343e-15; /* FIXME: ??? */ /* fF/um at 1.5V */ Cndiffside = 0.275e-15; /* in general this does not scale */ /* fF/um at 1.5V */ Cpdiffside = 0.275e-15; /* in general this does not scale */ /* fF/um at 1.5V */ Cndiffovlp = 0.138e-15; /* FIXME: by depth??? */ /* fF/um at 1.5V */ Cpdiffovlp = 0.138e-15; /* FIXME: by depth??? */ /* fF/um assuming 25% Miller effect */ Cnoxideovlp = 0.263e-15; /* FIXME: by depth??? */ /* fF/um assuming 25% Miller effect */ Cpoxideovlp = 0.338e-15; /* FIXME: by depth??? */ /* um */ Leff = (0.8 * LSCALE) ; /* fF/um2 */ Cgate = 1.95e-15; /* FIXME: ??? */ /* fF/um2 */ Cgatepass = 1.45e-15; /* FIXME: ??? */ /* note that the value of Cgatepass will be different depending on whether or not the source and drain are at different potentials or the same potential. The two values were averaged */ /* fF/um */ Cpolywire = (0.25e-15 * CSCALE * LSCALE) ; /* ohms*um of channel width */ Rnchannelstatic = (25800 * LSCALE) ; /* ohms*um of channel width */ Rpchannelstatic = (61200 * LSCALE) ; Rnchannelon = (9723 * LSCALE) ; Rpchannelon = (22400 * LSCALE) ; /* corresponds to 16um of m2 @ 48mO/sq */ Rbitmetal = (0.320 * (RSCALE * ASCALE)) ; /* corresponds to 8um of m3 @ 24mO/sq */ Rwordmetal = (0.080 * (RSCALE * ASCALE)) ; Vdd = (5 * VSCALE) ; /* other stuff (from tech report, appendix 1) */ Period = (1/Mhz) ; krise = (0.4e-9 * LSCALE) ; tsensedata = (5.8e-10 * LSCALE) ; tsensetag = (2.6e-10 * LSCALE) ; tfalldata = (7e-10 * LSCALE) ; tfalltag = (7e-10 * LSCALE) ; Vbitpre = (3.3 * SSCALE) ; Vt = (1.09 * VTSCALE) ; Vbitsense = (0.10 * SSCALE) ; Sense2Powerfactor= (Mhz)*(2*.3+.1*Vdd); LowSwingPowerfactor= (Mhz)*.2*.2; MSCALE= (LSCALE * .624 / .2250); Powerfactor = (Mhz)*Vdd*Vdd; SensePowerfactor3 = (Mhz)*(Vbitsense)*(Vbitsense) ; SensePowerfactor2 = (Mhz)*(Vbitpre-Vbitsense)*(Vbitpre-Vbitsense) ; SensePowerfactor = (Mhz)*(Vdd/2)*(Vdd/2) ; AF = 0.5; POPCOUNT_AF = (23.9/64.0) ; /* Threshold voltages (as a proportion of Vdd) If you don't know them, set all values to 0.5 */ VSINV = 0.456 ; VTHINV100x60 = 0.438; /* inverter with p=100,n=60 */ VTHNAND60x90 = 0.561 ; /* nand with p=60 and three n=90 */ VTHNOR12x4x1 = 0.503 ; /* nor with p=12, n=4, 1 input */ VTHNOR12x4x2 = 0.452 ; /* nor with p=12, n=4, 2 inputs */ VTHNOR12x4x3 = 0.417 ; /* nor with p=12, n=4, 3 inputs */ VTHNOR12x4x4 = 0.390 ; /* nor with p=12, n=4, 4 inputs */ VTHOUTDRINV = 0.437; VTHOUTDRNOR = 0.431; VTHOUTDRNAND = 0.441; VTHOUTDRIVE = 0.425; VTHCOMPINV = 0.437; VTHMUXDRV1 = 0.437; VTHMUXDRV2 = 0.486; VTHMUXDRV3 = 0.437; VTHEVALINV = 0.267; VTHSENSEEXTDRV = 0.437; /* transistor widths in um (as described in tech report, appendix 1) */ Wdecdrivep = (57.0 * LSCALE) ; Wdecdriven = (40.0 * LSCALE) ; Wdec3to8n = (14.4 * LSCALE) ; Wdec3to8p = (14.4 * LSCALE) ; WdecNORn = (5.4 * LSCALE) ; WdecNORp = (30.5 * LSCALE) ; Wdecinvn = (5.0 * LSCALE) ; Wdecinvp = (10.0 * LSCALE) ; Wworddrivemax = (100.0 * LSCALE) ; Wmemcella = (2.4 * LSCALE) ; Wmemcellr = (4.0 * LSCALE) ; Wmemcellw = (2.1 * LSCALE) ; Wmemcellbscale = 2; /* means 2x bigger than Wmemcella */ Wbitpreequ = (10.0 * LSCALE) ; Wbitmuxn = (10.0 * LSCALE) ; WsenseQ1to4 = (4.0 * LSCALE) ; Wcompinvp1 = (10.0 * LSCALE) ; Wcompinvn1 = (6.0 * LSCALE) ; Wcompinvp2 = (20.0 * LSCALE) ; Wcompinvn2 = (12.0 * LSCALE) ; Wcompinvp3 = (40.0 * LSCALE) ; Wcompinvn3 = (24.0 * LSCALE) ; Wevalinvp = (20.0 * LSCALE) ; Wevalinvn = (80.0 * LSCALE) ; Wcompn = (20.0 * LSCALE) ; Wcompp = (30.0 * LSCALE) ; Wcomppreequ = (40.0 * LSCALE) ; Wmuxdrv12n = (30.0 * LSCALE) ; Wmuxdrv12p = (50.0 * LSCALE) ; WmuxdrvNANDn = (20.0 * LSCALE) ; WmuxdrvNANDp = (80.0 * LSCALE) ; WmuxdrvNORn = (60.0 * LSCALE) ; WmuxdrvNORp = (80.0 * LSCALE) ; Wmuxdrv3n = (200.0 * LSCALE) ; Wmuxdrv3p = (480.0 * LSCALE) ; Woutdrvseln = (12.0 * LSCALE) ; Woutdrvselp = (20.0 * LSCALE) ; Woutdrvnandn = (24.0 * LSCALE) ; Woutdrvnandp = (10.0 * LSCALE) ; Woutdrvnorn = (6.0 * LSCALE) ; Woutdrvnorp = (40.0 * LSCALE) ; Woutdrivern = (48.0 * LSCALE) ; Woutdriverp = (80.0 * LSCALE) ; Wcompcellpd2 = (2.4 * LSCALE) ; Wcompdrivern = (400.0 * LSCALE) ; Wcompdriverp = (800.0 * LSCALE) ; Wcomparen2 = (40.0 * LSCALE) ; Wcomparen1 = (20.0 * LSCALE) ; Wmatchpchg = (10.0 * LSCALE) ; Wmatchinvn = (10.0 * LSCALE) ; Wmatchinvp = (20.0 * LSCALE) ; Wmatchnandn = (20.0 * LSCALE) ; Wmatchnandp = (10.0 * LSCALE) ; Wmatchnorn = (20.0 * LSCALE) ; Wmatchnorp = (10.0 * LSCALE) ; WSelORn = (10.0 * LSCALE) ; WSelORprequ = (40.0 * LSCALE) ; WSelPn = (10.0 * LSCALE) ; WSelPp = (15.0 * LSCALE) ; WSelEnn = (5.0 * LSCALE) ; WSelEnp = (10.0 * LSCALE) ; Wsenseextdrv1p = (40.0*LSCALE) ; Wsenseextdrv1n = (24.0*LSCALE) ; Wsenseextdrv2p = (200.0*LSCALE) ; Wsenseextdrv2n = (120.0*LSCALE) ; /* bit width of RAM cell in um */ BitWidth = (16.0 * LSCALE) ; /* bit height of RAM cell in um */ BitHeight = (16.0 * LSCALE) ; Cout = (0.5e-12 * LSCALE) ; /* Sizing of cells and spacings */ RatCellHeight = (40.0 * LSCALE) ; RatCellWidth = (70.0 * LSCALE) ; RatShiftRegWidth = (120.0 * LSCALE) ; RatNumShift = 4; BitlineSpacing = (6.0 * LSCALE) ; WordlineSpacing = (6.0 * LSCALE) ; RegCellHeight = (16.0 * LSCALE) ; RegCellWidth = (8.0 * LSCALE) ; CamCellHeight = (40.0 * LSCALE) ; CamCellWidth = (25.0 * LSCALE) ; MatchlineSpacing = (6.0 * LSCALE) ; TaglineSpacing = (6.0 * LSCALE) ; /*===================================================================*/ /* ALU POWER NUMBERS for .18um 733Mhz */ /* normalize to cap from W */ NORMALIZE_SCALE = (1.0/(733.0e6*1.45*1.45)) ; /* normalize .18um cap to other gen's cap, then xPowerfactor */ POWER_SCALE = (GEN_POWER_SCALE * NORMALIZE_SCALE * Powerfactor) ; I_ADD = ((.37 - .091) * POWER_SCALE) ; I_ADD32 = (((.37 - .091)/2) *POWER_SCALE) ; I_MULT16 = ((.31-.095)*POWER_SCALE) ; I_SHIFT = ((.21-.089)*POWER_SCALE) ; I_LOGIC = ((.04-.015)*POWER_SCALE) ; F_ADD = ((1.307-.452)*POWER_SCALE) ; F_MULT = ((1.307-.452)*POWER_SCALE) ; I_ADD_CLOCK = (.091*POWER_SCALE) ; I_MULT_CLOCK = (.095*POWER_SCALE) ; I_SHIFT_CLOCK = (.089*POWER_SCALE) ; I_LOGIC_CLOCK = (.015*POWER_SCALE) ; F_ADD_CLOCK = (.452*POWER_SCALE) ; F_MULT_CLOCK = (.452*POWER_SCALE) ; }
static void sim_check_options(struct opt_odb_t *odb, /* options database */ int argc, char **argv) /* command line arguments */ { char name[128], c; if (ruu_ifq_size < 1 || (ruu_ifq_size & (ruu_ifq_size - 1)) != 0) fatal("inst fetch queue size must be positive > 0 and a power of two"); pipe_ibuf_size = ruu_ifq_size; fetch_width = ruu_decode_width * fetch_speed; //if (ruu_branch_penalty < 1) // fatal("mis-prediction penalty must be at least 1 cycle"); if (!mystricmp(pred_type, "perfect")) { /* perfect predictor */ bpred_scheme = NO_BPRED; } #if 0 else if (!mystricmp(pred_type, "taken")) { /* static predictor, not taken */ //pred = bpred_create(BPredTaken, 0, 0, 0, 0, 0, 0, 0, 0, 0); } else if (!mystricmp(pred_type, "nottaken")) { /* static predictor, taken */ //pred = bpred_create(BPredNotTaken, 0, 0, 0, 0, 0, 0, 0, 0, 0); } #endif else if (!mystricmp(pred_type, "bimod")) { /* bimodal predictor, bpred_create() checks BTB_SIZE */ if (bimod_nelt != 1) fatal("bad bimod predictor config (<table_size>)"); if (btb_nelt != 2) fatal("bad btb config (<num_sets> <associativity>)"); bpred_scheme = LOCAL; BHT_SIZE = btb_config[0]; BHT = log_base2(BHT_SIZE); BHT_MSK = BHT_SIZE - 1; } else if (!mystricmp(pred_type, "2lev")) { if (twolev_nelt != 4) fatal("bad 2-level pred config (<l1size> <l2size> <hist_size> <xor>)"); if (btb_nelt != 2) fatal("bad btb config (<num_sets> <associativity>)"); if ((twolev_config[1] & (twolev_config[1] - 1)) != 0) fatal("Branch History Table (BHT) size %d is not power of 2!\n", twolev_config[1]); if ((twolev_config[2] < 0) || (twolev_config[2] > 4)) fatal("Branch History Register (BHR) bits %d is not within [0, 4]\n", twolev_config[2]); if (twolev_config[2] == 0) bpred_scheme = LOCAL; if (twolev_config[3] == FALSE) bpred_scheme = GAG; else bpred_scheme = GSHARE; BHT_SIZE = twolev_config[1]; BHT = log_base2(BHT_SIZE); BHT_MSK = BHT_SIZE - 1; BHR = twolev_config[2]; BHR_PWR = 1 << BHR; BHR_MSK = BHR_PWR - 1; if ( (1 << BHR) > BHT_SIZE) fatal("The combination of Branch History Register (BHR) bits %d and \nBranch History Table size %d is invalid because 2^BHR > BHT \n", BHR, BHT_SIZE); } #if 0 else if (!mystricmp(pred_type, "comb")) { /* combining predictor, bpred_create() checks args */ if (twolev_nelt != 4) fatal("bad 2-level pred config (<l1size> <l2size> <hist_size> <xor>)"); if (bimod_nelt != 1) fatal("bad bimod predictor config (<table_size>)"); if (comb_nelt != 1) fatal("bad combining predictor config (<meta_table_size>)"); if (btb_nelt != 2) fatal("bad btb config (<num_sets> <associativity>)"); pred = bpred_create(BPredComb, /* bimod table size */bimod_config[0], /* l1 size */twolev_config[0], /* l2 size */twolev_config[1], /* meta table size */comb_config[0], /* history reg size */twolev_config[2], /* history xor address */twolev_config[3], /* btb sets */btb_config[0], /* btb assoc */btb_config[1], /* ret-addr stack size */ras_size); } #endif else fatal("cannot parse predictor type `%s'", pred_type); #if 0 if (ruu_decode_width < 1 || (ruu_decode_width & (ruu_decode_width-1)) != 0) fatal("issue width must be positive non-zero and a power of two"); if (ruu_issue_width < 1 || (ruu_issue_width & (ruu_issue_width-1)) != 0) fatal("issue width must be positive non-zero and a power of two"); if (ruu_commit_width < 1) fatal("commit width must be positive non-zero"); #endif if (RUU_size < 2) fatal("Re-order buffer size must be greater than one!"); pipe_iwin_size = RUU_size; PROLOG_SIZE = pipe_iwin_size + pipe_ibuf_size; EPILOG_SIZE = pipe_iwin_size * 2; LSQ_size = pipe_iwin_size; #if 0 if (LSQ_size < 2 || (LSQ_size & (LSQ_size-1)) != 0) fatal("LSQ size must be a positive number > 1 and a power of two"); #endif /* use a level 1 D-cache? */ if (!mystricmp(cache_dl1_opt, "none")) { #if 0 cache_dl1 = NULL; #endif enable_dcache = enable_scp_dcache = 0; /* the level 2 D-cache cannot be defined */ if (strcmp(cache_dl2_opt, "none")) fatal("the l1 data cache must defined if the l2 cache is defined"); #if 0 cache_dl2 = NULL; #endif } else /* dl1 is defined */ { enable_scp_dcache = 1; if (sscanf(cache_dl1_opt, "%[^:]:%d:%d:%d:%c", name, &nsets_dl1, &bsize_dl1, &assoc_dl1, &c) != 5) fatal("bad l1 D-cache parms: <name>:<nsets>:<bsize>:<assoc>:<repl>"); /* sudiptac ::: enable level 1 data cache analysis */ enable_dcache = 1; #if 0 cache_dl1 = cache_create(name, nsets, bsize, /* balloc */FALSE, /* usize */0, assoc, cache_char2policy(c), dl1_access_fn, /* hit lat */cache_dl1_lat); #endif /* is the level 2 D-cache defined? */ if (!mystricmp(cache_dl2_opt, "none")) enable_ul2cache = 0; #if 0 cache_dl2 = NULL; #endif else { if (sscanf(cache_dl2_opt, "%[^:]:%d:%d:%d:%c", name, &nsets_dl2, &bsize_dl2, &assoc_dl2, &c) != 5) fatal("bad l2 D-cache parms: " "<name>:<nsets>:<bsize>:<assoc>:<repl>"); enable_scp_dl2cache = 1; } }
static int _toc_scmp (const void *e1, const void *e2) { TOC *t1 = *((TOC **) e1); TOC *t2 = *((TOC **) e2); return mystricmp (t1->text, t2->text); }