Allow specparams as constants in expressions.
This commit is contained in:
parent
b658a3b41f
commit
7e3ea2ffe8
21
elab_expr.cc
21
elab_expr.cc
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999-2005 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 1999-2006 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: elab_expr.cc,v 1.109 2006/09/19 23:00:15 steve Exp $"
|
#ident "$Id: elab_expr.cc,v 1.110 2006/09/28 00:29:49 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -668,6 +668,20 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
// Finally, if this is a scope name, then return that. Look
|
// Finally, if this is a scope name, then return that. Look
|
||||||
// first to see if this is a name of a local scope. Failing
|
// first to see if this is a name of a local scope. Failing
|
||||||
// that, search globally for a hierarchical name.
|
// that, search globally for a hierarchical name.
|
||||||
|
|
@ -1399,6 +1413,9 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: elab_expr.cc,v $
|
* $Log: elab_expr.cc,v $
|
||||||
|
* Revision 1.110 2006/09/28 00:29:49 steve
|
||||||
|
* Allow specparams as constants in expressions.
|
||||||
|
*
|
||||||
* Revision 1.109 2006/09/19 23:00:15 steve
|
* Revision 1.109 2006/09/19 23:00:15 steve
|
||||||
* Use elab_and_eval for bit select expressions.
|
* Use elab_and_eval for bit select expressions.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: netmisc.h,v 1.25 2006/06/02 04:48:50 steve Exp $"
|
#ident "$Id: netmisc.h,v 1.26 2006/09/28 00:29:49 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "netlist.h"
|
# include "netlist.h"
|
||||||
|
|
@ -112,6 +112,9 @@ extern unsigned count_lval_width(const class NetAssign_*first);
|
||||||
* right away. If the expression can be evaluated, this returns a
|
* right away. If the expression can be evaluated, this returns a
|
||||||
* constant expression. If it cannot be evaluated, it returns whatever
|
* constant expression. If it cannot be evaluated, it returns whatever
|
||||||
* it can. If the expression cannot be elaborated, return 0.
|
* it can. If the expression cannot be elaborated, return 0.
|
||||||
|
*
|
||||||
|
* The expr_width is the width of the context where the expression is
|
||||||
|
* being elaborated, or -1 if the expression is self-determinted width.
|
||||||
*/
|
*/
|
||||||
class PExpr;
|
class PExpr;
|
||||||
extern NetExpr* elab_and_eval(Design*des, NetScope*scope,
|
extern NetExpr* elab_and_eval(Design*des, NetScope*scope,
|
||||||
|
|
@ -119,6 +122,9 @@ extern NetExpr* elab_and_eval(Design*des, NetScope*scope,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: netmisc.h,v $
|
* $Log: netmisc.h,v $
|
||||||
|
* Revision 1.26 2006/09/28 00:29:49 steve
|
||||||
|
* Allow specparams as constants in expressions.
|
||||||
|
*
|
||||||
* Revision 1.25 2006/06/02 04:48:50 steve
|
* Revision 1.25 2006/06/02 04:48:50 steve
|
||||||
* Make elaborate_expr methods aware of the width that the context
|
* Make elaborate_expr methods aware of the width that the context
|
||||||
* requires of it. In the process, fix sizing of the width of unary
|
* requires of it. In the process, fix sizing of the width of unary
|
||||||
|
|
|
||||||
35
t-dll.cc
35
t-dll.cc
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: t-dll.cc,v 1.158 2006/09/23 04:57:19 steve Exp $"
|
#ident "$Id: t-dll.cc,v 1.159 2006/09/28 00:29:49 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -2175,20 +2175,30 @@ void dll_target::signal(const NetNet*net)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Collect the delay paths for this signal. */
|
/* Collect the delay paths for this signal. */
|
||||||
obj->npath = net->delay_paths();
|
obj->npath = 0;
|
||||||
if (obj->npath > 0) {
|
if (net->delay_paths() > 0) {
|
||||||
|
/* Figure out how many paths there really are. */
|
||||||
|
for (unsigned idx = 0 ; idx < net->delay_paths() ; idx += 1) {
|
||||||
|
const NetDelaySrc*src = net->delay_path(idx);
|
||||||
|
obj->npath += src->pin_count();
|
||||||
|
}
|
||||||
|
|
||||||
obj->path = new struct ivl_delaypath_s[obj->npath];
|
obj->path = new struct ivl_delaypath_s[obj->npath];
|
||||||
|
|
||||||
for (unsigned idx = 0 ; idx < obj->npath ; idx += 1) {
|
unsigned ptr = 0;
|
||||||
|
for (unsigned idx = 0 ; idx < net->delay_paths() ; idx += 1) {
|
||||||
const NetDelaySrc*src = net->delay_path(idx);
|
const NetDelaySrc*src = net->delay_path(idx);
|
||||||
// For now, only handle single-source paths.
|
|
||||||
assert(src->pin_count() == 1);
|
|
||||||
const Nexus*nex = src->pin(0).nexus();
|
|
||||||
assert(nex->t_cookie());
|
|
||||||
obj->path[idx].src = (ivl_nexus_t) nex->t_cookie();
|
|
||||||
|
|
||||||
for (unsigned pe = 0 ; pe < 12 ; pe += 1) {
|
for (unsigned pin = 0; pin < src->pin_count(); pin += 1) {
|
||||||
obj->path[idx].delay[pe] = src->get_delay(pe);
|
const Nexus*nex = src->pin(pin).nexus();
|
||||||
|
assert(nex->t_cookie());
|
||||||
|
obj->path[ptr].src = (ivl_nexus_t) nex->t_cookie();
|
||||||
|
|
||||||
|
for (unsigned pe = 0 ; pe < 12 ; pe += 1) {
|
||||||
|
obj->path[ptr].delay[pe] = src->get_delay(pe);
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2229,6 +2239,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: t-dll.cc,v $
|
* $Log: t-dll.cc,v $
|
||||||
|
* Revision 1.159 2006/09/28 00:29:49 steve
|
||||||
|
* Allow specparams as constants in expressions.
|
||||||
|
*
|
||||||
* Revision 1.158 2006/09/23 04:57:19 steve
|
* Revision 1.158 2006/09/23 04:57:19 steve
|
||||||
* Basic support for specify timing.
|
* Basic support for specify timing.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue