From a00924089d4e808e70ccd450644dfd03f7737b7f Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 15 Jan 2001 00:47:01 +0000 Subject: [PATCH] Pass scope type information to the target module. --- ivl.def | 2 ++ ivl_target.h | 22 +++++++++++++++++++++- pform.cc | 15 +++++---------- t-dll-api.cc | 17 ++++++++++++++++- t-dll.cc | 30 +++++++++++++++++++++++++++++- t-dll.h | 7 ++++++- tgt-stub/stub.c | 32 +++++++++++++++++++++++++++++--- 7 files changed, 108 insertions(+), 17 deletions(-) diff --git a/ivl.def b/ivl.def index 001dc424c..f0f79cea3 100644 --- a/ivl.def +++ b/ivl.def @@ -59,6 +59,8 @@ ivl_scope_lpm ivl_scope_name ivl_scope_sigs ivl_scope_sig +ivl_scope_type +ivl_scope_tname ivl_signal_attr ivl_signal_pin diff --git a/ivl_target.h b/ivl_target.h index ad94c6a2b..eb11525c8 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.32 2001/01/15 00:05:39 steve Exp $" +#ident "$Id: ivl_target.h,v 1.33 2001/01/15 00:47:01 steve Exp $" #endif #ifdef __cplusplus @@ -190,6 +190,16 @@ typedef enum ivl_process_type_e { IVL_PR_ALWAYS = 1 } ivl_process_type_t; +/* These are the sorts of reasons a scope may come to be. These types + are properties of ivl_scope_t objects. */ +typedef enum ivl_scope_type_e { + IVL_SCT_MODULE = 0, + IVL_SCT_FUNCTION= 1, + IVL_SCT_TASK = 2, + IVL_SCT_BEGIN = 3, + IVL_SCT_FORK = 4 +} ivl_scope_type_t; + /* Signals (ivl_signal_t) that are ports into the scope that contains them have a port type. Otherwise, they are port IVL_SIP_NONE. */ typedef enum ivl_signal_port_e { @@ -506,6 +516,13 @@ extern ivl_signal_t ivl_nexus_ptr_sig(ivl_nexus_ptr_t net); * Scopes have 0 or more signals in them. These signals are * anything that can become and ivl_signal_t, include synthetic * signals generated by the compiler. + * + * ivl_scope_type + * ivl_scope_tname + * Scopes have a type and a type name. For example, if a scope is + * an instance of module foo, its type is IVL_SCT_MODULE and its + * type name is "foo". This is different from the instance name + * returned by ivl_scope_name above. */ extern int ivl_scope_children(ivl_scope_t net, @@ -648,6 +665,9 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.33 2001/01/15 00:47:01 steve + * Pass scope type information to the target module. + * * Revision 1.32 2001/01/15 00:05:39 steve * Add client data pointer for scope and process scanners. * diff --git a/pform.cc b/pform.cc index f58b05564..a2d7af53e 100644 --- a/pform.cc +++ b/pform.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: pform.cc,v 1.72 2001/01/14 23:04:56 steve Exp $" +#ident "$Id: pform.cc,v 1.73 2001/01/15 00:47:01 steve Exp $" #endif # include "compiler.h" @@ -525,15 +525,7 @@ void pform_make_modgates(const string&type, struct parmvalue_t*overrides, svector*gates) { -#if 0 - if (overrides && overrides->by_order) - for (unsigned idx = 0 ; idx < overrides->by_order->count() ; idx += 1) - if (! pform_expression_is_constant((*overrides->by_order)[idx])) { - VLerror("error: Parameter override expression" - " must be constant."); - return; - } -#endif + for (unsigned idx = 0 ; idx < gates->count() ; idx += 1) { lgate cur = (*gates)[idx]; @@ -1011,6 +1003,9 @@ int pform_parse(const char*path, map&modules, /* * $Log: pform.cc,v $ + * Revision 1.73 2001/01/15 00:47:01 steve + * Pass scope type information to the target module. + * * Revision 1.72 2001/01/14 23:04:56 steve * Generalize the evaluation of floating point delays, and * get it working with delay assignment statements. diff --git a/t-dll-api.cc b/t-dll-api.cc index 9ce73d34e..3471ef934 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.20 2001/01/15 00:05:39 steve Exp $" +#ident "$Id: t-dll-api.cc,v 1.21 2001/01/15 00:47:02 steve Exp $" #endif # include "t-dll.h" @@ -424,6 +424,18 @@ extern "C" ivl_signal_t ivl_scope_sig(ivl_scope_t net, unsigned idx) return net->sigs_[idx]; } +extern "C" ivl_scope_type_t ivl_scope_type(ivl_scope_t net) +{ + assert(net); + return net->type_; +} + +extern "C" const char* ivl_scope_tname(ivl_scope_t net) +{ + assert(net); + return net->tname_; +} + extern "C" const char* ivl_signal_attr(ivl_signal_t net, const char*key) { if (net->nattr_ == 0) @@ -634,6 +646,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net) /* * $Log: t-dll-api.cc,v $ + * Revision 1.21 2001/01/15 00:47:02 steve + * Pass scope type information to the target module. + * * Revision 1.20 2001/01/15 00:05:39 steve * Add client data pointer for scope and process scanners. * diff --git a/t-dll.cc b/t-dll.cc index 188af1ba3..cef52ed35 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.25 2001/01/06 06:31:59 steve Exp $" +#ident "$Id: t-dll.cc,v 1.26 2001/01/15 00:47:02 steve Exp $" #endif # include "compiler.h" @@ -196,6 +196,8 @@ bool dll_target::start_design(const Design*des) des_.root_->log_ = 0; des_.root_->nlpm_ = 0; des_.root_->lpm_ = 0; + des_.root_->type_ = IVL_SCT_MODULE; + des_.root_->tname_ = des_.root_->name_; target_ = (target_design_f)ivl_dlsym(dll_, LU "target_design" TU); if (target_ == 0) { @@ -463,6 +465,29 @@ void dll_target::scope(const NetScope*net) scope->nlpm_ = 0; scope->lpm_ = 0; + switch (net->type()) { + case NetScope::MODULE: + scope->type_ = IVL_SCT_MODULE; + scope->tname_ = net->module_name(); + break; + case NetScope::TASK: + scope->type_ = IVL_SCT_TASK; + scope->tname_ = strdup(net->task_def()->name().c_str()); + break; + case NetScope::FUNC: + scope->type_ = IVL_SCT_FUNCTION; + scope->tname_ = strdup(net->func_def()->name().c_str()); + break; + case NetScope::BEGIN_END: + scope->type_ = IVL_SCT_BEGIN; + scope->tname_ = scope->name_; + break; + case NetScope::FORK_JOIN: + scope->type_ = IVL_SCT_FORK; + scope->tname_ = scope->name_; + break; + } + ivl_scope_t parent = find_scope(des_.root_, net->parent()); assert(parent != 0); @@ -639,6 +664,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj }; /* * $Log: t-dll.cc,v $ + * Revision 1.26 2001/01/15 00:47:02 steve + * Pass scope type information to the target module. + * * Revision 1.25 2001/01/06 06:31:59 steve * declaration initialization for time variables. * diff --git a/t-dll.h b/t-dll.h index a78954e69..a1dc88a5e 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.20 2000/12/15 05:45:25 steve Exp $" +#ident "$Id: t-dll.h,v 1.21 2001/01/15 00:47:02 steve Exp $" #endif # include "target.h" @@ -266,6 +266,8 @@ struct ivl_scope_s { ivl_scope_t child_, sibling_; char* name_; + const char* tname_; + ivl_scope_type_t type_; unsigned nsigs_; ivl_signal_t*sigs_; @@ -363,6 +365,9 @@ struct ivl_statement_s { /* * $Log: t-dll.h,v $ + * Revision 1.21 2001/01/15 00:47:02 steve + * Pass scope type information to the target module. + * * Revision 1.20 2000/12/15 05:45:25 steve * Autoconfigure the dlopen functions. * diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index 7dc7b1382..2d88e68d0 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.27 2001/01/15 00:05:39 steve Exp $" +#ident "$Id: stub.c,v 1.28 2001/01/15 00:47:02 steve Exp $" #endif /* @@ -346,8 +346,31 @@ static int show_scope(ivl_scope_t net, void*x) { unsigned idx; - fprintf(out, "scope: %s (%u signals, %u logic)\n", ivl_scope_name(net), - ivl_scope_sigs(net), ivl_scope_logs(net)); + fprintf(out, "scope: %s (%u signals, %u logic)", + ivl_scope_name(net), ivl_scope_sigs(net), + ivl_scope_logs(net)); + + switch (ivl_scope_type(net)) { + case IVL_SCT_MODULE: + fprintf(out, " module %s\n", ivl_scope_tname(net)); + break; + case IVL_SCT_FUNCTION: + fprintf(out, " function %s\n", ivl_scope_tname(net)); + break; + case IVL_SCT_BEGIN: + fprintf(out, " begin : %s\n", ivl_scope_tname(net)); + break; + case IVL_SCT_FORK: + fprintf(out, " fork : %s\n", ivl_scope_tname(net)); + break; + case IVL_SCT_TASK: + fprintf(out, " task %s\n", ivl_scope_tname(net)); + break; + default: + fprintf(out, " type(%u) %s\n", ivl_scope_type(net), + ivl_scope_tname(net)); + break; + } for (idx = 0 ; idx < ivl_scope_sigs(net) ; idx += 1) show_signal(ivl_scope_sig(net, idx)); @@ -392,6 +415,9 @@ DECLARE_CYGWIN_DLL(DllMain); /* * $Log: stub.c,v $ + * Revision 1.28 2001/01/15 00:47:02 steve + * Pass scope type information to the target module. + * * Revision 1.27 2001/01/15 00:05:39 steve * Add client data pointer for scope and process scanners. *