Make signal attributes available to ivl_target API.
This commit is contained in:
parent
4f638882c9
commit
3b9a60414e
3
ivl.def
3
ivl.def
|
|
@ -47,6 +47,8 @@ ivl_nexus_ptrs
|
|||
ivl_nexus_ptr
|
||||
|
||||
ivl_nexus_ptr_pin
|
||||
ivl_nexus_ptr_lpm
|
||||
ivl_nexus_ptr_log
|
||||
ivl_nexus_ptr_sig
|
||||
|
||||
ivl_scope_children
|
||||
|
|
@ -58,6 +60,7 @@ ivl_scope_name
|
|||
ivl_scope_sigs
|
||||
ivl_scope_sig
|
||||
|
||||
ivl_signal_attr
|
||||
ivl_signal_pin
|
||||
ivl_signal_pins
|
||||
ivl_signal_port
|
||||
|
|
|
|||
49
ivl_target.h
49
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.29 2000/11/12 17:47:29 steve Exp $"
|
||||
#ident "$Id: ivl_target.h,v 1.30 2000/12/05 06:29:33 steve Exp $"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -443,6 +443,19 @@ extern ivl_nexus_t ivl_lval_pin(ivl_lval_t net, unsigned idx);
|
|||
* points. It is the bit within the signal or logic device that is
|
||||
* connected to the nexus.
|
||||
*
|
||||
* If the target is an LPM device, then this value is zero, and it
|
||||
* is up to the application to find the pin that referse to this
|
||||
* nexus. The problem is that LPM devices do not have a pinout per
|
||||
* se, the pins all have specific names.
|
||||
*
|
||||
* ivl_nexus_ptr_log
|
||||
* If the target object is an ivl_net_logic_t, this method returns
|
||||
* the object. Otherwise, this method returns 0.
|
||||
*
|
||||
* ivl_nexus_ptr_lpm
|
||||
* If the target object is an ivl_lpm_t, this method returns the
|
||||
* object. Otherwise, this method returns 0.
|
||||
*
|
||||
* 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.
|
||||
|
|
@ -453,6 +466,8 @@ 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_net_logic_t ivl_nexus_ptr_log(ivl_nexus_ptr_t net);
|
||||
extern ivl_lpm_t ivl_nexus_ptr_lpm(ivl_nexus_ptr_t net);
|
||||
extern ivl_signal_t ivl_nexus_ptr_sig(ivl_nexus_ptr_t net);
|
||||
|
||||
|
||||
|
|
@ -509,13 +524,42 @@ 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.
|
||||
*
|
||||
* ivl_signal_pins
|
||||
* ivl_signal_pin
|
||||
* The ivl_signal_pin function returns the nexus connected to the
|
||||
* signal. If the signal is a vectory, the idx can be a non-zero
|
||||
* value, and the result is the nexus for the specified bit.
|
||||
*
|
||||
* ivl_signal_port
|
||||
* If the signal is a port to a module, this function returns the
|
||||
* port direction. If the signal is not a port, it returns
|
||||
* IVL_SIP_NONE.
|
||||
*
|
||||
* ivl_signal_type
|
||||
*
|
||||
* ivl_signal_name
|
||||
* This function returns the fully scoped hierarchical name for the
|
||||
* signal. The name refers to the entire vector that is the signal.
|
||||
*
|
||||
* ivl_signal_basename
|
||||
* This function returns the name of the signal, without the scope
|
||||
* information. This is the tail of the signal name.
|
||||
*
|
||||
* ivl_signal_attr
|
||||
* Icarus Verilog supports attaching attributes to signals, with
|
||||
* the attribute value (a string) associated with a key. This
|
||||
* function returns the attribute value for the given key. If the
|
||||
* key does not exist, the function returns 0.
|
||||
*/
|
||||
|
||||
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);
|
||||
extern const char* ivl_signal_basename(ivl_signal_t net);
|
||||
extern const char* ivl_signal_attr(ivl_signal_t net, const char*key);
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -601,6 +645,9 @@ _END_DECL
|
|||
|
||||
/*
|
||||
* $Log: ivl_target.h,v $
|
||||
* Revision 1.30 2000/12/05 06:29:33 steve
|
||||
* Make signal attributes available to ivl_target API.
|
||||
*
|
||||
* Revision 1.29 2000/11/12 17:47:29 steve
|
||||
* flip-flop pins for ivl_target API.
|
||||
*
|
||||
|
|
|
|||
20
netlist.cc
20
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.149 2000/12/04 17:37:04 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.150 2000/12/05 06:29:33 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <cassert>
|
||||
|
|
@ -227,6 +227,21 @@ bool NetObj::has_compat_attributes(const NetObj&that) const
|
|||
return attributes_.has_compat_attributes(that.attributes_);
|
||||
}
|
||||
|
||||
unsigned NetObj::nattr() const
|
||||
{
|
||||
return attributes_.size();
|
||||
}
|
||||
|
||||
const char* NetObj::attr_key(unsigned idx) const
|
||||
{
|
||||
return attributes_.key(idx).c_str();
|
||||
}
|
||||
|
||||
const char* NetObj::attr_value(unsigned idx) const
|
||||
{
|
||||
return attributes_.value(idx).c_str();
|
||||
}
|
||||
|
||||
|
||||
Link& NetObj::pin(unsigned idx)
|
||||
{
|
||||
|
|
@ -2450,6 +2465,9 @@ bool NetUDP::sequ_glob_(string input, char output)
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.150 2000/12/05 06:29:33 steve
|
||||
* Make signal attributes available to ivl_target API.
|
||||
*
|
||||
* Revision 1.149 2000/12/04 17:37:04 steve
|
||||
* Add Attrib class for holding NetObj attributes.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.184 2000/12/04 17:37:04 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.185 2000/12/05 06:29:33 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -101,6 +101,10 @@ class NetObj {
|
|||
// all have the same values.
|
||||
bool has_compat_attributes(const NetObj&that) const;
|
||||
|
||||
unsigned nattr() const;
|
||||
const char* attr_key(unsigned) const;
|
||||
const char* attr_value(unsigned) const;
|
||||
|
||||
Link&pin(unsigned idx);
|
||||
const Link&pin(unsigned idx) const;
|
||||
|
||||
|
|
@ -2821,6 +2825,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.185 2000/12/05 06:29:33 steve
|
||||
* Make signal attributes available to ivl_target API.
|
||||
*
|
||||
* Revision 1.184 2000/12/04 17:37:04 steve
|
||||
* Add Attrib class for holding NetObj attributes.
|
||||
*
|
||||
|
|
|
|||
39
t-dll-api.cc
39
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.18 2000/11/12 17:47:29 steve Exp $"
|
||||
#ident "$Id: t-dll-api.cc,v 1.19 2000/12/05 06:29:33 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "t-dll.h"
|
||||
|
|
@ -328,6 +328,24 @@ extern "C" unsigned ivl_nexus_ptr_pin(ivl_nexus_ptr_t net)
|
|||
return net->pin_;
|
||||
}
|
||||
|
||||
extern "C" ivl_net_logic_t ivl_nexus_ptr_log(ivl_nexus_ptr_t net)
|
||||
{
|
||||
if (net == 0)
|
||||
return 0;
|
||||
if (net->type_ != __NEXUS_PTR_LOG)
|
||||
return 0;
|
||||
return net->l.log;
|
||||
}
|
||||
|
||||
extern "C" ivl_lpm_t ivl_nexus_ptr_lpm(ivl_nexus_ptr_t net)
|
||||
{
|
||||
if (net == 0)
|
||||
return 0;
|
||||
if (net->type_ != __NEXUS_PTR_LPM)
|
||||
return 0;
|
||||
return net->l.lpm;
|
||||
}
|
||||
|
||||
extern "C" ivl_signal_t ivl_nexus_ptr_sig(ivl_nexus_ptr_t net)
|
||||
{
|
||||
if (net == 0)
|
||||
|
|
@ -402,6 +420,22 @@ extern "C" ivl_signal_t ivl_scope_sig(ivl_scope_t net, unsigned idx)
|
|||
return net->sigs_[idx];
|
||||
}
|
||||
|
||||
extern "C" const char* ivl_signal_attr(ivl_signal_t net, const char*key)
|
||||
{
|
||||
if (net->nattr_ == 0)
|
||||
return 0;
|
||||
|
||||
assert(net->akey_);
|
||||
assert(net->aval_);
|
||||
|
||||
for (unsigned idx = 0 ; idx < net->nattr_ ; idx += 1)
|
||||
|
||||
if (strcmp(key, net->akey_[idx]) == 0)
|
||||
return net->aval_[idx];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" const char* ivl_signal_basename(ivl_signal_t net)
|
||||
{
|
||||
const char*nam = net->name_;
|
||||
|
|
@ -596,6 +630,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
|
|||
|
||||
/*
|
||||
* $Log: t-dll-api.cc,v $
|
||||
* Revision 1.19 2000/12/05 06:29:33 steve
|
||||
* Make signal attributes available to ivl_target API.
|
||||
*
|
||||
* Revision 1.18 2000/11/12 17:47:29 steve
|
||||
* flip-flop pins for ivl_target API.
|
||||
*
|
||||
|
|
|
|||
40
t-dll.cc
40
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.19 2000/11/11 00:03:36 steve Exp $"
|
||||
#ident "$Id: t-dll.cc,v 1.20 2000/12/05 06:29:33 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "compiler.h"
|
||||
|
|
@ -99,6 +99,18 @@ static void nexus_con_add(ivl_nexus_t nex, ivl_net_const_t net, unsigned pin)
|
|||
nex->ptrs_[top-1].l.con= net;
|
||||
}
|
||||
|
||||
static void nexus_lpm_add(ivl_nexus_t nex, ivl_lpm_t net, unsigned pin)
|
||||
{
|
||||
unsigned top = nex->nptr_ + 1;
|
||||
nex->ptrs_ = (struct ivl_nexus_ptr_s*)
|
||||
realloc(nex->ptrs_, top * sizeof(struct ivl_nexus_ptr_s));
|
||||
nex->nptr_ = top;
|
||||
|
||||
nex->ptrs_[top-1].type_= __NEXUS_PTR_LPM;
|
||||
nex->ptrs_[top-1].pin_ = pin;
|
||||
nex->ptrs_[top-1].l.lpm= net;
|
||||
}
|
||||
|
||||
|
||||
void scope_add_logic(ivl_scope_t scope, ivl_net_logic_t net)
|
||||
{
|
||||
|
|
@ -239,6 +251,12 @@ void dll_target::logic(const NetLogic*net)
|
|||
case NetLogic::BUF:
|
||||
obj->type_ = IVL_LO_BUF;
|
||||
break;
|
||||
case NetLogic::BUFIF0:
|
||||
obj->type_ = IVL_LO_BUFIF0;
|
||||
break;
|
||||
case NetLogic::BUFIF1:
|
||||
obj->type_ = IVL_LO_BUFIF1;
|
||||
break;
|
||||
case NetLogic::OR:
|
||||
obj->type_ = IVL_LO_OR;
|
||||
break;
|
||||
|
|
@ -286,19 +304,24 @@ void dll_target::lpm_ff(const NetFF*net)
|
|||
|
||||
const Nexus*nex;
|
||||
|
||||
/* Set the clk signal to point to the nexus, and the nexus to
|
||||
point back to this device. */
|
||||
nex = net->pin_Clock().nexus();
|
||||
assert(nex->t_cookie());
|
||||
obj->clk = (ivl_nexus_t) nex->t_cookie();
|
||||
/* XXXX set nexus back pointer? XXXX */
|
||||
assert(obj->clk);
|
||||
nexus_lpm_add(obj->clk, &obj->base, 0);
|
||||
|
||||
if (obj->base.width == 1) {
|
||||
nex = net->pin_Q(0).nexus();
|
||||
assert(nex->t_cookie());
|
||||
obj->q.pin = (ivl_nexus_t) nex->t_cookie();
|
||||
nexus_lpm_add(obj->q.pin, &obj->base, 0);
|
||||
|
||||
nex = net->pin_Data(0).nexus();
|
||||
assert(nex->t_cookie());
|
||||
obj->d.pin = (ivl_nexus_t) nex->t_cookie();
|
||||
nexus_lpm_add(obj->d.pin, &obj->base, 0);
|
||||
|
||||
} else {
|
||||
obj->q.pins = new ivl_nexus_t [obj->base.width * 2];
|
||||
|
|
@ -308,10 +331,12 @@ void dll_target::lpm_ff(const NetFF*net)
|
|||
nex = net->pin_Q(idx).nexus();
|
||||
assert(nex->t_cookie());
|
||||
obj->q.pins[idx] = (ivl_nexus_t) nex->t_cookie();
|
||||
nexus_lpm_add(obj->q.pins[idx], &obj->base, 0);
|
||||
|
||||
nex = net->pin_Data(idx).nexus();
|
||||
assert(nex->t_cookie());
|
||||
obj->d.pins[idx] = (ivl_nexus_t) nex->t_cookie();
|
||||
nexus_lpm_add(obj->d.pins[idx], &obj->base, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -526,6 +551,14 @@ void dll_target::signal(const NetNet*net)
|
|||
break;
|
||||
}
|
||||
|
||||
obj->nattr_ = net->nattr();
|
||||
obj->akey_ = new char*[obj->nattr_];
|
||||
obj->aval_ = new char*[obj->nattr_];
|
||||
for (unsigned idx = 0 ; idx < obj->nattr_ ; idx += 1) {
|
||||
obj->akey_[idx] = strdup(net->attr_key(idx));
|
||||
obj->aval_[idx] = strdup(net->attr_value(idx));
|
||||
}
|
||||
|
||||
/* Get the nexus objects for all the pins of the signal. If
|
||||
the signal has only one pin, then write the single
|
||||
ivl_nexus_t object into n.pin_. Otherwise, make an array of
|
||||
|
|
@ -575,6 +608,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
|
|||
|
||||
/*
|
||||
* $Log: t-dll.cc,v $
|
||||
* Revision 1.20 2000/12/05 06:29:33 steve
|
||||
* Make signal attributes available to ivl_target API.
|
||||
*
|
||||
* Revision 1.19 2000/11/11 00:03:36 steve
|
||||
* Add support for the t-dll backend grabing flip-flops.
|
||||
*
|
||||
|
|
|
|||
11
t-dll.h
11
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.18 2000/11/11 00:03:36 steve Exp $"
|
||||
#ident "$Id: t-dll.h,v 1.19 2000/12/05 06:29:33 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "target.h"
|
||||
|
|
@ -223,11 +223,13 @@ struct ivl_nexus_ptr_s {
|
|||
ivl_signal_t sig; /* type 0 */
|
||||
ivl_net_logic_t log; /* type 1 */
|
||||
ivl_net_const_t con; /* type 2 */
|
||||
ivl_lpm_t lpm; /* type 3 */
|
||||
} l;
|
||||
};
|
||||
# define __NEXUS_PTR_SIG 0
|
||||
# define __NEXUS_PTR_LOG 1
|
||||
# define __NEXUS_PTR_CON 2
|
||||
# define __NEXUS_PTR_LPM 3
|
||||
|
||||
struct ivl_nexus_s {
|
||||
unsigned nptr_;
|
||||
|
|
@ -287,6 +289,10 @@ struct ivl_signal_s {
|
|||
ivl_nexus_t pin_;
|
||||
ivl_nexus_t*pins_;
|
||||
} n;
|
||||
|
||||
char**akey_;
|
||||
char**aval_;
|
||||
unsigned nattr_;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -349,6 +355,9 @@ struct ivl_statement_s {
|
|||
|
||||
/*
|
||||
* $Log: t-dll.h,v $
|
||||
* Revision 1.19 2000/12/05 06:29:33 steve
|
||||
* Make signal attributes available to ivl_target API.
|
||||
*
|
||||
* Revision 1.18 2000/11/11 00:03:36 steve
|
||||
* Add support for the t-dll backend grabing flip-flops.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.25 2000/11/12 17:47:29 steve Exp $"
|
||||
#ident "$Id: stub.c,v 1.26 2000/12/05 06:29:33 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -270,6 +270,8 @@ static void show_signal(ivl_signal_t net)
|
|||
fprintf(out, " [%u]: nexus=%s\n", pin, ivl_nexus_name(nex));
|
||||
|
||||
for (idx = 0 ; idx < ivl_nexus_ptrs(nex) ; idx += 1) {
|
||||
ivl_net_logic_t log;
|
||||
ivl_lpm_t lpm;
|
||||
ivl_signal_t sig;
|
||||
ivl_nexus_ptr_t ptr = ivl_nexus_ptr(nex, idx);
|
||||
|
||||
|
|
@ -278,6 +280,14 @@ static void show_signal(ivl_signal_t net)
|
|||
ivl_signal_name(sig),
|
||||
ivl_nexus_ptr_pin(ptr));
|
||||
|
||||
} else if ((log = ivl_nexus_ptr_log(ptr))) {
|
||||
fprintf(out, " %s[%u]\n",
|
||||
ivl_logic_name(log),
|
||||
ivl_nexus_ptr_pin(ptr));
|
||||
|
||||
} else if ((lpm = ivl_nexus_ptr_lpm(ptr))) {
|
||||
fprintf(out, " LPM %s\n", ivl_lpm_name(lpm));
|
||||
|
||||
} else {
|
||||
fprintf(out, " ?[%u]\n", ivl_nexus_ptr_pin(ptr));
|
||||
}
|
||||
|
|
@ -299,6 +309,14 @@ static void show_logic(ivl_net_logic_t net)
|
|||
fprintf(out, " buf %s (%s", name,
|
||||
ivl_nexus_name(ivl_logic_pin(net, 0)));
|
||||
break;
|
||||
case IVL_LO_BUFIF0:
|
||||
fprintf(out, " bufif0 %s (%s", name,
|
||||
ivl_nexus_name(ivl_logic_pin(net, 0)));
|
||||
break;
|
||||
case IVL_LO_BUFIF1:
|
||||
fprintf(out, " bufif1 %s (%s", name,
|
||||
ivl_nexus_name(ivl_logic_pin(net, 0)));
|
||||
break;
|
||||
case IVL_LO_BUFZ:
|
||||
fprintf(out, " bufz %s (%s", name,
|
||||
ivl_nexus_name(ivl_logic_pin(net, 0)));
|
||||
|
|
@ -374,6 +392,9 @@ DECLARE_CYGWIN_DLL(DllMain);
|
|||
|
||||
/*
|
||||
* $Log: stub.c,v $
|
||||
* Revision 1.26 2000/12/05 06:29:33 steve
|
||||
* Make signal attributes available to ivl_target API.
|
||||
*
|
||||
* Revision 1.25 2000/11/12 17:47:29 steve
|
||||
* flip-flop pins for ivl_target API.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue