diff --git a/elab_net.cc b/elab_net.cc index 21ef61d1e..8a8aa8a66 100644 --- a/elab_net.cc +++ b/elab_net.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: elab_net.cc,v 1.93 2002/07/05 21:26:17 steve Exp $" +#ident "$Id: elab_net.cc,v 1.94 2002/08/05 04:18:45 steve Exp $" #endif # include "config.h" @@ -1372,15 +1372,19 @@ NetNet* PEIdent::elaborate_net_ram_(Design*des, NetScope*scope, if (adr == 0) return 0; + // Memory names are only the base names. Since NetObj names + // are still fullnames, and we are deriving such names from + // the memory name, make a fullname here. + string hname = scope->name() + "." + mem->name(); - NetRamDq*ram = new NetRamDq(scope, des->local_symbol(mem->name()), + NetRamDq*ram = new NetRamDq(scope, des->local_symbol(hname), mem, adr->pin_count()); des->add_node(ram); for (unsigned idx = 0 ; idx < adr->pin_count() ; idx += 1) connect(ram->pin_Address(idx), adr->pin(idx)); - NetNet*osig = new NetNet(scope, des->local_symbol(mem->name()), + NetNet*osig = new NetNet(scope, des->local_symbol(hname), NetNet::IMPLICIT, ram->width()); osig->local_flag(true); @@ -2122,6 +2126,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope, /* * $Log: elab_net.cc,v $ + * Revision 1.94 2002/08/05 04:18:45 steve + * Store only the base name of memories. + * * Revision 1.93 2002/07/05 21:26:17 steve * Avoid emitting to vvp local net symbols. * diff --git a/elab_sig.cc b/elab_sig.cc index fd7cdcc48..cd101a463 100644 --- a/elab_sig.cc +++ b/elab_sig.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: elab_sig.cc,v 1.23 2002/06/21 04:59:35 steve Exp $" +#ident "$Id: elab_sig.cc,v 1.24 2002/08/05 04:18:45 steve Exp $" #endif # include "config.h" @@ -498,8 +498,7 @@ void PWire::elaborate_sig(Design*des, NetScope*scope) const assert(lval); assert(rval); - string name = scope->name(); - name = name + "." + hname_.peek_tail_name(); + string name = hname_.peek_tail_name(); long lnum = lval->as_long(); long rnum = rval->as_long(); @@ -526,6 +525,9 @@ void PWire::elaborate_sig(Design*des, NetScope*scope) const /* * $Log: elab_sig.cc,v $ + * Revision 1.24 2002/08/05 04:18:45 steve + * Store only the base name of memories. + * * Revision 1.23 2002/06/21 04:59:35 steve * Carry integerness throughout the compilation. * diff --git a/ivl_target.h b/ivl_target.h index 5cdf59d26..5effd047d 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: ivl_target.h,v 1.102 2002/08/04 18:28:14 steve Exp $" +#ident "$Id: ivl_target.h,v 1.103 2002/08/05 04:18:45 steve Exp $" #endif #ifdef __cplusplus @@ -429,7 +429,7 @@ extern const char* ivl_expr_bits(ivl_expr_t net); extern ivl_scope_t ivl_expr_def(ivl_expr_t net); /* IVL_EX_SIGNAL */ extern unsigned ivl_expr_lsi(ivl_expr_t net); - /* IVL_EX_SIGNAL, IVL_EX_SFUNC, IVL_EX_MEMORY */ + /* IVL_EX_SIGNAL, IVL_EX_SFUNC */ extern const char* ivl_expr_name(ivl_expr_t net); /* IVL_EX_BINARY IVL_EX_UNARY */ extern char ivl_expr_opcode(ivl_expr_t net); @@ -469,13 +469,19 @@ extern unsigned ivl_expr_width(ivl_expr_t net); * * ivl_memory_size * ivl_memory_width + * These functions return the dimensions of the memory. The size is + * the number of words in the memory, and the width is the number + * of bits in each word. + * + * ivl_memory_scope + * This returns the scope that contains the memory. */ -extern const char*ivl_memory_name(ivl_memory_t net); extern const char*ivl_memory_basename(ivl_memory_t net); extern int ivl_memory_root(ivl_memory_t net); extern unsigned ivl_memory_size(ivl_memory_t net); extern unsigned ivl_memory_width(ivl_memory_t net); + extern ivl_memory_t ivl_expr_memory(ivl_expr_t net); /* LOGIC @@ -1072,6 +1078,9 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.103 2002/08/05 04:18:45 steve + * Store only the base name of memories. + * * Revision 1.102 2002/08/04 18:28:14 steve * Do not use hierarchical names of memories to * generate vvp labels. -tdll target does not diff --git a/net_scope.cc b/net_scope.cc index 4bc32257c..58c6eed3c 100644 --- a/net_scope.cc +++ b/net_scope.cc @@ -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.17 2002/07/22 21:07:08 steve Exp $" +#ident "$Id: net_scope.cc,v 1.18 2002/08/05 04:18:45 steve Exp $" #endif # include "config.h" @@ -338,10 +338,9 @@ NetMemory* NetScope::find_memory(const string&key) if (memories_ == 0) return 0; - string fulname = name()+"."+key; NetMemory*cur = memories_; do { - if (cur->name() == fulname) + if (cur->name() == key) return cur; cur = cur->sprev_; } while (cur != memories_); @@ -403,6 +402,9 @@ string NetScope::local_hsymbol() /* * $Log: net_scope.cc,v $ + * Revision 1.18 2002/08/05 04:18:45 steve + * Store only the base name of memories. + * * Revision 1.17 2002/07/22 21:07:08 steve * Initialize the lcounter_ to 0. * diff --git a/netlist.h b/netlist.h index 5d9b4518e..71d3d8a18 100644 --- a/netlist.h +++ b/netlist.h @@ -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.255 2002/08/04 18:28:15 steve Exp $" +#ident "$Id: netlist.h,v 1.256 2002/08/05 04:18:45 steve Exp $" #endif /* @@ -672,6 +672,8 @@ class NetMemory { NetMemory(NetScope*sc, const string&n, long w, long s, long e); ~NetMemory(); + // This is the BASE name of the memory object. It does not + // include scope name, get that from the scope itself. const char*name() const; // This is the width (in bits) of a single memory position. @@ -3006,6 +3008,9 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.256 2002/08/05 04:18:45 steve + * Store only the base name of memories. + * * Revision 1.255 2002/08/04 18:28:15 steve * Do not use hierarchical names of memories to * generate vvp labels. -tdll target does not diff --git a/t-dll-api.cc b/t-dll-api.cc index 7c8b9e211..7651a785a 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll-api.cc,v 1.83 2002/07/05 21:26:17 steve Exp $" +#ident "$Id: t-dll-api.cc,v 1.84 2002/08/05 04:18:45 steve Exp $" #endif # include "config.h" @@ -88,14 +88,15 @@ inline static const char *basename(ivl_scope_t scope, const char *inst) return inst+1; } -extern "C" const char*ivl_memory_name(ivl_memory_t net) -{ - return net->name_; -} - extern "C" const char* ivl_memory_basename(ivl_memory_t net) { - return basename(net->scope_, net->name_); + return net->basename_; +} + +extern "C" ivl_scope_t ivl_memory_scope(ivl_memory_t net) +{ + assert(net); + return net->scope_; } extern "C" int ivl_memory_root(ivl_memory_t net) @@ -240,10 +241,10 @@ extern "C" const char* ivl_expr_name(ivl_expr_t net) case IVL_EX_SIGNAL: return net->u_.signal_.sig->name_; - +#if 0 case IVL_EX_MEMORY: return net->u_.memory_.mem_->name_; - +#endif default: assert(0); } @@ -1552,6 +1553,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net) /* * $Log: t-dll-api.cc,v $ + * Revision 1.84 2002/08/05 04:18:45 steve + * Store only the base name of memories. + * * Revision 1.83 2002/07/05 21:26:17 steve * Avoid emitting to vvp local net symbols. * diff --git a/t-dll.cc b/t-dll.cc index a616d7df0..f1567ea9c 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll.cc,v 1.93 2002/08/04 19:13:16 steve Exp $" +#ident "$Id: t-dll.cc,v 1.94 2002/08/05 04:18:45 steve Exp $" #endif # include "config.h" @@ -94,6 +94,13 @@ inline const char*dlerror(void) { return strerror( errno ); } #endif +inline static const char *basename(ivl_scope_t scope, const char *inst) +{ + inst += strlen(ivl_scope_name(scope)); + assert(*inst == '.'); + return inst+1; +} + static struct dll_target dll_target_obj; static void drive_from_link(const Link&lnk, ivl_drive_t&drv0, ivl_drive_t&drv1) @@ -240,7 +247,7 @@ ivl_memory_t dll_target::find_memory(ivl_design_s &des, const NetMemory*net) const char*nname = net->name(); for (unsigned idx = 0 ; idx < scope->nmem_ ; idx += 1) { - if (strcmp(scope->mem_[idx]->name_, nname) == 0) + if (strcmp(scope->mem_[idx]->basename_, nname) == 0) return scope->mem_[idx]; } @@ -924,12 +931,13 @@ void dll_target::udp(const NetUDP*net) void dll_target::memory(const NetMemory*net) { ivl_memory_t obj = new struct ivl_memory_s; - obj->name_ = strings_.add(net->name()); - obj->scope_ = find_scope(des_, net->scope()); - obj->width_ = net->width(); - obj->signed_ = 0; - obj->size_ = net->count(); - obj->root_ = -net->index_to_address(0); + + obj->scope_ = find_scope(des_, net->scope()); + obj->basename_ = strings_.add(net->name()); + obj->width_ = net->width(); + obj->signed_ = 0; + obj->size_ = net->count(); + obj->root_ = -net->index_to_address(0); scope_add_mem(obj->scope_, obj); } @@ -1802,6 +1810,11 @@ void dll_target::signal(const NetNet*net) #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 @@ -1941,6 +1954,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj }; /* * $Log: t-dll.cc,v $ + * Revision 1.94 2002/08/05 04:18:45 steve + * Store only the base name of memories. + * * Revision 1.93 2002/08/04 19:13:16 steve * dll uses StringHeap for named items. * diff --git a/t-dll.h b/t-dll.h index c3a8d1803..530dd9c6f 100644 --- a/t-dll.h +++ b/t-dll.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll.h,v 1.89 2002/08/04 19:13:16 steve Exp $" +#ident "$Id: t-dll.h,v 1.90 2002/08/05 04:18:45 steve Exp $" #endif # include "target.h" @@ -436,7 +436,7 @@ struct ivl_nexus_s { * Memory. */ struct ivl_memory_s { - const char*name_; + const char*basename_; ivl_scope_t scope_; unsigned width_ :24; unsigned signed_ : 1; @@ -616,6 +616,9 @@ struct ivl_statement_s { /* * $Log: t-dll.h,v $ + * Revision 1.90 2002/08/05 04:18:45 steve + * Store only the base name of memories. + * * Revision 1.89 2002/08/04 19:13:16 steve * dll uses StringHeap for named items. * diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index ddc188da8..a7cdd92a6 100644 --- a/tgt-stub/stub.c +++ b/tgt-stub/stub.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: stub.c,v 1.64 2002/07/28 23:57:22 steve Exp $" +#ident "$Id: stub.c,v 1.65 2002/08/05 04:18:45 steve Exp $" #endif # include "config.h" @@ -230,7 +230,10 @@ static void show_assign_lval(ivl_lval_t lval, unsigned ind) if ( (mem = ivl_lval_mem(lval)) ) { - fprintf(out, "%*s%s[\n", ind, "", ivl_memory_name(mem)); + ivl_scope_t scope = ivl_memory_scope(mem); + fprintf(out, "%*s%s . %s[\n", ind, "", + ivl_scope_name(scope), + ivl_memory_basename(mem)); show_expression(ivl_lval_idx(lval), ind+4); fprintf(out, "%*s]\n", ind, ""); @@ -703,6 +706,9 @@ int target_design(ivl_design_t des) /* * $Log: stub.c,v $ + * Revision 1.65 2002/08/05 04:18:45 steve + * Store only the base name of memories. + * * Revision 1.64 2002/07/28 23:57:22 steve * dump NOT gates. * diff --git a/tgt-vvp/eval_expr.c b/tgt-vvp/eval_expr.c index 57d990361..9dee5abac 100644 --- a/tgt-vvp/eval_expr.c +++ b/tgt-vvp/eval_expr.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: eval_expr.c,v 1.67 2002/08/04 18:28:15 steve Exp $" +#ident "$Id: eval_expr.c,v 1.68 2002/08/05 04:18:45 steve Exp $" #endif # include "vvp_priv.h" @@ -1161,7 +1161,6 @@ void draw_memory_index_expr(ivl_memory_t mem, ivl_expr_t ae) static struct vector_info draw_memory_expr(ivl_expr_t exp, unsigned wid) { unsigned swid = ivl_expr_width(exp); - const char*name = ivl_expr_name(exp); ivl_memory_t mem = ivl_expr_memory(exp); struct vector_info res; unsigned idx; @@ -1727,6 +1726,9 @@ struct vector_info draw_eval_expr(ivl_expr_t exp) /* * $Log: eval_expr.c,v $ + * Revision 1.68 2002/08/05 04:18:45 steve + * Store only the base name of memories. + * * Revision 1.67 2002/08/04 18:28:15 steve * Do not use hierarchical names of memories to * generate vvp labels. -tdll target does not