diff --git a/ivl_target.h b/ivl_target.h index dcec1ac00..a01e7abd4 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.5 2000/08/26 00:54:03 steve Exp $" +#ident "$Id: ivl_target.h,v 1.6 2000/08/27 15:51:50 steve Exp $" #endif #ifdef __cplusplus @@ -64,6 +64,7 @@ typedef struct ivl_net_const_s*ivl_net_const_t; typedef struct ivl_net_event_s*ivl_net_event_t; typedef struct ivl_net_logic_s*ivl_net_logic_t; typedef struct ivl_net_probe_s*ivl_net_probe_t; +typedef struct ivl_net_signal_s*ivl_net_signal_t; typedef struct ivl_nexus_s *ivl_nexus_t; typedef struct ivl_process_s *ivl_process_t; typedef struct ivl_scope_s *ivl_scope_t; @@ -81,6 +82,7 @@ typedef struct ivl_scope_s *ivl_scope_t; of the output file. */ extern const char* ivl_get_flag(ivl_design_t, const char*key); +/* Get the name of the root module. This can be used as the design name. */ extern const char* ivl_get_root_name(ivl_design_t net); /* LOGIC @@ -104,7 +106,10 @@ extern unsigned ivl_get_logic_pins(ivl_net_logic_t net); * nexus. These functions manage the ivl_nexus_t object. */ -const char* ivl_get_nexus_name(ivl_nexus_t net); +extern const char* ivl_get_nexus_name(ivl_nexus_t net); + + +extern unsigned ivl_get_signal_pins(ivl_net_signal_t net); /* TARGET MODULE ENTRY POINTS @@ -172,6 +177,13 @@ typedef int (*net_logic_f)(const char*name, ivl_net_logic_t net); before this probe is called. */ typedef int (*net_probe_f)(const char*name, ivl_net_probe_t net); +/* target_net_signal + + Signals are things like "wire foo" or "reg bar;" that is, declared + signals in the verilog source. These are not memories, which are + handled elsewhere. */ +typedef int (*net_signal_f)(const char*name, ivl_net_signal_t net); + /* target_process @@ -198,6 +210,12 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.6 2000/08/27 15:51:50 steve + * t-dll iterates signals, and passes them to the + * target module. + * + * Some of NetObj should return char*, not string. + * * Revision 1.5 2000/08/26 00:54:03 steve * Get at gate information for ivl_target interface. * diff --git a/net_scope.cc b/net_scope.cc index 94de0140c..a01759800 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.8 2000/07/30 18:25:44 steve Exp $" +#ident "$Id: net_scope.cc,v 1.9 2000/08/27 15:51:50 steve Exp $" #endif # include "netlist.h" @@ -32,16 +32,18 @@ * in question. */ NetScope::NetScope(const string&n) -: type_(NetScope::MODULE), name_(n), up_(0), sib_(0), sub_(0) +: type_(NetScope::MODULE), up_(0), sib_(0), sub_(0) { memories_ = 0; signals_ = 0; events_ = 0; lcounter_ = 0; + name_ = new char[n.length()+1]; + strcpy(name_, n.c_str()); } NetScope::NetScope(NetScope*up, const string&n, NetScope::TYPE t) -: type_(t), name_(n), up_(up), sib_(0), sub_(0) +: type_(t), up_(up), sib_(0), sub_(0) { memories_ = 0; signals_ = 0; @@ -59,6 +61,8 @@ NetScope::NetScope(NetScope*up, const string&n, NetScope::TYPE t) func_ = 0; break; } + name_ = new char[n.length()+1]; + strcpy(name_, n.c_str()); } NetScope::~NetScope() @@ -66,6 +70,7 @@ NetScope::~NetScope() assert(sib_ == 0); assert(sub_ == 0); lcounter_ = 0; + delete[]name_; } NetExpr* NetScope::set_parameter(const string&key, NetExpr*expr) @@ -162,7 +167,7 @@ int NetScope::time_precision() const return time_prec_; } -string NetScope::basename() const +const char* NetScope::basename() const { return name_; } @@ -350,6 +355,12 @@ string NetScope::local_symbol() /* * $Log: net_scope.cc,v $ + * Revision 1.9 2000/08/27 15:51:50 steve + * t-dll iterates signals, and passes them to the + * target module. + * + * Some of NetObj should return char*, not string. + * * 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 diff --git a/netlist.cc b/netlist.cc index 6a87898cf..5e6cf22b4 100644 --- a/netlist.cc +++ b/netlist.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: netlist.cc,v 1.133 2000/07/14 06:12:57 steve Exp $" +#ident "$Id: netlist.cc,v 1.134 2000/08/27 15:51:50 steve Exp $" #endif # include @@ -163,8 +163,11 @@ Link* find_next_output(Link*lnk) } NetObj::NetObj(const string&n, unsigned np) -: name_(n), npins_(np), delay1_(0), delay2_(0), delay3_(0) +: npins_(np), delay1_(0), delay2_(0), delay3_(0) { + name_ = new char[n.length()+1]; + strcpy(name_, n.c_str()); + pins_ = new Link[npins_]; for (unsigned idx = 0 ; idx < npins_ ; idx += 1) { pins_[idx].node_ = this; @@ -174,6 +177,7 @@ NetObj::NetObj(const string&n, unsigned np) NetObj::~NetObj() { + delete[]name_; delete[]pins_; } @@ -2155,7 +2159,7 @@ NetESignal::~NetESignal() net_->decr_eref(); } -const string& NetESignal::name() const +string NetESignal::name() const { return net_->name(); } @@ -2188,6 +2192,11 @@ NetESubSignal::~NetESubSignal() delete idx_; } +string NetESubSignal::name() const +{ + return sig_->name(); +} + NetESubSignal* NetESubSignal::dup_expr() const { assert(0); @@ -2458,6 +2467,12 @@ bool NetUDP::sequ_glob_(string input, char output) /* * $Log: netlist.cc,v $ + * Revision 1.134 2000/08/27 15:51:50 steve + * t-dll iterates signals, and passes them to the + * target module. + * + * Some of NetObj should return char*, not string. + * * Revision 1.133 2000/07/14 06:12:57 steve * Move inital value handling from NetNet to Nexus * objects. This allows better propogation of inital diff --git a/netlist.h b/netlist.h index ac1cdc56e..b5a639ffd 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.157 2000/08/26 00:54:03 steve Exp $" +#ident "$Id: netlist.h,v 1.158 2000/08/27 15:51:50 steve Exp $" #endif /* @@ -76,7 +76,7 @@ class NetObj { explicit NetObj(const string&n, unsigned npins); virtual ~NetObj(); - const string& name() const { return name_; } + const char* name() const { return name_; } unsigned pin_count() const { return npins_; } @@ -103,7 +103,7 @@ class NetObj { void dump_obj_attr(ostream&, unsigned) const; private: - string name_; + char* name_; Link*pins_; const unsigned npins_; unsigned delay1_; @@ -2378,7 +2378,7 @@ class NetESignal : public NetExpr { NetESignal(NetNet*n); ~NetESignal(); - const string& name() const; + string name() const; virtual bool set_width(unsigned); virtual NetESignal* dup_expr() const; @@ -2410,7 +2410,7 @@ class NetESubSignal : public NetExpr { NetESubSignal(NetESignal*sig, NetExpr*ex); ~NetESubSignal(); - const string&name() const { return sig_->name(); } + string name() const; const NetExpr*index() const { return idx_; } virtual bool set_width(unsigned); @@ -2513,7 +2513,7 @@ class NetScope { /* The name of the scope is the fully qualified hierarchical name, whereas the basename is just my name within my parent scope. */ - string basename() const; + const char* basename() const; string name() const; void run_defparams(class Design*); @@ -2540,7 +2540,7 @@ class NetScope { private: TYPE type_; - string name_; + char* name_; signed char time_unit_, time_prec_; @@ -2726,6 +2726,12 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.158 2000/08/27 15:51:50 steve + * t-dll iterates signals, and passes them to the + * target module. + * + * Some of NetObj should return char*, not string. + * * Revision 1.157 2000/08/26 00:54:03 steve * Get at gate information for ivl_target interface. * diff --git a/t-dll.cc b/t-dll.cc index 792f6d04d..3bc67ea2b 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.5 2000/08/26 00:54:03 steve Exp $" +#ident "$Id: t-dll.cc,v 1.6 2000/08/27 15:51:51 steve Exp $" #endif # include "target.h" @@ -41,10 +41,6 @@ struct ivl_process_s { const NetProcTop*top_; }; -struct ivl_scope_s { - const NetScope*scope_; -}; - /* * The DLL target type loads a named object file to handle the process * of scanning the netlist. When it is time to start the design, I @@ -65,6 +61,7 @@ struct dll_target : public target_t { bool process(const NetProcTop*); void scope(const NetScope*); + void signal(const NetNet*); void*dll_; string dll_path_; @@ -79,6 +76,7 @@ struct dll_target : public target_t { net_event_f net_event_; net_logic_f net_logic_; net_probe_f net_probe_; + net_signal_f net_signal_; process_f process_; scope_f scope_; @@ -105,6 +103,7 @@ bool dll_target::start_design(const Design*des) net_event_ = (net_event_f) dlsym(dll_, LU "target_net_event" TU); net_logic_ = (net_logic_f) dlsym(dll_, LU "target_net_logic" TU); net_probe_ = (net_probe_f) dlsym(dll_, LU "target_net_probe" TU); + net_signal_ = (net_signal_f)dlsym(dll_, LU "target_net_signal" TU); process_ = (process_f) dlsym(dll_, LU "target_process" TU); scope_ = (scope_f) dlsym(dll_, LU "target_scope" TU); @@ -121,7 +120,7 @@ void dll_target::end_design(const Design*) bool dll_target::bufz(const NetBUFZ*net) { if (net_bufz_) { - int rc = (net_bufz_)(net->name().c_str(), 0); + int rc = (net_bufz_)(net->name(), 0); return rc == 0; } else { @@ -152,7 +151,7 @@ void dll_target::logic(const NetLogic*net) obj.dev_ = net; if (net_logic_) { - (net_logic_)(net->name().c_str(), &obj); + (net_logic_)(net->name(), &obj); } else { cerr << dll_path_ << ": internal error: target DLL lacks " @@ -169,7 +168,7 @@ bool dll_target::net_const(const NetConst*net) obj.con_ = net; if (net_const_) { - int rc = (net_const_)(net->name().c_str(), &obj); + int rc = (net_const_)(net->name(), &obj); return rc == 0; } else { @@ -184,7 +183,7 @@ bool dll_target::net_const(const NetConst*net) void dll_target::net_probe(const NetEvProbe*net) { if (net_probe_) { - int rc = (net_probe_)(net->name().c_str(), 0); + int rc = (net_probe_)(net->name(), 0); return; } else { @@ -217,12 +216,21 @@ bool dll_target::process(const NetProcTop*net) void dll_target::scope(const NetScope*net) { - struct ivl_scope_s obj; - - obj.scope_ = net; - if (scope_) - (scope_)(&obj); + (scope_)( (ivl_scope_t)net ); +} + +void dll_target::signal(const NetNet*net) +{ + if (net_signal_) { + int rc = (net_signal_)(net->name(), (ivl_net_signal_t)net); + return; + + } else { + cerr << dll_path_ << ": internal error: target DLL lacks " + << "target_net_signal function." << endl; + return; + } } extern const struct target tgt_dll = { "dll", &dll_target_obj }; @@ -268,8 +276,20 @@ extern "C" const char* ivl_get_nexus_name(ivl_nexus_t net) return nex->name(); } +extern "C" unsigned ivl_get_signal_pins(ivl_net_signal_t net) +{ + const NetNet*sig = (const NetNet*)net; + return sig->pin_count(); +} + /* * $Log: t-dll.cc,v $ + * Revision 1.6 2000/08/27 15:51:51 steve + * t-dll iterates signals, and passes them to the + * target module. + * + * Some of NetObj should return char*, not string. + * * Revision 1.5 2000/08/26 00:54:03 steve * Get at gate information for ivl_target interface. * diff --git a/t-null.cc b/t-null.cc index afcf969b7..607861c1a 100644 --- a/t-null.cc +++ b/t-null.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-null.cc,v 1.16 2000/08/14 04:39:57 steve Exp $" +#ident "$Id: t-null.cc,v 1.17 2000/08/27 15:51:51 steve Exp $" #endif # include "netlist.h" @@ -35,6 +35,7 @@ static class target_null_t : public target_t { void event(const NetEvent*) { } void func_def(const NetFuncDef*) { } void memory(const NetMemory*) { } + void signal(const NetNet*) { } void task_def(const NetTaskDef*) { } void net_assign(const NetAssign*) { } void net_assign_nb(const NetAssignNB*) { } @@ -54,6 +55,12 @@ static class target_null_t : public target_t { extern const struct target tgt_null = { "null", &target_null_obj }; /* * $Log: t-null.cc,v $ + * Revision 1.17 2000/08/27 15:51:51 steve + * t-dll iterates signals, and passes them to the + * target module. + * + * Some of NetObj should return char*, not string. + * * Revision 1.16 2000/08/14 04:39:57 steve * add th t-dll functions for net_const, net_bufz and processes. * diff --git a/target.cc b/target.cc index ef3caa1a6..00bd2d502 100644 --- a/target.cc +++ b/target.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: target.cc,v 1.44 2000/08/14 04:39:57 steve Exp $" +#ident "$Id: target.cc,v 1.45 2000/08/27 15:51:51 steve Exp $" #endif # include "target.h" @@ -37,10 +37,6 @@ void target_t::event(const NetEvent*ev) << "): Unhandled event <" << ev->full_name() << ">." << endl; } -void target_t::signal(const NetNet*) -{ -} - void target_t::memory(const NetMemory*) { cerr << "target (" << typeid(*this).name() << "): " @@ -396,6 +392,12 @@ void expr_scan_t::expr_binary(const NetEBinary*ex) /* * $Log: target.cc,v $ + * Revision 1.45 2000/08/27 15:51:51 steve + * t-dll iterates signals, and passes them to the + * target module. + * + * Some of NetObj should return char*, not string. + * * Revision 1.44 2000/08/14 04:39:57 steve * add th t-dll functions for net_const, net_bufz and processes. * diff --git a/target.h b/target.h index 882018bf1..30905f9d5 100644 --- a/target.h +++ b/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: target.h,v 1.43 2000/08/14 04:39:57 steve Exp $" +#ident "$Id: target.h,v 1.44 2000/08/27 15:51:51 steve Exp $" #endif # include "netlist.h" @@ -63,7 +63,7 @@ struct target_t { virtual void event(const NetEvent*); /* Output a signal (called for each signal) */ - virtual void signal(const NetNet*); + virtual void signal(const NetNet*) =0; /* Output a memory (called for each memory object) */ virtual void memory(const NetMemory*); @@ -160,6 +160,12 @@ extern const struct target *target_table[]; /* * $Log: target.h,v $ + * Revision 1.44 2000/08/27 15:51:51 steve + * t-dll iterates signals, and passes them to the + * target module. + * + * Some of NetObj should return char*, not string. + * * Revision 1.43 2000/08/14 04:39:57 steve * add th t-dll functions for net_const, net_bufz and processes. * diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index 1952976c9..6d7e983ac 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.5 2000/08/26 00:54:03 steve Exp $" +#ident "$Id: stub.c,v 1.6 2000/08/27 15:51:51 steve Exp $" #endif /* @@ -106,6 +106,13 @@ int target_net_probe(const char*name, ivl_net_probe_t net) fprintf(out, "STUB: %s: probe\n", name); return 0; } + +int target_net_signal(const char*name, ivl_net_signal_t net) +{ + fprintf(out, "STUB: %s: signal [%u]\n", name, ivl_get_signal_pins(net)); + return 0; +} + int target_process(ivl_process_t net) { fprintf(out, "STUB: process\n"); @@ -114,6 +121,12 @@ int target_process(ivl_process_t net) /* * $Log: stub.c,v $ + * Revision 1.6 2000/08/27 15:51:51 steve + * t-dll iterates signals, and passes them to the + * target module. + * + * Some of NetObj should return char*, not string. + * * Revision 1.5 2000/08/26 00:54:03 steve * Get at gate information for ivl_target interface. *