Get target signal from nexus_ptr.

This commit is contained in:
steve 2000-10-25 05:41:24 +00:00
parent 1cc7b6d4d7
commit b8fe10d27d
4 changed files with 84 additions and 4 deletions

View File

@ -34,6 +34,9 @@ ivl_nexus_name
ivl_nexus_ptrs
ivl_nexus_ptr
ivl_nexus_ptr_pin
ivl_nexus_ptr_sig
ivl_scope_children
ivl_scope_logs
ivl_scope_log

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: ivl_target.h,v 1.22 2000/10/21 16:49:45 steve Exp $"
#ident "$Id: ivl_target.h,v 1.23 2000/10/25 05:41:24 steve Exp $"
#endif
#ifdef __cplusplus
@ -357,12 +357,28 @@ extern ivl_nexus_t ivl_lval_pin(ivl_lval_t net, unsigned idx);
*
* ivl_nexus_ptr
* Return a nexus pointer given the nexus and an index.
*
* Once an ivl_nexus_ptr_t is selected by the ivl_nexus_ptr method,
* the properties of the pointer can be accessed by the following
* methods:
*
* ivl_nexus_ptr_pin
* This returns the pin number of the device where this nexus
* points. It is the bit within the signal or logic device that is
* connected to the nexus.
*
* ivl_nexus_ptr_sig
* If the target object is an ivl_signal_t, this method returns the
* object. If the target is not a signal, this method returns 0.
*/
extern const char* ivl_nexus_name(ivl_nexus_t net);
extern unsigned ivl_nexus_ptrs(ivl_nexus_t net);
extern ivl_nexus_ptr_t ivl_nexus_ptr(ivl_nexus_t net, unsigned idx);
extern unsigned ivl_nexus_ptr_pin(ivl_nexus_ptr_t net);
extern ivl_signal_t ivl_nexus_ptr_sig(ivl_nexus_ptr_t net);
/* SCOPE
* Scopes of various sort have these properties. Use these methods to
@ -416,7 +432,8 @@ extern ivl_signal_t ivl_scope_sig(ivl_scope_t net, unsigned idx);
* Signals have a name (obviously) and types. A signal may also be
* signed or unsigned.
*/
extern unsigned ivl_signal_pins(ivl_signal_t net);
extern ivl_nexus_t ivl_signal_pin(ivl_signal_t net, unsigned idx);
extern unsigned ivl_signal_pins(ivl_signal_t net);
extern ivl_signal_port_t ivl_signal_port(ivl_signal_t net);
extern ivl_signal_type_t ivl_signal_type(ivl_signal_t net);
extern const char* ivl_signal_name(ivl_signal_t net);
@ -506,6 +523,9 @@ _END_DECL
/*
* $Log: ivl_target.h,v $
* Revision 1.23 2000/10/25 05:41:24 steve
* Get target signal from nexus_ptr.
*
* Revision 1.22 2000/10/21 16:49:45 steve
* Reduce the target entry points to the target_design.
*

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: t-dll-api.cc,v 1.14 2000/10/18 20:04:39 steve Exp $"
#ident "$Id: t-dll-api.cc,v 1.15 2000/10/25 05:41:24 steve Exp $"
#endif
# include "t-dll.h"
@ -242,6 +242,21 @@ extern "C" ivl_nexus_ptr_t ivl_nexus_ptr(ivl_nexus_t net, unsigned idx)
return net->ptrs_ + idx;
}
extern "C" unsigned ivl_nexus_ptr_pin(ivl_nexus_ptr_t net)
{
assert(net);
return net->pin_;
}
extern "C" ivl_signal_t ivl_nexus_ptr_sig(ivl_nexus_ptr_t net)
{
if (net == 0)
return 0;
if (net->type_ != __NEXUS_PTR_SIG)
return 0;
return net->l.sig;
}
extern "C" ivl_process_type_t ivl_process_type(ivl_process_t net)
{
return net->type_;
@ -308,6 +323,18 @@ extern "C" const char* ivl_signal_name(ivl_signal_t net)
return net->name_;
}
extern "C" ivl_nexus_t ivl_signal_pin(ivl_signal_t net, unsigned idx)
{
assert(net);
assert(idx < net->width_);
if (net->width_ == 1) {
return net->n.pin_;
} else {
return net->n.pins_[idx];
}
}
extern "C" unsigned ivl_signal_pins(ivl_signal_t net)
{
return net->width_;
@ -476,6 +503,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
/*
* $Log: t-dll-api.cc,v $
* Revision 1.15 2000/10/25 05:41:24 steve
* Get target signal from nexus_ptr.
*
* Revision 1.14 2000/10/18 20:04:39 steve
* Add ivl_lval_t and support for assignment l-values.
*

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: stub.c,v 1.20 2000/10/21 16:49:45 steve Exp $"
#ident "$Id: stub.c,v 1.21 2000/10/25 05:41:24 steve Exp $"
#endif
/*
@ -89,9 +89,11 @@ static void show_statement(ivl_statement_t net, unsigned ind)
ivl_nexus_t nex = ivl_lval_pin(lval, 0);
fprintf(out, "%*s{%s", ind+4, "", ivl_nexus_name(nex));
fprintf(out, "<nptrs=%u>", ivl_nexus_ptrs(nex));
for (pp = 1 ; pp < ivl_lval_pins(lval) ; pp += 1) {
nex = ivl_lval_pin(lval, pp);
fprintf(out, ", %s", ivl_nexus_name(nex));
fprintf(out, "<nptrs=%u>", ivl_nexus_ptrs(nex));
}
fprintf(out, "}\n");
}
@ -184,6 +186,7 @@ static int show_process(ivl_process_t net)
static void show_signal(ivl_signal_t net)
{
unsigned pin;
const char*type = "?";
const char*port = "";
@ -213,6 +216,27 @@ static void show_signal(ivl_signal_t net)
fprintf(out, " %s %s[%u] %s\n", type, port,
ivl_signal_pins(net), ivl_signal_basename(net));
for (pin = 0 ; pin < ivl_signal_pins(net) ; pin += 1) {
unsigned idx;
ivl_nexus_t nex = ivl_signal_pin(net, pin);
fprintf(out, " [%u]: nexus=%s\n", pin, ivl_nexus_name(nex));
for (idx = 0 ; idx < ivl_nexus_ptrs(nex) ; idx += 1) {
ivl_signal_t sig;
ivl_nexus_ptr_t ptr = ivl_nexus_ptr(nex, idx);
if ((sig = ivl_nexus_ptr_sig(ptr))) {
fprintf(out, " %s[%u]\n",
ivl_signal_name(sig),
ivl_nexus_ptr_pin(ptr));
} else {
fprintf(out, " ?[%u]\n", ivl_nexus_ptr_pin(ptr));
}
}
}
}
static void show_logic(ivl_net_logic_t net)
@ -301,6 +325,9 @@ DECLARE_CYGWIN_DLL(DllMain);
/*
* $Log: stub.c,v $
* Revision 1.21 2000/10/25 05:41:24 steve
* Get target signal from nexus_ptr.
*
* Revision 1.20 2000/10/21 16:49:45 steve
* Reduce the target entry points to the target_design.
*