Get at gate information for ivl_target interface.

This commit is contained in:
steve 2000-08-26 00:54:03 +00:00
parent df113f962b
commit 8876cda37f
6 changed files with 110 additions and 14 deletions

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.4 2000/08/20 04:13:57 steve Exp $"
#ident "$Id: ivl_target.h,v 1.5 2000/08/26 00:54:03 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_nexus_s *ivl_nexus_t;
typedef struct ivl_process_s *ivl_process_t;
typedef struct ivl_scope_s *ivl_scope_t;
@ -80,13 +81,30 @@ typedef struct ivl_scope_s *ivl_scope_t;
of the output file. */
extern const char* ivl_get_flag(ivl_design_t, const char*key);
extern const char* ivl_get_root_name(ivl_design_t net);
/* LOGIC
* These types and functions support manipulation of logic gates. The
* ivl_logit_t enumeration identifies the various kinds of gates that
* the ivl_net_logic_t can represent. The various functions then
* provide access to the various bits of information for a given logic
* device.
*/
/* Given an ivl_net_logic_t cookie, get the type of the gate. */
typedef enum ivl_logic_e { IVL_AND, IVL_BUF, IVL_BUFIF0, IVL_BUFIF1,
IVL_NAND, IVL_NOR, IVL_NOT, IVL_NOTIF0,
IVL_NOTIF1, IVL_OR, IVL_XNOR, IVL_XOR } ivl_logic_t;
extern ivl_logic_t ivl_get_logic_type(ivl_net_logic_t net);
extern ivl_nexus_t ivl_get_logic_pin(ivl_net_logic_t net, unsigned pin);
extern unsigned ivl_get_logic_pins(ivl_net_logic_t net);
/* NEXUS
* connections of signals and nodes is handled by single-bit
* nexus. These functions manage the ivl_nexus_t object.
*/
const char* ivl_get_nexus_name(ivl_nexus_t net);
/* TARGET MODULE ENTRY POINTS
@ -180,6 +198,9 @@ _END_DECL
/*
* $Log: ivl_target.h,v $
* Revision 1.5 2000/08/26 00:54:03 steve
* Get at gate information for ivl_target interface.
*
* Revision 1.4 2000/08/20 04:13:57 steve
* Add ivl_target support for logic gates, and
* make the interface more accessible.

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: net_design.cc,v 1.14 2000/08/12 17:59:48 steve Exp $"
#ident "$Id: net_design.cc,v 1.15 2000/08/26 00:54:03 steve Exp $"
#endif
/*
@ -100,6 +100,12 @@ NetScope* Design::find_root_scope()
return root_scope_;
}
const NetScope* Design::find_root_scope() const
{
assert(root_scope_);
return root_scope_;
}
/*
* This method locates a scope in the design, given its rooted
* heirarchical name. Each component of the key is used to scan one
@ -483,6 +489,9 @@ void Design::delete_process(NetProcTop*top)
/*
* $Log: net_design.cc,v $
* Revision 1.15 2000/08/26 00:54:03 steve
* Get at gate information for ivl_target interface.
*
* Revision 1.14 2000/08/12 17:59:48 steve
* Limit signal scope search at module boundaries.
*

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: net_link.cc,v 1.2 2000/07/14 06:12:57 steve Exp $"
#ident "$Id: net_link.cc,v 1.3 2000/08/26 00:54:03 steve Exp $"
#endif
# include "netlist.h"
@ -198,12 +198,15 @@ unsigned Link::get_inst() const
Nexus::Nexus()
{
name_ = 0;
list_ = 0;
}
Nexus::~Nexus()
{
assert(list_ == 0);
if (name_)
delete[]name_;
}
verinum::V Nexus::get_init() const
@ -223,6 +226,11 @@ verinum::V Nexus::get_init() const
void Nexus::unlink(Link*that)
{
if (name_) {
delete[] name_;
name_ = 0;
}
assert(that);
if (list_ == that) {
list_ = that->next_;
@ -244,6 +252,11 @@ void Nexus::unlink(Link*that)
void Nexus::relink(Link*that)
{
if (name_) {
delete[] name_;
name_ = 0;
}
assert(that->nexus_ == 0);
assert(that->next_ == 0);
that->next_ = list_;
@ -261,8 +274,11 @@ const Link* Nexus::first_nlink() const
return list_;
}
string Nexus::name() const
const char* Nexus::name() const
{
if (name_)
return name_;
const NetNet*sig = 0;
unsigned pin = 0;
for (const Link*cur = first_nlink()
@ -314,11 +330,16 @@ string Nexus::name() const
tmp << "<" << pin << ">";
tmp << ends;
return tmp.str();
name_ = new char[strlen(tmp.str()) + 1];
strcpy(name_, tmp.str());
return name_;
}
/*
* $Log: net_link.cc,v $
* Revision 1.3 2000/08/26 00:54:03 steve
* Get at gate information for ivl_target interface.
*
* Revision 1.2 2000/07/14 06:12:57 steve
* Move inital value handling from NetNet to Nexus
* objects. This allows better propogation of inital

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: netlist.h,v 1.156 2000/08/14 04:39:57 steve Exp $"
#ident "$Id: netlist.h,v 1.157 2000/08/26 00:54:03 steve Exp $"
#endif
/*
@ -230,7 +230,7 @@ class Nexus {
explicit Nexus();
~Nexus();
string name() const;
const char* name() const;
verinum::V get_init() const;
Link*first_nlink();
@ -241,6 +241,8 @@ class Nexus {
void unlink(Link*);
void relink(Link*);
mutable char* name_; /* Cache the calculated name for the Nexus. */
private: // not implemented
Nexus(const Nexus&);
Nexus& operator= (const Nexus&);
@ -2586,6 +2588,8 @@ class Design {
NetScope* make_root_scope(const string&name);
NetScope* find_root_scope();
const NetScope* find_root_scope() const;
/* Attempt to set the precision to the specified value. If the
precision is already more precise, the keep the precise
@ -2722,6 +2726,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
* Revision 1.157 2000/08/26 00:54:03 steve
* Get at gate information for ivl_target interface.
*
* Revision 1.156 2000/08/14 04:39:57 steve
* add th t-dll functions for net_const, net_bufz and processes.
*

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.cc,v 1.4 2000/08/20 04:13:57 steve Exp $"
#ident "$Id: t-dll.cc,v 1.5 2000/08/26 00:54:03 steve Exp $"
#endif
# include "target.h"
@ -235,6 +235,11 @@ extern "C" const char*ivl_get_flag(ivl_design_t des, const char*key)
return des->des_->get_flag(key).c_str();
}
extern "C" const char*ivl_get_root_name(ivl_design_t des)
{
return des->des_->find_root_scope()->name().c_str();
}
extern "C" ivl_logic_t ivl_get_logic_type(ivl_net_logic_t net)
{
switch (net->dev_->type()) {
@ -247,8 +252,27 @@ extern "C" ivl_logic_t ivl_get_logic_type(ivl_net_logic_t net)
return IVL_AND;
}
extern "C" unsigned ivl_get_logic_pins(ivl_net_logic_t net)
{
return net->dev_->pin_count();
}
extern "C" ivl_nexus_t ivl_get_logic_pin(ivl_net_logic_t net, unsigned pin)
{
return (ivl_nexus_t) (net->dev_->pin(pin).nexus());
}
extern "C" const char* ivl_get_nexus_name(ivl_nexus_t net)
{
const Nexus*nex = (const Nexus*)net;
return nex->name();
}
/*
* $Log: t-dll.cc,v $
* Revision 1.5 2000/08/26 00:54:03 steve
* Get at gate information for ivl_target interface.
*
* Revision 1.4 2000/08/20 04:13:57 steve
* Add ivl_target support for logic gates, and
* make the interface more accessible.

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.4 2000/08/20 04:13:57 steve Exp $"
#ident "$Id: stub.c,v 1.5 2000/08/26 00:54:03 steve Exp $"
#endif
/*
@ -45,13 +45,13 @@ int target_start_design(ivl_design_t des)
return -2;
}
fprintf(out, "STUB: start_design\n");
fprintf(out, "module %s;\n", ivl_get_root_name(des));
return 0;
}
void target_end_design(ivl_design_t des)
{
fprintf(out, "STUB: end_design\n");
fprintf(out, "endmodule\n");
fclose(out);
}
@ -75,18 +75,29 @@ int target_net_event(const char*name, ivl_net_event_t net)
int target_net_logic(const char*name, ivl_net_logic_t net)
{
unsigned npins, idx;
switch (ivl_get_logic_type(net)) {
case IVL_AND:
fprintf(out, "STUB: %s: AND gate\n", name);
fprintf(out, " and %s (%s", name,
ivl_get_nexus_name(ivl_get_logic_pin(net, 0)));
break;
case IVL_OR:
fprintf(out, "STUB: %s: OR gate\n", name);
fprintf(out, " or %s (%s", name,
ivl_get_nexus_name(ivl_get_logic_pin(net, 0)));
break;
default:
fprintf(out, "STUB: %s: unsupported gate\n", name);
return -1;
}
npins = ivl_get_logic_pins(net);
for (idx = 1 ; idx < npins ; idx += 1)
fprintf(out, ", %s",
ivl_get_nexus_name(ivl_get_logic_pin(net,idx)));
fprintf(out, ");\n");
return 0;
}
@ -103,6 +114,9 @@ int target_process(ivl_process_t net)
/*
* $Log: stub.c,v $
* Revision 1.5 2000/08/26 00:54:03 steve
* Get at gate information for ivl_target interface.
*
* Revision 1.4 2000/08/20 04:13:57 steve
* Add ivl_target support for logic gates, and
* make the interface more accessible.