Introduce min:typ:max support.
This commit is contained in:
parent
3aa250b16b
commit
30a81731dd
45
iverilog.c
45
iverilog.c
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: iverilog.c,v 1.18 2000/07/11 23:30:03 steve Exp $"
|
||||
#ident "$Id: iverilog.c,v 1.19 2000/07/29 17:58:20 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
@ -37,6 +37,7 @@
|
|||
#endif
|
||||
|
||||
const char*base = IVL_ROOT;
|
||||
const char*mtm = 0;
|
||||
const char*opath = "a.out";
|
||||
const char*targ = "vvm";
|
||||
const char*start = 0;
|
||||
|
|
@ -72,6 +73,14 @@ static int t_null(char*cmd, unsigned ncmd)
|
|||
ncmd += rc;
|
||||
}
|
||||
|
||||
if (mtm) {
|
||||
sprintf(tmp, " -T%s", mtm);
|
||||
rc = strlen(tmp);
|
||||
cmd = realloc(cmd, ncmd+rc+1);
|
||||
strcpy(cmd+ncmd, tmp);
|
||||
ncmd += rc;
|
||||
}
|
||||
|
||||
if (verbose_flag) {
|
||||
sprintf(tmp, " -v");
|
||||
rc = strlen(tmp);
|
||||
|
|
@ -133,6 +142,14 @@ static int t_vvm(char*cmd, unsigned ncmd)
|
|||
ncmd += rc;
|
||||
}
|
||||
|
||||
if (mtm) {
|
||||
sprintf(tmp, " -T%s", mtm);
|
||||
rc = strlen(tmp);
|
||||
cmd = realloc(cmd, ncmd+rc+1);
|
||||
strcpy(cmd+ncmd, tmp);
|
||||
ncmd += rc;
|
||||
}
|
||||
|
||||
if (start) {
|
||||
sprintf(tmp, " -s%s", start);
|
||||
rc = strlen(tmp);
|
||||
|
|
@ -203,6 +220,14 @@ static int t_xnf(char*cmd, unsigned ncmd)
|
|||
ncmd += rc;
|
||||
}
|
||||
|
||||
if (mtm) {
|
||||
sprintf(tmp, " -T%s", mtm);
|
||||
rc = strlen(tmp);
|
||||
cmd = realloc(cmd, ncmd+rc+1);
|
||||
strcpy(cmd+ncmd, tmp);
|
||||
ncmd += rc;
|
||||
}
|
||||
|
||||
if (start) {
|
||||
sprintf(tmp, " -s%s", start);
|
||||
rc = strlen(tmp);
|
||||
|
|
@ -255,7 +280,7 @@ int main(int argc, char **argv)
|
|||
int opt, idx;
|
||||
char*cp;
|
||||
|
||||
while ((opt = getopt(argc, argv, "B:D:Ef:I:m:o:Ss:t:vW:")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, "B:D:Ef:I:m:o:Ss:T:t:vW:")) != EOF) {
|
||||
|
||||
switch (opt) {
|
||||
case 'B':
|
||||
|
|
@ -325,6 +350,19 @@ int main(int argc, char **argv)
|
|||
case 's':
|
||||
start = optarg;
|
||||
break;
|
||||
case 'T':
|
||||
if (strcmp(optarg,"min") == 0) {
|
||||
mtm = "min";
|
||||
} else if (strcmp(optarg,"typ") == 0) {
|
||||
mtm = "typ";
|
||||
} else if (strcmp(optarg,"max") == 0) {
|
||||
mtm = "max";
|
||||
} else {
|
||||
fprintf(stderr, "%s: invalid -T%s argument\n",
|
||||
argv[0], optarg);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
targ = optarg;
|
||||
break;
|
||||
|
|
@ -422,6 +460,9 @@ int main(int argc, char **argv)
|
|||
|
||||
/*
|
||||
* $Log: iverilog.c,v $
|
||||
* Revision 1.19 2000/07/29 17:58:20 steve
|
||||
* Introduce min:typ:max support.
|
||||
*
|
||||
* Revision 1.18 2000/07/11 23:30:03 steve
|
||||
* More detailed handling of exit status from commands.
|
||||
*
|
||||
|
|
|
|||
11
iverilog.man
11
iverilog.man
|
|
@ -1,10 +1,10 @@
|
|||
.TH iverilog 1 "$Date: 2000/05/17 03:53:29 $" Version "$Date: 2000/05/17 03:53:29 $"
|
||||
.TH iverilog 1 "$Date: 2000/07/29 17:58:20 $" Version "$Date: 2000/07/29 17:58:20 $"
|
||||
.SH NAME
|
||||
iverilog - Icarus Verilog compiler
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B iverilog
|
||||
[-ESv] [-Dmacro[=defn]] [-fflag=value] [-Iincludepath] [-mmodule] [-ooutputfilename] [-s topmodule] [-ttype] [-Wclass] sourcefile[s]
|
||||
[-ESv] [-Dmacro[=defn]] [-fflag=value] [-Iincludepath] [-mmodule] [-ooutputfilename] [-s topmodule] [-ttype] [-Tmin/typ/max] [-Wclass] sourcefile[s]
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
|
|
@ -73,6 +73,13 @@ choose the only module that has no ports. However, this simplistic
|
|||
heuristic is often not sufficient, and sometimes not what is wanted
|
||||
anyhow.
|
||||
.TP 8
|
||||
.B -T\fImin|typ|max\fP
|
||||
Use this switch to select min, typ or max times from min:typ:max
|
||||
expressions. Normally, the compiler will simply use the typ value from
|
||||
these expressions (with a warning) but this switch will tell the
|
||||
compiler explicitly which value to use. This will suppress the
|
||||
warning that the compiler is making a choice.
|
||||
.TP 8
|
||||
.B -t\fItarget\fP
|
||||
Use this switch to specify the target output format. See the
|
||||
\fBTARGETS\fP section below for a list of valid output formats.
|
||||
|
|
|
|||
25
main.cc
25
main.cc
|
|
@ -19,7 +19,7 @@ const char COPYRIGHT[] =
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: main.cc,v 1.35 2000/07/14 06:12:57 steve Exp $"
|
||||
#ident "$Id: main.cc,v 1.36 2000/07/29 17:58:21 steve Exp $"
|
||||
#endif
|
||||
|
||||
const char NOTICE[] =
|
||||
|
|
@ -127,8 +127,10 @@ int main(int argc, char*argv[])
|
|||
queue<net_func> net_func_queue;
|
||||
|
||||
flags["VPI_MODULE_LIST"] = "system";
|
||||
min_typ_max_flag = TYP;
|
||||
min_typ_max_warn = 10;
|
||||
|
||||
while ((opt = getopt(argc, argv, "F:f:hm:N:o:P:s:t:vW:")) != EOF) switch (opt) {
|
||||
while ((opt = getopt(argc, argv, "F:f:hm:N:o:P:s:T:t:vW:")) != EOF) switch (opt) {
|
||||
case 'F': {
|
||||
net_func tmp = name_to_net_func(optarg);
|
||||
if (tmp == 0) {
|
||||
|
|
@ -161,6 +163,22 @@ int main(int argc, char*argv[])
|
|||
case 's':
|
||||
start_module = optarg;
|
||||
break;
|
||||
case 'T':
|
||||
if (strcmp(optarg,"min") == 0) {
|
||||
min_typ_max_flag = MIN;
|
||||
min_typ_max_warn = 0;
|
||||
} else if (strcmp(optarg,"typ") == 0) {
|
||||
min_typ_max_flag = TYP;
|
||||
min_typ_max_warn = 0;
|
||||
} else if (strcmp(optarg,"max") == 0) {
|
||||
min_typ_max_flag = MAX;
|
||||
min_typ_max_warn = 0;
|
||||
} else {
|
||||
cerr << "Invalid argument (" << optarg << ") to -T flag."
|
||||
<< endl;
|
||||
flag_errors += 1;
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
target = optarg;
|
||||
break;
|
||||
|
|
@ -303,6 +321,9 @@ int main(int argc, char*argv[])
|
|||
|
||||
/*
|
||||
* $Log: main.cc,v $
|
||||
* Revision 1.36 2000/07/29 17:58:21 steve
|
||||
* Introduce min:typ:max support.
|
||||
*
|
||||
* Revision 1.35 2000/07/14 06:12:57 steve
|
||||
* Move inital value handling from NetNet to Nexus
|
||||
* objects. This allows better propogation of inital
|
||||
|
|
|
|||
8
parse.y
8
parse.y
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: parse.y,v 1.103 2000/07/26 05:08:07 steve Exp $"
|
||||
#ident "$Id: parse.y,v 1.104 2000/07/29 17:58:21 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "parse_misc.h"
|
||||
|
|
@ -347,11 +347,7 @@ delay_value
|
|||
$$ = tmp;
|
||||
}
|
||||
| expression ':' expression ':' expression
|
||||
{ yyerror(@1, "sorry: (min:typ:max) not supported.");
|
||||
$$ = $3;
|
||||
delete $1;
|
||||
delete $5;
|
||||
}
|
||||
{ $$ = pform_select_mtm_expr($1, $3, $5); }
|
||||
;
|
||||
|
||||
delay_value_list
|
||||
|
|
|
|||
51
pform.cc
51
pform.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: pform.cc,v 1.62 2000/07/22 22:09:04 steve Exp $"
|
||||
#ident "$Id: pform.cc,v 1.63 2000/07/29 17:58:21 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "compiler.h"
|
||||
|
|
@ -137,6 +137,52 @@ bool pform_expression_is_constant(const PExpr*ex)
|
|||
return ex->is_constant(pform_cur_module);
|
||||
}
|
||||
|
||||
MIN_TYP_MAX min_typ_max_flag = TYP;
|
||||
unsigned min_typ_max_warn = 10;
|
||||
|
||||
PExpr* pform_select_mtm_expr(PExpr*min, PExpr*typ, PExpr*max)
|
||||
{
|
||||
PExpr*res = 0;
|
||||
|
||||
switch (min_typ_max_flag) {
|
||||
case MIN:
|
||||
res = min;
|
||||
delete typ;
|
||||
delete max;
|
||||
break;
|
||||
case TYP:
|
||||
res = typ;
|
||||
delete min;
|
||||
delete max;
|
||||
break;
|
||||
case MAX:
|
||||
res = max;
|
||||
delete min;
|
||||
delete max;
|
||||
break;
|
||||
}
|
||||
|
||||
if (min_typ_max_warn > 0) {
|
||||
cerr << res->get_line() << ": warning: choosing ";
|
||||
switch (min_typ_max_flag) {
|
||||
case MIN:
|
||||
cerr << "min";
|
||||
break;
|
||||
case TYP:
|
||||
cerr << "typ";
|
||||
break;
|
||||
case MAX:
|
||||
cerr << "max";
|
||||
break;
|
||||
}
|
||||
|
||||
cerr << " expression." << endl;
|
||||
min_typ_max_warn -= 1;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void pform_make_udp(const char*name, list<string>*parms,
|
||||
svector<PWire*>*decl, list<string>*table,
|
||||
Statement*init_expr)
|
||||
|
|
@ -885,6 +931,9 @@ int pform_parse(const char*path, map<string,Module*>&modules,
|
|||
|
||||
/*
|
||||
* $Log: pform.cc,v $
|
||||
* Revision 1.63 2000/07/29 17:58:21 steve
|
||||
* Introduce min:typ:max support.
|
||||
*
|
||||
* Revision 1.62 2000/07/22 22:09:04 steve
|
||||
* Parse and elaborate timescale to scopes.
|
||||
*
|
||||
|
|
|
|||
14
pform.h
14
pform.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: pform.h,v 1.40 2000/05/08 05:30:20 steve Exp $"
|
||||
#ident "$Id: pform.h,v 1.41 2000/07/29 17:58:21 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "netlist.h"
|
||||
|
|
@ -58,6 +58,15 @@ class PGate;
|
|||
class PExpr;
|
||||
struct vlltype;
|
||||
|
||||
/*
|
||||
* The min:typ:max expression s selected at parse time using the
|
||||
* enumeration. When the compiler makes a choise, it also prints a
|
||||
* warning if min_typ_max_warn > 0.
|
||||
*/
|
||||
extern enum MIN_TYP_MAX { MIN, TYP, MAX } min_typ_max_flag;
|
||||
extern unsigned min_typ_max_warn;
|
||||
PExpr* pform_select_mtm_expr(PExpr*min, PExpr*typ, PExpr*max);
|
||||
|
||||
/*
|
||||
* These type are lexical types -- that is, types that are used as
|
||||
* lexical values to decorate the parse tree during parsing. They are
|
||||
|
|
@ -190,6 +199,9 @@ extern void pform_dump(ostream&out, Module*mod);
|
|||
|
||||
/*
|
||||
* $Log: pform.h,v $
|
||||
* Revision 1.41 2000/07/29 17:58:21 steve
|
||||
* Introduce min:typ:max support.
|
||||
*
|
||||
* Revision 1.40 2000/05/08 05:30:20 steve
|
||||
* Deliver gate output strengths to the netlist.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue