Properly manage real variables in subscopes.
This commit is contained in:
parent
b43c543455
commit
3ef65d1298
7
Module.h
7
Module.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: Module.h,v 1.30 2003/03/06 04:37:12 steve Exp $"
|
||||
#ident "$Id: Module.h,v 1.31 2003/06/13 19:10:45 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <list>
|
||||
|
|
@ -107,7 +107,7 @@ class Module : public LineInfo {
|
|||
map<string,PEvent*>events;
|
||||
|
||||
/* Keep a table of datum variables declared in the module. */
|
||||
map<string,PData*>datum;
|
||||
map<hname_t,PData*>datum;
|
||||
|
||||
/* These are the timescale for this module. The default is
|
||||
set by the `timescale directive. */
|
||||
|
|
@ -163,6 +163,9 @@ class Module : public LineInfo {
|
|||
|
||||
/*
|
||||
* $Log: Module.h,v $
|
||||
* Revision 1.31 2003/06/13 19:10:45 steve
|
||||
* Properly manage real variables in subscopes.
|
||||
*
|
||||
* Revision 1.30 2003/03/06 04:37:12 steve
|
||||
* lex_strings.add module names earlier.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: elab_scope.cc,v 1.21 2003/05/30 02:55:32 steve Exp $"
|
||||
#ident "$Id: elab_scope.cc,v 1.22 2003/06/13 19:10:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -221,7 +221,7 @@ bool Module::elaborate_scope(Design*des, NetScope*scope) const
|
|||
(*et).second->elaborate_scope(des, scope);
|
||||
}
|
||||
|
||||
for (map<string,PData*>::const_iterator cur = datum.begin()
|
||||
for (map<hname_t,PData*>::const_iterator cur = datum.begin()
|
||||
; cur != datum.end() ; cur ++ ) {
|
||||
|
||||
(*cur).second->elaborate_scope(des, scope);
|
||||
|
|
@ -351,13 +351,32 @@ void PGModule::elaborate_scope_mod_(Design*des, Module*mod, NetScope*sc) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Elaborate the datum within the module. This variable make be
|
||||
* within a subscope (i.e. a function or task) so use the components
|
||||
* of the name to find the precise scope where this item goes.
|
||||
*/
|
||||
void PData::elaborate_scope(Design*des, NetScope*scope) const
|
||||
{
|
||||
assert(hname_.component_count() == 1);
|
||||
NetScope*sub_scope = scope;
|
||||
for (unsigned idx = 0 ; idx < (hname_.component_count()-1); idx += 1) {
|
||||
sub_scope = sub_scope->child(hname_.peek_name(idx));
|
||||
|
||||
if (sub_scope == 0) {
|
||||
cerr << get_line() << ": internal error: "
|
||||
<< "Could not find sub-scope "
|
||||
<< hname_.peek_name(idx) << " of "
|
||||
<< hname_ << " in module " << scope->name()
|
||||
<< endl;
|
||||
des->errors += 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const char*basename = hname_.peek_tail_name();
|
||||
NetVariable*tmp = new NetVariable(lex_strings.add(basename));
|
||||
tmp->set_line(*this);
|
||||
scope->add_variable(tmp);
|
||||
sub_scope->add_variable(tmp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -515,6 +534,9 @@ void PWhile::elaborate_scope(Design*des, NetScope*scope) const
|
|||
|
||||
/*
|
||||
* $Log: elab_scope.cc,v $
|
||||
* Revision 1.22 2003/06/13 19:10:46 steve
|
||||
* Properly manage real variables in subscopes.
|
||||
*
|
||||
* Revision 1.21 2003/05/30 02:55:32 steve
|
||||
* Support parameters in real expressions and
|
||||
* as real expressions, and fix multiply and
|
||||
|
|
|
|||
10
pform.cc
10
pform.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: pform.cc,v 1.114 2003/06/13 00:27:09 steve Exp $"
|
||||
#ident "$Id: pform.cc,v 1.115 2003/06/13 19:10:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -610,10 +610,11 @@ void pform_make_events(list<char*>*names, const char*fn, unsigned ln)
|
|||
|
||||
static void pform_make_datum(const char*name, const char*fn, unsigned ln)
|
||||
{
|
||||
PData*datum = new PData(hname_t(name));
|
||||
hname_t hname = hier_name(name);
|
||||
PData*datum = new PData(hname);
|
||||
datum->set_file(fn);
|
||||
datum->set_lineno(ln);
|
||||
pform_cur_module->datum[name] = datum;
|
||||
pform_cur_module->datum[hname] = datum;
|
||||
}
|
||||
|
||||
void pform_make_reals(list<char*>*names, const char*fn, unsigned ln)
|
||||
|
|
@ -1469,6 +1470,9 @@ int pform_parse(const char*path, FILE*file)
|
|||
|
||||
/*
|
||||
* $Log: pform.cc,v $
|
||||
* Revision 1.115 2003/06/13 19:10:46 steve
|
||||
* Properly manage real variables in subscopes.
|
||||
*
|
||||
* Revision 1.114 2003/06/13 00:27:09 steve
|
||||
* Task/functions can have signed ports.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: pform_dump.cc,v 1.79 2003/02/27 06:45:11 steve Exp $"
|
||||
#ident "$Id: pform_dump.cc,v 1.80 2003/06/13 19:10:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -761,7 +761,7 @@ void Module::dump(ostream&out) const
|
|||
<< ev->get_line() << endl;
|
||||
}
|
||||
|
||||
for (map<string,PData*>::const_iterator cur = datum.begin()
|
||||
for (map<hname_t,PData*>::const_iterator cur = datum.begin()
|
||||
; cur != datum.end() ; cur ++ ) {
|
||||
PData*tmp = (*cur).second;
|
||||
out << " real " << tmp->name() << "; // "
|
||||
|
|
@ -863,6 +863,9 @@ void PUdp::dump(ostream&out) const
|
|||
|
||||
/*
|
||||
* $Log: pform_dump.cc,v $
|
||||
* Revision 1.80 2003/06/13 19:10:46 steve
|
||||
* Properly manage real variables in subscopes.
|
||||
*
|
||||
* Revision 1.79 2003/02/27 06:45:11 steve
|
||||
* specparams as far as pform.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue