Rearrange task and function elaboration so that the

NetTaskDef and NetFuncDef functions are created during
 signal enaboration, and carry these objects in the
 NetScope class instead of the extra, useless map in
 the Design class.
This commit is contained in:
steve 2000-07-30 18:25:43 +00:00
parent 30a81731dd
commit 0243fca8dc
9 changed files with 342 additions and 228 deletions

24
PTask.h
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PTask.h,v 1.8 2000/03/08 04:36:53 steve Exp $"
#ident "$Id: PTask.h,v 1.9 2000/07/30 18:25:43 steve Exp $"
#endif
# include "LineInfo.h"
@ -45,8 +45,11 @@ class PTask : public LineInfo {
// I need to.
void elaborate_scope(Design*des, NetScope*scope) const;
void elaborate_1(Design*des, const string&path) const;
void elaborate_2(Design*des, const string&path) const;
// Bind the ports to the regs that are the ports.
void elaborate_sig(Design*des, NetScope*scope) const;
// Elaborate the statement to finish off the task definition.
void elaborate(Design*des, const string&path) const;
void dump(ostream&, unsigned) const;
@ -74,9 +77,11 @@ class PFunction : public LineInfo {
void elaborate_scope(Design*des, NetScope*scope) const;
/* Functions are elaborated in 2 passes. */
void elaborate_1(Design *des, NetScope*) const;
void elaborate_2(Design *des, NetScope*) const;
/* elaborate the ports and return value. */
void elaborate_sig(Design *des, NetScope*) const;
/* Elaborate the behavioral statement. */
void elaborate(Design *des, NetScope*) const;
void dump(ostream&, unsigned) const;
@ -88,6 +93,13 @@ class PFunction : public LineInfo {
/*
* $Log: PTask.h,v $
* Revision 1.9 2000/07/30 18:25:43 steve
* Rearrange task and function elaboration so that the
* NetTaskDef and NetFuncDef functions are created during
* signal enaboration, and carry these objects in the
* NetScope class instead of the extra, useless map in
* the Design class.
*
* Revision 1.8 2000/03/08 04:36:53 steve
* Redesign the implementation of scopes and parameters.
* I now generate the scopes and notice the parameters

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: design_dump.cc,v 1.93 2000/07/29 03:55:38 steve Exp $"
#ident "$Id: design_dump.cc,v 1.94 2000/07/30 18:25:43 steve Exp $"
#endif
/*
@ -738,6 +738,15 @@ void NetScope::dump(ostream&o) const
} while (cur != memories_->snext_);
}
switch (type_) {
case FUNC:
func_def()->dump(o, 4);
break;
case TASK:
task_def()->dump(o, 4);
break;
}
/* Dump any sub-scopes. */
for (NetScope*cur = sub_ ; cur ; cur = cur->sib_)
cur->dump(o);
@ -948,24 +957,6 @@ void Design::dump(ostream&o) const
o << "SCOPES:" << endl;
root_scope_->dump(o);
o << "ELABORATED FUNCTION DEFINITIONS:" << endl;
{
map<string,NetFuncDef*>::const_iterator pp;
for (pp = funcs_.begin()
; pp != funcs_.end() ; pp ++) {
(*pp).second->dump(o, 0);
}
}
o << "ELABORATED TASK DEFINITIONS:" << endl;
{
map<string,NetTaskDef*>::const_iterator pp;
for (pp = tasks_.begin()
; pp != tasks_.end() ; pp ++) {
(*pp).second->dump(o, 0);
}
}
o << "ELABORATED NODES:" << endl;
// dump the nodes,
@ -987,6 +978,13 @@ void Design::dump(ostream&o) const
/*
* $Log: design_dump.cc,v $
* Revision 1.94 2000/07/30 18:25:43 steve
* Rearrange task and function elaboration so that the
* NetTaskDef and NetFuncDef functions are created during
* signal enaboration, and carry these objects in the
* NetScope class instead of the extra, useless map in
* the Design class.
*
* Revision 1.93 2000/07/29 03:55:38 steve
* fix problem coalescing events w/ probes.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_scope.cc,v 1.5 2000/07/22 22:09:03 steve Exp $"
#ident "$Id: elab_scope.cc,v 1.6 2000/07/30 18:25:43 steve Exp $"
#endif
/*
@ -32,6 +32,7 @@
# include "PExpr.h"
# include "PGate.h"
# include "PTask.h"
# include "PWire.h"
# include "Statement.h"
# include "netlist.h"
# include <typeinfo>
@ -287,6 +288,7 @@ void PFunction::elaborate_scope(Design*des, NetScope*scope) const
void PTask::elaborate_scope(Design*des, NetScope*scope) const
{
assert(scope->type() == NetScope::TASK);
}
@ -418,6 +420,13 @@ void PWhile::elaborate_scope(Design*des, NetScope*scope) const
/*
* $Log: elab_scope.cc,v $
* Revision 1.6 2000/07/30 18:25:43 steve
* Rearrange task and function elaboration so that the
* NetTaskDef and NetFuncDef functions are created during
* signal enaboration, and carry these objects in the
* NetScope class instead of the extra, useless map in
* the Design class.
*
* Revision 1.5 2000/07/22 22:09:03 steve
* Parse and elaborate timescale to scopes.
*

View File

@ -17,12 +17,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_sig.cc,v 1.2 2000/07/14 06:12:57 steve Exp $"
#ident "$Id: elab_sig.cc,v 1.3 2000/07/30 18:25:43 steve Exp $"
#endif
# include "Module.h"
# include "PExpr.h"
# include "PGate.h"
# include "PTask.h"
# include "PWire.h"
# include "netlist.h"
# include "util.h"
@ -57,6 +58,37 @@ bool Module::elaborate_sig(Design*des, NetScope*scope) const
flag &= (*gt)->elaborate_sig(des, scope);
}
typedef map<string,PFunction*>::const_iterator mfunc_it_t;
for (mfunc_it_t cur = funcs_.begin()
; cur != funcs_.end() ; cur ++) {
NetScope*fscope = scope->child((*cur).first);
if (scope == 0) {
cerr << (*cur).second->get_line() << ": internal error: "
<< "Child scope for function " << (*cur).first
<< " missing in " << scope->name() << "." << endl;
des->errors += 1;
continue;
}
(*cur).second->elaborate_sig(des, fscope);
}
// After all the wires are elaborated, we are free to
// elaborate the ports of the tasks defined within this
// module. Run through them now.
typedef map<string,PTask*>::const_iterator mtask_it_t;
for (mtask_it_t cur = tasks_.begin()
; cur != tasks_.end() ; cur ++) {
NetScope*tscope = scope->child((*cur).first);
assert(tscope);
(*cur).second->elaborate_sig(des, tscope);
}
return flag;
}
@ -82,6 +114,115 @@ bool PGModule::elaborate_sig_mod_(Design*des, NetScope*scope,
return rmod->elaborate_sig(des, my_scope);
}
/*
* A function definition exists within an elaborated module.
*/
void PFunction::elaborate_sig(Design*des, NetScope*scope) const
{
string fname = scope->basename();
assert(scope->type() == NetScope::FUNC);
svector<NetNet*>ports (ports_? ports_->count()+1 : 1);
/* Get the reg for the return value. I know the name of the
reg variable, and I know that it is in this scope, so look
it up directly. */
ports[0] = scope->find_signal(scope->basename());
if (ports[0] == 0) {
cerr << get_line() << ": internal error: function scope "
<< scope->name() << " is missing return reg "
<< fname << "." << endl;
scope->dump(cerr);
des->errors += 1;
return;
}
for (unsigned idx = 0 ; idx < ports_->count() ; idx += 1) {
/* Parse the port name into the task name and the reg
name. We know by design that the port name is given
as two components: <func>.<port>. */
string pname = (*ports_)[idx]->name();
string ppath = parse_first_name(pname);
if (ppath != scope->basename()) {
cerr << get_line() << ": internal error: function "
<< "port " << (*ports_)[idx]->name()
<< " has wrong name for function "
<< scope->name() << "." << endl;
des->errors += 1;
}
NetNet*tmp = scope->find_signal(pname);
if (tmp == 0) {
cerr << get_line() << ": internal error: function "
<< scope->name() << " is missing port "
<< pname << "." << endl;
scope->dump(cerr);
des->errors += 1;
}
ports[idx+1] = tmp;
}
NetFuncDef*def = new NetFuncDef(scope, ports);
scope->set_func_def(def);
}
/*
* A task definition is a scope within an elaborated module. When we
* are elaborating signals, the scopes have already been created, as
* have the reg objects that are the parameters of this task. The
* elaborate_sig method of PTask is therefore left to connect the
* signals to the ports of the NetTaskDef definition. We know for
* certain that signals exist (They are in my scope!) so the port
* binding is sure to work.
*/
void PTask::elaborate_sig(Design*des, NetScope*scope) const
{
assert(scope->type() == NetScope::TASK);
svector<NetNet*>ports (ports_? ports_->count() : 0);
for (unsigned idx = 0 ; idx < ports.count() ; idx += 1) {
/* Parse the port name into the task name and the reg
name. We know by design that the port name is given
as two components: <task>.<port>. */
string pname = (*ports_)[idx]->name();
string ppath = parse_first_name(pname);
assert(pname != "");
/* check that the current scope really does have the
name of the first component of the task port name. Do
this by looking up the task scope in the parent of
the current scope. */
if (scope->parent()->child(ppath) != scope) {
cerr << "internal error: task scope " << ppath
<< " not the same as scope " << scope->name()
<< "?!" << endl;
return;
}
/* Find the signal for the port. We know by definition
that it is in the scope of the task, so look only in
the scope. */
NetNet*tmp = scope->find_signal(pname);
if (tmp == 0) {
cerr << get_line() << ": internal error: "
<< "Could not find port " << pname
<< " in scope " << scope->name() << endl;
scope->dump(cerr);
}
ports[idx] = tmp;
}
NetTaskDef*def = new NetTaskDef(scope->name(), ports);
scope->set_task_def(def);
}
bool PGate::elaborate_sig(Design*des, NetScope*scope) const
{
@ -211,6 +352,13 @@ void PWire::elaborate_sig(Design*des, NetScope*scope) const
/*
* $Log: elab_sig.cc,v $
* Revision 1.3 2000/07/30 18:25:43 steve
* Rearrange task and function elaboration so that the
* NetTaskDef and NetFuncDef functions are created during
* signal enaboration, and carry these objects in the
* NetScope class instead of the extra, useless map in
* the Design class.
*
* Revision 1.2 2000/07/14 06:12:57 steve
* Move inital value handling from NetNet to Nexus
* objects. This allows better propogation of inital

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elaborate.cc,v 1.181 2000/07/27 05:13:44 steve Exp $"
#ident "$Id: elaborate.cc,v 1.182 2000/07/30 18:25:43 steve Exp $"
#endif
/*
@ -2087,59 +2087,8 @@ NetProc* PForStatement::elaborate(Design*des, const string&path) const
* output parameter that is the return value. The return value goes
* into port 0, and the parameters are all the remaining ports.
*/
void PFunction::elaborate_1(Design*des, NetScope*scope) const
{
string fname = scope->basename();
svector<NetNet*>ports (ports_? ports_->count()+1 : 1);
/* Get the reg for the return value. I know the name of the
reg variable, and I know that it is in this scope, so look
it up directly. */
ports[0] = scope->find_signal(scope->basename());
if (ports[0] == 0) {
cerr << get_line() << ": internal error: function scope "
<< scope->name() << " is missing return reg "
<< fname << "." << endl;
scope->dump(cerr);
des->errors += 1;
return;
}
for (unsigned idx = 0 ; idx < ports_->count() ; idx += 1) {
/* Parse the port name into the task name and the reg
name. We know by design that the port name is given
as two components: <func>.<port>. */
string pname = (*ports_)[idx]->name();
string ppath = parse_first_name(pname);
if (ppath != scope->basename()) {
cerr << get_line() << ": internal error: function "
<< "port " << (*ports_)[idx]->name()
<< " has wrong name for function "
<< scope->name() << "." << endl;
des->errors += 1;
}
NetNet*tmp = scope->find_signal(pname);
if (tmp == 0) {
cerr << get_line() << ": internal error: function "
<< scope->name() << " is missing port "
<< pname << "." << endl;
scope->dump(cerr);
des->errors += 1;
}
ports[idx+1] = tmp;
}
NetFuncDef*def = new NetFuncDef(scope, ports);
des->add_function(scope->name(), def);
}
void PFunction::elaborate_2(Design*des, NetScope*scope) const
void PFunction::elaborate(Design*des, NetScope*scope) const
{
NetFuncDef*def = des->find_function(scope->name());
assert(def);
@ -2228,7 +2177,9 @@ NetProc* PRepeat::elaborate(Design*des, const string&path) const
*
* So in the foo example, the PWire objects that represent the ports
* of the task will include a foo.blah for the blah port. This port is
* bound to a NetNet object by looking up the name.
* bound to a NetNet object by looking up the name. All of this is
* handled by the PTask::elaborate_sig method and the results stashed
* in the created NetDaskDef attached to the scope.
*
* Elaboration pass 2 for the task definition causes the statement of
* the task to be elaborated and attached to the NetTaskDef object
@ -2238,49 +2189,8 @@ NetProc* PRepeat::elaborate(Design*des, const string&path) const
* port name when making the port list. It is not really useful, but
* that is what I did in pform_make_task_ports, so there it is.
*/
void PTask::elaborate_1(Design*des, const string&path) const
{
NetScope*scope = des->find_scope(path);
assert(scope);
svector<NetNet*>ports (ports_? ports_->count() : 0);
for (unsigned idx = 0 ; idx < ports.count() ; idx += 1) {
/* Parse the port name into the task name and the reg
name. We know by design that the port name is given
as two components: <task>.<port>. */
string pname = (*ports_)[idx]->name();
string ppath = parse_first_name(pname);
assert(pname != "");
/* check that the current scope really does have the
name of the first component of the task port name. Do
this by looking up the task scope in the parent of
the current scope. */
if (scope->parent()->child(ppath) != scope) {
cerr << "internal error: task scope " << ppath
<< " not the same as scope " << scope->name()
<< "?!" << endl;
return;
}
NetNet*tmp = scope->find_signal(pname);
if (tmp == 0) {
cerr << get_line() << ": internal error: "
<< "Could not find port " << pname
<< " in scope " << scope->name() << endl;
scope->dump(cerr);
}
ports[idx] = tmp;
}
NetTaskDef*def = new NetTaskDef(path, ports);
des->add_task(path, def);
}
void PTask::elaborate_2(Design*des, const string&path) const
void PTask::elaborate(Design*des, const string&path) const
{
NetTaskDef*def = des->find_task(path);
assert(def);
@ -2344,59 +2254,25 @@ bool Module::elaborate(Design*des, NetScope*scope) const
const string path = scope->name();
bool result_flag = true;
#if 0
// Get all the explicitly declared wires of the module and
// start the signals list with them.
const map<string,PWire*>&wl = get_wires();
for (map<string,PWire*>::const_iterator wt = wl.begin()
; wt != wl.end()
; wt ++ ) {
(*wt).second->elaborate(des, scope);
}
#endif
// Elaborate functions.
typedef map<string,PFunction*>::const_iterator mfunc_it_t;
for (mfunc_it_t cur = funcs_.begin()
; cur != funcs_.end() ; cur ++) {
NetScope*fscope = scope->child((*cur).first);
if (scope == 0) {
cerr << (*cur).second->get_line() << ": internal error: "
<< "Child scope for function " << (*cur).first
<< " missing in " << scope->name() << "." << endl;
des->errors += 1;
continue;
}
(*cur).second->elaborate_1(des, fscope);
}
for (mfunc_it_t cur = funcs_.begin()
; cur != funcs_.end() ; cur ++) {
NetScope*fscope = scope->child((*cur).first);
assert(fscope);
(*cur).second->elaborate_2(des, fscope);
(*cur).second->elaborate(des, fscope);
}
// Elaborate the task definitions. This is done before the
// behaviors so that task calls may reference these, and after
// the signals so that the tasks can reference them.
typedef map<string,PTask*>::const_iterator mtask_it_t;
for (mtask_it_t cur = tasks_.begin()
; cur != tasks_.end() ; cur ++) {
string pname = path + "." + (*cur).first;
(*cur).second->elaborate_1(des, pname);
}
for (mtask_it_t cur = tasks_.begin()
; cur != tasks_.end() ; cur ++) {
string pname = path + "." + (*cur).first;
(*cur).second->elaborate_2(des, pname);
(*cur).second->elaborate(des, pname);
}
// Get all the gates of the module and elaborate them by
@ -2514,6 +2390,13 @@ Design* elaborate(const map<string,Module*>&modules,
/*
* $Log: elaborate.cc,v $
* Revision 1.182 2000/07/30 18:25:43 steve
* Rearrange task and function elaboration so that the
* NetTaskDef and NetFuncDef functions are created during
* signal enaboration, and carry these objects in the
* NetScope class instead of the extra, useless map in
* the Design class.
*
* Revision 1.181 2000/07/27 05:13:44 steve
* Support elaboration of disable statements.
*

44
emit.cc
View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: emit.cc,v 1.47 2000/07/29 16:21:08 steve Exp $"
#ident "$Id: emit.cc,v 1.48 2000/07/30 18:25:43 steve Exp $"
#endif
/*
@ -327,6 +327,25 @@ void NetScope::emit_scope(ostream&o, struct target_t*tgt) const
}
}
void NetScope::emit_defs(ostream&o, struct target_t*tgt) const
{
switch (type_) {
case MODULE:
for (NetScope*cur = sub_ ; cur ; cur = cur->sib_)
cur->emit_defs(o, tgt);
break;
case FUNC:
tgt->func_def(o, this->func_def());
break;
case TASK:
tgt->task_def(o, this->task_def());
break;
}
}
void NetWhile::emit_proc_recurse(ostream&o, struct target_t*tgt) const
{
proc_->emit_proc(o, tgt);
@ -351,21 +370,9 @@ bool Design::emit(ostream&o, struct target_t*tgt) const
}
// emit function definitions
{
map<string,NetFuncDef*>::const_iterator ta;
for (ta = funcs_.begin() ; ta != funcs_.end() ; ta ++) {
tgt->func_def(o, (*ta).second);
}
}
// emit task and function definitions
root_scope_->emit_defs(o, tgt);
// emit task definitions
{
map<string,NetTaskDef*>::const_iterator ta;
for (ta = tasks_.begin() ; ta != tasks_.end() ; ta ++) {
tgt->task_def(o, (*ta).second);
}
}
// emit the processes
for (const NetProcTop*idx = procs_ ; idx ; idx = idx->next_)
@ -454,6 +461,13 @@ bool emit(ostream&o, const Design*des, const char*type)
/*
* $Log: emit.cc,v $
* Revision 1.48 2000/07/30 18:25:43 steve
* Rearrange task and function elaboration so that the
* NetTaskDef and NetFuncDef functions are created during
* signal enaboration, and carry these objects in the
* NetScope class instead of the extra, useless map in
* the Design class.
*
* Revision 1.47 2000/07/29 16:21:08 steve
* Report code generation errors through proc_delay.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: net_design.cc,v 1.12 2000/07/23 02:41:32 steve Exp $"
#ident "$Id: net_design.cc,v 1.13 2000/07/30 18:25:43 steve Exp $"
#endif
/*
@ -370,69 +370,44 @@ void Design::find_symbol(NetScope*scope, const string&name,
}
}
void Design::add_function(const string&key, NetFuncDef*def)
{
funcs_[key] = def;
}
NetFuncDef* Design::find_function(const string&path, const string&name)
{
string root = path;
for (;;) {
string key = root + "." + name;
map<string,NetFuncDef*>::const_iterator cur = funcs_.find(key);
if (cur != funcs_.end())
return (*cur).second;
unsigned pos = root.rfind('.');
if (pos > root.length())
break;
root = root.substr(0, pos);
}
NetScope*scope = find_scope(path);
assert(scope);
NetScope*func = find_scope(scope, name);
if (func->type() == NetScope::FUNC)
return func->func_def();
return 0;
}
NetFuncDef* Design::find_function(const string&key)
{
map<string,NetFuncDef*>::const_iterator cur = funcs_.find(key);
if (cur != funcs_.end())
return (*cur).second;
return 0;
}
NetScope*func = find_scope(key);
if (func && (func->type() == NetScope::FUNC))
return func->func_def();
void Design::add_task(const string&key, NetTaskDef*def)
{
tasks_[key] = def;
return 0;
}
NetTaskDef* Design::find_task(const string&path, const string&name)
{
string root = path;
for (;;) {
string key = root + "." + name;
map<string,NetTaskDef*>::const_iterator cur = tasks_.find(key);
if (cur != tasks_.end())
return (*cur).second;
unsigned pos = root.rfind('.');
if (pos > root.length())
break;
root = root.substr(0, pos);
}
NetScope*scope = find_scope(path);
assert(scope);
NetScope*task = find_scope(scope, name);
if (task->type() == NetScope::TASK)
return task->task_def();
return 0;
}
NetTaskDef* Design::find_task(const string&key)
{
map<string,NetTaskDef*>::const_iterator cur = tasks_.find(key);
if (cur == tasks_.end())
return 0;
NetScope*task = find_scope(key);
if (task && (task->type() == NetScope::TASK))
return task->task_def();
return (*cur).second;
return 0;
}
void Design::add_node(NetNode*net)
@ -497,6 +472,13 @@ void Design::delete_process(NetProcTop*top)
/*
* $Log: net_design.cc,v $
* Revision 1.13 2000/07/30 18:25:43 steve
* Rearrange task and function elaboration so that the
* NetTaskDef and NetFuncDef functions are created during
* signal enaboration, and carry these objects in the
* NetScope class instead of the extra, useless map in
* the Design class.
*
* Revision 1.12 2000/07/23 02:41:32 steve
* Excessive assert.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: net_scope.cc,v 1.7 2000/07/22 22:09:03 steve Exp $"
#ident "$Id: net_scope.cc,v 1.8 2000/07/30 18:25:44 steve Exp $"
#endif
# include "netlist.h"
@ -50,6 +50,15 @@ NetScope::NetScope(NetScope*up, const string&n, NetScope::TYPE t)
time_prec_ = up->time_precision();
sib_ = up_->sub_;
up_->sub_ = this;
switch (t) {
case NetScope::TASK:
task_ = 0;
break;
case NetScope::FUNC:
func_ = 0;
break;
}
}
NetScope::~NetScope()
@ -95,6 +104,44 @@ NetScope::TYPE NetScope::type() const
return type_;
}
void NetScope::set_task_def(NetTaskDef*def)
{
assert( type_ == TASK );
assert( task_ == 0 );
task_ = def;
}
NetTaskDef* NetScope::task_def()
{
assert( type_ == TASK );
return task_;
}
const NetTaskDef* NetScope::task_def() const
{
assert( type_ == TASK );
return task_;
}
void NetScope::set_func_def(NetFuncDef*def)
{
assert( type_ == FUNC );
assert( func_ == 0 );
func_ = def;
}
NetFuncDef* NetScope::func_def()
{
assert( type_ == FUNC );
return func_;
}
const NetFuncDef* NetScope::func_def() const
{
assert( type_ == FUNC );
return func_;
}
void NetScope::time_unit(int val)
{
time_unit_ = val;
@ -303,6 +350,13 @@ string NetScope::local_symbol()
/*
* $Log: net_scope.cc,v $
* Revision 1.8 2000/07/30 18:25:44 steve
* Rearrange task and function elaboration so that the
* NetTaskDef and NetFuncDef functions are created during
* signal enaboration, and carry these objects in the
* NetScope class instead of the extra, useless map in
* the Design class.
*
* Revision 1.7 2000/07/22 22:09:03 steve
* Parse and elaborate timescale to scopes.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: netlist.h,v 1.150 2000/07/29 16:21:08 steve Exp $"
#ident "$Id: netlist.h,v 1.151 2000/07/30 18:25:44 steve Exp $"
#endif
/*
@ -2489,6 +2489,15 @@ class NetScope {
TYPE type() const;
void set_task_def(NetTaskDef*);
void set_func_def(NetFuncDef*);
NetTaskDef* task_def();
NetFuncDef* func_def();
const NetTaskDef* task_def() const;
const NetFuncDef* func_def() const;
/* Scopes have their own time units and time precision. The
unit and precision are given as power of 10, i.e. -3 is
units of milliseconds.
@ -2518,6 +2527,7 @@ class NetScope {
void dump(ostream&) const;
void emit_scope(ostream&o, struct target_t*tgt) const;
void emit_defs(ostream&o, struct target_t*tgt) const;
/* This method runs the functor on me. Recurse through the
children of this node as well. */
@ -2543,6 +2553,11 @@ class NetScope {
NetNet *signals_;
NetMemory*memories_;
union {
NetTaskDef*task_;
NetFuncDef*func_;
};
NetScope*up_;
NetScope*sib_;
NetScope*sub_;
@ -2621,12 +2636,10 @@ class Design {
NetNet*&sig, NetMemory*&mem);
// Functions
void add_function(const string&n, NetFuncDef*);
NetFuncDef* find_function(const string&path, const string&key);
NetFuncDef* find_function(const string&path);
// Tasks
void add_task(const string&n, NetTaskDef*);
NetTaskDef* find_task(const string&path, const string&name);
NetTaskDef* find_task(const string&key);
@ -2655,12 +2668,6 @@ class Design {
// tree and per-hop searches for me.
NetScope*root_scope_;
// List the function definitions in the design.
map<string,NetFuncDef*> funcs_;
// List the task definitions in the design.
map<string,NetTaskDef*> tasks_;
// List the nodes in the design
NetNode*nodes_;
@ -2719,6 +2726,13 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
* Revision 1.151 2000/07/30 18:25:44 steve
* Rearrange task and function elaboration so that the
* NetTaskDef and NetFuncDef functions are created during
* signal enaboration, and carry these objects in the
* NetScope class instead of the extra, useless map in
* the Design class.
*
* Revision 1.150 2000/07/29 16:21:08 steve
* Report code generation errors through proc_delay.
*