⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmdmain.c

📁 这是个trace drive的Cache模拟器
💻 C
📖 第 1 页 / 共 5 页
字号:
	printf ("copyright notice and this permission notice appear in the documentation.\n");	printf ("NEC Research Institute Inc. and Mark D. Hill shall be given a copy of\n");	printf ("any such derivative work or modified version of the software and NEC\n");	printf ("Research Institute Inc.  and any of its affiliated companies (collectively\n");	printf ("referred to as NECI) and Mark D. Hill shall be granted permission to use,\n");	printf ("copy, modify, and distribute the software for internal use and research.\n");	printf ("The name of NEC Research Institute Inc. and its affiliated companies\n");	printf ("shall not be used in advertising or publicity related to the distribution\n");	printf ("of the software, without the prior written consent of NECI.  All copies,\n");	printf ("derivative works, or modified versions of the software shall be exported\n");	printf ("or reexported in accordance with applicable laws and regulations relating\n");	printf ("to export control.  This software is experimental.  NECI and Mark D. Hill\n");	printf ("make no representations regarding the suitability of this software for\n");	printf ("any purpose and neither NECI nor Mark D. Hill will support the software.\n");	printf ("\n");	printf ("Use of this software for commercial purposes is also possible, but only\n");	printf ("if, in addition to the above requirements for non-commercial use, written\n");	printf ("permission for such use is obtained by the commercial user from NECI or\n");	printf ("Mark D. Hill prior to the fabrication and distribution of the software.\n");	printf ("\n");	printf ("THE SOFTWARE IS PROVIDED AS IS.  NECI AND MARK D. HILL DO NOT MAKE\n");	printf ("ANY WARRANTEES EITHER EXPRESS OR IMPLIED WITH REGARD TO THE SOFTWARE.\n");	printf ("NECI AND MARK D. HILL ALSO DISCLAIM ANY WARRANTY THAT THE SOFTWARE IS\n");	printf ("FREE OF INFRINGEMENT OF ANY INTELLECTUAL PROPERTY RIGHTS OF OTHERS.\n");	printf ("NO OTHER LICENSE EXPRESS OR IMPLIED IS HEREBY GRANTED.  NECI AND MARK\n");	printf ("D. HILL SHALL NOT BE LIABLE FOR ANY DAMAGES, INCLUDING GENERAL, SPECIAL,\n");	printf ("INCIDENTAL, OR CONSEQUENTIAL DAMAGES, ARISING OUT OF THE USE OR INABILITY\n");	printf ("TO USE THE SOFTWARE.\n");	exit(0);}/* * Produce help message in response to -contact */voidval_helpw (const char *opt, const char *arg, const struct arglist *adesc){	printf ("Dinero IV was written by Jan Edler and Mark D. Hill.\n");	printf ("\n");	printf ("    Dr. Jan Edler                    Prof. Mark D. Hill\n");	printf ("    NEC Research Institute           Computer Sciences Dept.\n");	printf ("    4 Independence Way               Univ. of Wisconsin\n");	printf ("    Princeton, NJ 08540              Madison, WI 53706\n");	printf ("    edler@research.nj.nec.com        markhill@cs.wisc.edu\n");	printf ("    edler@acm.org\n");	printf ("    edler@computer.org\n");	printf ("\n");	printf ("The latest version of Dinero IV can be obtained\n");	printf ("from the following places:\n");	printf ("       http://www.neci.nj.nec.com/homepages/edler/d4\n");	printf ("       http://www.cs.wisc.edu/~markhill/DineroIV\n");	printf ("       ftp://ftp.nj.nec.com/pub/edler/d4\n");	printf ("       ftp://ftp.cs.wisc.edu/markhill/DineroIV\n");	printf ("Copyright terms are explained by the -copyright option.\n");	exit(0);}#if !D4CUSTOM/* * Explain DineroIII->DineroIV option mappings */voidval_helpd3 (const char *opt, const char *arg, const struct arglist *adesc){	printf ("Summary of DineroIV replacements for DineroIII options:\n\n");	printf ("DineroIII    DineroIV\n");	printf ("-u           -l1-usize\n");	printf ("-i           -l1-isize\n");	printf ("-d           -l1-dsize\n");	printf ("-b           -l1-ubsize, -l1-ibsize, or -l1-dbsize\n");	printf ("-S           -l1-usbsize, -l1-isbsize, or -l1-dsbsize\n");	printf ("-a           -l1-uassoc, -l1-iassoc, or -l1-dassoc\n");	printf ("-r           -l1-urepl, -l1-irepl, or -l1-drepl\n");	printf ("-f           -l1-ufetch, -l1-ifetch, or -l1-dfetch\n");	printf ("-p           -l1-upfdist, -l1-ipfdist, or -l1-dpfdist\n");	printf ("-P           -l1-upfabort, -l1-ipfabort, or -l1-dpfabort\n");	printf ("-w           -l1-uwback or -l1-dwback\n");	printf ("-A           -l1-uwalloc or -l1-dwalloc\n");	printf ("-Q           -flushcount\n");	printf ("-z           -maxcount\n");	printf ("-Z           -skipcount\n");	printf ("\n");	printf ("DineroIII input format: -informat d\n");	exit(0);}#endif/* * Handle an option with no args (i.e., a boolean option). */voidval_0arg (const char *opt, const char *arg, const struct arglist *adesc){	*(int *) adesc->var = 1;}/* * Handle an option with no args (i.e., a boolean option) and the -ln-idu-prefix. */voidpval_0arg (const char *opt, const char *arg, const struct arglist *adesc){	int (*var)[3][MAX_LEV] = adesc->var;	int level;	int idu;	(void) level_idu (opt, &level, &idu);	(*var)[idu][level] = 1;}/* * Handle unsigned integer arg. */voidval_uint (const char *opt, const char *arg, const struct arglist *adesc){	char *nextc;	*(unsigned int *)adesc->var = strtoul (arg, &nextc, 10);	if (*nextc != 0)		shorthelp ("bad option: %s %s\n", opt, arg);}/* * Handle -ln-idu-stuff with unsigned integer arg. * Note the match function has already verified the form, * so level_idu() can't return NULL. */voidpval_uint (const char *opt, const char *arg, const struct arglist *adesc){	unsigned int (*var)[3][MAX_LEV] = adesc->var;	unsigned int argui;	int level;	int idu;	char *nextc;	(void) level_idu (opt, &level, &idu);	argui = strtoul (arg, &nextc, 10);	if (*nextc != 0)		shorthelp ("bad option: %s %s\n", opt, arg);	(*var)[idu][level] = argui;}/* * Handle unsigned integer arg with optional scaling (k,m,g, etc). */voidval_scale_uint (const char *opt, const char *arg, const struct arglist *adesc){	if (!argscale_uint (arg, adesc->var))		shorthelp ("bad option: %s %s\n", opt, arg);}/* * Handle unsigned integer arg with optional scaling (k,m,g, etc). * Here we use double for extra integer range. */voidval_scale_uintd (const char *opt, const char *arg, const struct arglist *adesc){	if (!argscale_uintd (arg, adesc->var))		shorthelp ("bad option: %s %s\n", opt, arg);}/* * Handle -ln-idu-stuff with unsigned integer arg with * optional scaling (k,m,g, etc). * Note the match function has already verified the form, * so level_idu() can't return NULL. */voidpval_scale_uint (const char *opt, const char *arg, const struct arglist *adesc){	unsigned int (*var)[3][MAX_LEV] = adesc->var;	unsigned int argui;	int level;	int idu;	(void) level_idu (opt, &level, &idu);	if (!argscale_uint (arg, &argui))		shorthelp ("bad option: %s %s\n", opt, arg);	(*var)[idu][level] = argui;}/* * Handle unsigned integer arg restricted to a power of 2 and * with optional scaling (k,m,g, etc). */voidval_scale_pow2 (const char *opt, const char *arg, const struct arglist *adesc){	unsigned int *ui = adesc->var;	if (!argscale_uint (arg, ui))		shorthelp ("bad option: %s %s\n", opt, arg);	if (*ui == 0 || (*ui & (*ui-1)) != 0)		shorthelp ("option %s arg must be power of 2\n", opt);}/* * Handle -ln-idu-stuff with unsigned integer arg restricted to * a power of 2 and with optional scaling (k,m,g, etc). * Note the match function has already verified the form, * so level_idu() can't return NULL. */voidpval_scale_pow2 (const char *opt, const char *arg, const struct arglist *adesc){	unsigned int (*var)[3][MAX_LEV] = adesc->var;	unsigned int argui;	int level;	int idu;	(void) level_idu (opt, &level, &idu);	if (!argscale_uint (arg, &argui))		shorthelp ("bad option: %s %s\n", opt, arg);	if (argui == 0 || (argui & (argui-1)) != 0)		shorthelp ("option %s arg must be power of 2\n", opt);	(*var)[idu][level] = argui;}/* * Handle an option with a single character as arg */voidval_char (const char *opt, const char *arg, const struct arglist *adesc){	int *var = adesc->var;	if (strlen (arg) != 1)		shorthelp ("bad option: %s %s\n", opt, arg);	*var = *arg;}/* * Handle an option with level/idu prefix and a single character as arg */voidpval_char (const char *opt, const char *arg, const struct arglist *adesc){	int (*var)[3][MAX_LEV] = adesc->var;	int level;	int idu;	(void) level_idu (opt, &level, &idu);	if (strlen (arg) != 1)		shorthelp ("bad option: %s %s\n", opt, arg);	(*var)[idu][level] = *arg;}/* * Handle an option with a string as arg */voidval_string (const char *opt, const char *arg, const struct arglist *adesc){	*(const char **)adesc->var = arg;}/* * Handle an option with a hexadecimal address as arg. */voidval_addr (const char *opt, const char *arg, const struct arglist *adesc){	long *var = adesc->var;	long argl;	char *nextc;	argl = strtoul (arg, &nextc, 16);	if (*nextc != 0)		shorthelp ("bad option: %s %s\n", opt, arg);	*var = argl;}#if !D4CUSTOM	/* a customized program can't be further customized *//* * Do nothing.  This is just to provide a non-null function for -custom * so do1arg will not think this option should be passed on to the * custom program itself. */voidcustom_custom (const struct arglist *adesc, FILE *hfile){}/* * Output an array initializer for the level/idu array whose name is given * in the customstring field of the arglist structure, * when the values in question are boolean. */voidpcustom_0arg (const struct arglist *adesc, FILE *hfile){	int i, j;	int (*var)[3][MAX_LEV] = adesc->var;	fprintf (hfile, "int %s[3][MAX_LEV] = {\n",		 adesc->customstring);	for (i = 0;  i < 3;  i++) {		fprintf (hfile, " { ");		for (j = 0;  j < maxlevel;  j++)			fprintf (hfile, "%d%s ", (*var)[i][j],				 j<maxlevel-1 ? "," : "");		fprintf (hfile, "}%s\n", i<2 ? "," : "");	}	fprintf (hfile, "};\n");}/* * Output an array initializer for the level/idu array whose name is given * in the customstring field of the arglist structure, * when the values in question are unsigned ints. */voidpcustom_uint (const struct arglist *adesc, FILE *hfile){	int i, j;	unsigned int (*var)[3][MAX_LEV] = adesc->var;	fprintf (hfile, "unsigned int %s[3][MAX_LEV] = {\n",		 adesc->customstring);	for (i = 0;  i < 3;  i++) {		fprintf (hfile, " { ");		for (j = 0;  j < maxlevel;  j++)			fprintf (hfile, "%u%s ", (*var)[i][j],				 j<maxlevel-1 ? "," : "");		fprintf (hfile, "}%s\n", i<2 ? "," : "");	}	fprintf (hfile, "};\n");}/* * Output an array initializer for the level/idu array whose name is given * in the customstring field of the arglist structure, * when the values in question are chars. */voidpcustom_char (const struct arglist *adesc, FILE *hfile){	int i, j;	int (*var)[3][MAX_LEV] = adesc->var;	fprintf (hfile, "int %s[3][MAX_LEV] = {\n",		 adesc->customstring);	for (i = 0;  i < 3;  i++) {		fprintf (hfile, " { ");		for (j = 0;  j < maxlevel;  j++)			fprintf (hfile, "%d%s ", (*var)[i][j],				 j<maxlevel-1 ? "," : "");		fprintf (hfile, "}%s\n", i<2 ? "," : "");	}	fprintf (hfile, "};\n");}#endif	/* !D4CUSTOM *//* * Produce a summary line for parameters with no arg (i.e., boolean parameters). */voidsummary_0arg (const struct arglist *adesc, FILE *f){	if (*(int *)adesc->var != 0)		fprintf (f, "%s\n", adesc->optstring);}/* * Produce a summary line for parameters with level/idu prefix but no arg. */voidpsummary_0arg (const struct arglist *adesc, FILE *f){	int idu, lev;	int (*var)[3][MAX_LEV] = adesc->var;	for (idu = 0;  idu < 3;  idu++) {		for (lev = 0;  lev <= maxlevel;  lev++) {			if ((*var)[idu][lev] != 0)				fprintf (f, "-l%d-%c%s\n", lev+1,					 idu==0?'u':(idu==1?'i':'d'),					 adesc->optstring);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -