Scope names stored only as basename.

This commit is contained in:
steve 2003-03-03 02:22:41 +00:00
parent 679c9c5bfe
commit 486274cfa1
3 changed files with 54 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: netlist.h,v 1.277 2003/03/01 06:25:30 steve Exp $"
#ident "$Id: netlist.h,v 1.278 2003/03/03 02:22:41 steve Exp $"
#endif
/*
@ -2878,6 +2878,9 @@ class NetScope {
public:
enum TYPE { MODULE, TASK, FUNC, BEGIN_END, FORK_JOIN };
/* Create a new scope, and attach it to the given parent. The
name is expected to have been permallocated. */
NetScope(NetScope*up, const char*name, TYPE t);
~NetScope();
@ -3201,6 +3204,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
* Revision 1.278 2003/03/03 02:22:41 steve
* Scope names stored only as basename.
*
* Revision 1.277 2003/03/01 06:25:30 steve
* Add the lex_strings string handler, and put
* scope names and system task/function names

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: t-dll-api.cc,v 1.91 2003/02/26 01:29:24 steve Exp $"
#ident "$Id: t-dll-api.cc,v 1.92 2003/03/03 02:22:41 steve Exp $"
#endif
# include "config.h"
@ -1101,10 +1101,7 @@ extern "C" const char* ivl_scope_basename(ivl_scope_t net)
{
assert(net);
if (net->parent == 0)
return net->name_;
return basename(net->parent, net->name_);
return net->name_;
}
extern "C" int ivl_scope_children(ivl_scope_t net,
@ -1191,9 +1188,41 @@ extern "C" ivl_memory_t ivl_scope_mem(ivl_scope_t net, unsigned idx)
return net->mem_[idx];
}
static void push_scope_basename(ivl_scope_t net, char*buf)
{
if (net->parent == 0) {
strcpy(buf, net->name_);
return;
}
push_scope_basename(net->parent, buf);
strcat(buf, ".");
strcat(buf, net->name_);
}
extern "C" const char* ivl_scope_name(ivl_scope_t net)
{
return net->name_;
static char*name_buffer = 0;
static unsigned name_size = 0;
if (net->parent == 0)
return net->name_;
ivl_scope_t cur;
unsigned needlen = 0;
for (cur = net ; cur ; cur = cur->parent)
needlen += strlen(cur->name_) + 1;
if (name_size < needlen) {
name_buffer = (char*)realloc(name_buffer, needlen);
name_size = needlen;
}
push_scope_basename(net, name_buffer);
return name_buffer;
}
extern "C" ivl_scope_t ivl_scope_parent(ivl_scope_t net)
@ -1679,6 +1708,9 @@ extern "C" ivl_variable_type_t ivl_variable_type(ivl_variable_t net)
/*
* $Log: t-dll-api.cc,v $
* Revision 1.92 2003/03/03 02:22:41 steve
* Scope names stored only as basename.
*
* Revision 1.91 2003/02/26 01:29:24 steve
* LPM objects store only their base names.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: t-dll.cc,v 1.104 2003/01/30 16:23:08 steve Exp $"
#ident "$Id: t-dll.cc,v 1.105 2003/03/03 02:22:41 steve Exp $"
#endif
# include "config.h"
@ -187,11 +187,11 @@ static ivl_scope_t find_scope_from_root(ivl_scope_t root, const NetScope*cur)
return 0;
for (tmp = parent->child_ ; tmp ; tmp = tmp->sibling_)
if (strcmp(tmp->name_, cur->name().c_str()) == 0)
if (strcmp(tmp->name_, cur->basename()) == 0)
return tmp;
} else {
if (strcmp(root->name_, cur->name().c_str()) == 0)
if (strcmp(root->name_, cur->basename()) == 0)
return root;
}
@ -442,8 +442,8 @@ static void scope_add_var(ivl_scope_t scope, ivl_variable_t net)
void dll_target::add_root(ivl_design_s &des_, const NetScope *s)
{
ivl_scope_t root_ = new struct ivl_scope_s;
const char *name = s->name().c_str();
root_->name_ = strings_.add(name);
const char *name = s->basename();
root_->name_ = name;
root_->child_ = 0;
root_->sibling_ = 0;
root_->parent = 0;
@ -1802,7 +1802,7 @@ void dll_target::scope(const NetScope*net)
} else {
scope = new struct ivl_scope_s;
scope->name_ = strings_.add(net->name().c_str());
scope->name_ = net->basename();
scope->child_ = 0;
scope->sibling_ = 0;
scope->parent = find_scope(des_, net->parent());
@ -1887,16 +1887,6 @@ void dll_target::signal(const NetNet*net)
obj->scope_->sigs_[obj->scope_->nsigs_-1] = obj;
#ifndef NDEBUG
{ size_t name_len = strlen(obj->scope_->name_);
if (0 != strncmp(obj->scope_->name_, obj->name_, name_len)) {
cerr << net->get_line() << ": internal error: "
<< "Malformed name " << obj->name_ << " in "
<< obj->scope_->name_ << endl;
}
assert(0 == strncmp(obj->scope_->name_, obj->name_, name_len));
}
#endif
/* Save the primitive properties of the signal in the
ivl_signal_t object. */
@ -2033,6 +2023,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
/*
* $Log: t-dll.cc,v $
* Revision 1.105 2003/03/03 02:22:41 steve
* Scope names stored only as basename.
*
* Revision 1.104 2003/01/30 16:23:08 steve
* Spelling fixes.
*