Support selective control of specify and xtypes features.

This commit is contained in:
steve 2006-09-28 04:35:18 +00:00
parent 7e3ea2ffe8
commit d6be82f748
6 changed files with 108 additions and 23 deletions

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: compiler.h,v 1.30 2005/07/11 16:56:50 steve Exp $"
#ident "$Id: compiler.h,v 1.31 2006/09/28 04:35:18 steve Exp $"
#endif
# include <list>
@ -104,12 +104,17 @@ enum generation_t {
};
extern generation_t generation_flag;
extern bool gn_cadence_types_flag;
/* These functions test that specific features are enabled. */
inline bool gn_cadence_types_enabled()
{ return gn_cadence_types_flag && generation_flag==GN_VER2001X; }
/* If this flag is true, then elaborate specify blocks. If this flag
is false, then skip elaboration of specify behavior. */
extern bool gn_specify_blocks_flag;
/* This is the string to use to invoke the preprocessor. */
extern char*ivlpp_string;
@ -143,6 +148,9 @@ extern int load_sys_func_table(const char*path);
/*
* $Log: compiler.h,v $
* Revision 1.31 2006/09/28 04:35:18 steve
* Support selective control of specify and xtypes features.
*
* Revision 1.30 2005/07/11 16:56:50 steve
* Remove NetVariable and ivl_variable_t structures.
*

View File

@ -1,10 +1,10 @@
.TH iverilog 1 "$Date: 2005/06/28 04:25:55 $" Version "$Date: 2005/06/28 04:25:55 $"
.TH iverilog 1 "$Date: 2006/09/28 04:35:18 $" Version "$Date: 2006/09/28 04:35:18 $"
.SH NAME
iverilog - Icarus Verilog compiler
.SH SYNOPSIS
.B iverilog
[-ESVv] [-Bpath] [-ccmdfile] [-g1|-g2|-g2x] [-Dmacro[=defn]] [-pflag=value]
[-ESVv] [-Bpath] [-ccmdfile] [-g1|-g2|-g2x|-gspecify-gxtypes] [-Dmacro[=defn]] [-pflag=value]
[-Iincludedir] [-mmodule] [-Mfile] [-Nfile] [-ooutputfilename]
[-stopmodule] [-ttype] [-Tmin/typ/max] [-Wclass] [-ypath] sourcefile
@ -57,6 +57,21 @@ language. This flag is most useful to restrict the language to a set
supported by tools of specific generations, for compatibility with
other tools.
.TP 8
.B -gspecify\fI|\fP-gno-specify
Enable (default) or disable specify block support. When enabled,
specify block code is elaborated. When disabled, specify blocks are
parsed but ignored. Specify blocks are commonly not needed for RTL
simulation, and in fact can hurt performance of the
simulation. However, disabling specify blocks reduces acuracy of
full-timing simulations.
.TP 8
.B -gxtypes\fI|\fP-gno-xtypes
Enable (default) or disable support for extended types. Enabling
extended types allows for new types that are supported by Icarus
Verilog as extensions beyond the baseline verilog. It may be necessary
to disable extended types if compiling code that clashes with the few
new keywords used to implement the type system.
.TP 8
.B -I\fIincludedir\fP
Append directory \fIincludedir\fP to list of directories searched
for Verilog include files. The \fB-I\fP switch may be used many times

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: main.c,v 1.70 2006/09/20 22:30:52 steve Exp $"
#ident "$Id: main.c,v 1.71 2006/09/28 04:35:18 steve Exp $"
#endif
# include "config.h"
@ -108,6 +108,8 @@ const char*targ = "vvp";
const char*depfile = 0;
const char*generation = "2x";
const char*gen_specify = "specify";
const char*gen_xtypes = "xtypes";
char warning_flags[16] = "";
@ -380,13 +382,28 @@ int process_generation(const char*name)
else if (strcmp(name,"2x") == 0)
generation = "2x";
else if (strcmp(name,"xtypes") == 0)
gen_xtypes = "xtypes";
else if (strcmp(name,"no-xtypes") == 0)
gen_xtypes = "no-xtypes";
else if (strcmp(name,"specify") == 0)
gen_specify = "specify";
else if (strcmp(name,"no-specify") == 0)
gen_specify = "no-specify";
else {
fprintf(stderr, "Unknown/Unsupported Language generation "
"%s\n", name);
fprintf(stderr, "Supported generations are:\n");
fprintf(stderr, " 1 -- IEEE1364-1995 (Verilog 1)\n"
" 2 -- IEEE1364-2001 (Verilog 2001)\n"
" 2x -- Verilog with extensions\n");
" 2x -- Verilog with extensions\n"
"Other generation flags:\n"
" specify | no-specify\n"
" xtypes | no-xtypes\n");
return 1;
}
@ -616,6 +633,8 @@ int main(int argc, char **argv)
if (mtm != 0) fprintf(iconfig_file, "-T:%s\n", mtm);
fprintf(iconfig_file, "generation:%s\n", generation);
fprintf(iconfig_file, "generation:%s\n", gen_specify);
fprintf(iconfig_file, "generation:%s\n", gen_xtypes);
fprintf(iconfig_file, "warnings:%s\n", warning_flags);
fprintf(iconfig_file, "out:%s\n", opath);
if (depfile) fprintf(iconfig_file, "depfile:%s\n", depfile);
@ -721,6 +740,9 @@ int main(int argc, char **argv)
/*
* $Log: main.c,v $
* Revision 1.71 2006/09/28 04:35:18 steve
* Support selective control of specify and xtypes features.
*
* Revision 1.70 2006/09/20 22:30:52 steve
* Do not pass -D__ICARUS__ to ivlpp.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_expr.cc,v 1.110 2006/09/28 00:29:49 steve Exp $"
#ident "$Id: elab_expr.cc,v 1.111 2006/09/28 04:35:18 steve Exp $"
#endif
# include "config.h"
@ -670,16 +670,19 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
// A specparam? Look up the name to see if it is a
// specparam. If we find it, then turn it into a NetEConst
// value and return that.
// value and return that. Of course, this does not apply if
// specify blocks are disabled.
map<perm_string,long>::const_iterator specp;
const char*key = path_.peek_name(0);
if (path_.component_count() == 1
&& ((specp = scope->specparams.find(perm_string::literal(key))) != scope->specparams.end())) {
verinum val ((*specp).second);
NetEConst*tmp = new NetEConst(val);
tmp->set_line(*this);
return tmp;
if (gn_specify_blocks_flag) {
map<perm_string,long>::const_iterator specp;
perm_string key = perm_string::literal(path_.peek_name(0));
if (path_.component_count() == 1
&& ((specp = scope->specparams.find(key)) != scope->specparams.end())) {
verinum val ((*specp).second);
NetEConst*tmp = new NetEConst(val);
tmp->set_line(*this);
return tmp;
}
}
// Finally, if this is a scope name, then return that. Look
@ -1413,6 +1416,9 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope,
/*
* $Log: elab_expr.cc,v $
* Revision 1.111 2006/09/28 04:35:18 steve
* Support selective control of specify and xtypes features.
*
* Revision 1.110 2006/09/28 00:29:49 steve
* Allow specparams as constants in expressions.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: elaborate.cc,v 1.344 2006/09/26 19:48:40 steve Exp $"
#ident "$Id: elaborate.cc,v 1.345 2006/09/28 04:35:18 steve Exp $"
#endif
# include "config.h"
@ -2878,6 +2878,11 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const
uint64_t delay_value[12];
unsigned ndelays = 0;
/* Do not elaborate specify delay paths if this feature is
turned off. */
if (!gn_specify_blocks_flag)
return;
ndelays = delays.size();
if (ndelays > 12)
ndelays = 12;
@ -3279,6 +3284,9 @@ Design* elaborate(list<perm_string>roots)
/*
* $Log: elaborate.cc,v $
* Revision 1.345 2006/09/28 04:35:18 steve
* Support selective control of specify and xtypes features.
*
* Revision 1.344 2006/09/26 19:48:40 steve
* Missing PSpec.cc file.
*

40
main.cc
View File

@ -19,7 +19,7 @@ const char COPYRIGHT[] =
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: main.cc,v 1.92 2005/07/14 23:38:43 steve Exp $"
#ident "$Id: main.cc,v 1.93 2006/09/28 04:35:18 steve Exp $"
#endif
# include "config.h"
@ -88,6 +88,7 @@ const char*target = "null";
*/
generation_t generation_flag = GN_DEFAULT;
bool gn_cadence_types_flag = true;
bool gn_specify_blocks_flag = true;
map<string,const char*> flags;
char*vpi_module_list = 0;
@ -186,17 +187,29 @@ const char *net_func_to_name(const net_func func)
static void process_generation_flag(const char*gen)
{
if (strcmp(gen,"1") == 0)
if (strcmp(gen,"1") == 0) {
generation_flag = GN_VER1995;
else if (strcmp(gen,"2") == 0)
} else if (strcmp(gen,"2") == 0) {
generation_flag = GN_VER2001;
else if (strcmp(gen,"2x") == 0)
} else if (strcmp(gen,"2x") == 0) {
generation_flag = GN_VER2001X;
else
generation_flag = GN_DEFAULT;
} else if (strcmp(gen,"xtypes") == 0) {
gn_cadence_types_flag = true;
} else if (strcmp(gen,"no-xtypes") == 0) {
gn_cadence_types_flag = false;
} else if (strcmp(gen,"specify") == 0) {
gn_specify_blocks_flag = true;
} else if (strcmp(gen,"no-specify") == 0) {
gn_specify_blocks_flag = false;
} else {
}
}
static void parm_to_flagmap(const string&flag)
@ -257,7 +270,7 @@ static void parm_to_flagmap(const string&flag)
* functor:<name>
* Append a named functor to the processing path.
*
* generation:<1|2|3.0>
* generation:<1|2|2x|xtypes|no-xtypes|specify|no-specify>
* This is the generation flag
*
* ivlpp:<preprocessor command>
@ -559,6 +572,16 @@ int main(int argc, char*argv[])
break;
}
if (gn_specify_blocks_flag)
cout << ",specify";
else
cout << ",no-specify";
if (gn_cadence_types_flag)
cout << ",xtypes";
else
cout << ",no-xtypes";
cout << endl << "PARSING INPUT" << endl;
}
@ -764,6 +787,9 @@ int main(int argc, char*argv[])
/*
* $Log: main.cc,v $
* Revision 1.93 2006/09/28 04:35:18 steve
* Support selective control of specify and xtypes features.
*
* Revision 1.92 2005/07/14 23:38:43 steve
* Display as version 0.9.devel
*