Add some ivl_target convenience functions.

This commit is contained in:
steve 2001-08-28 04:07:17 +00:00
parent b8be5e80cd
commit 2002c03cef
5 changed files with 83 additions and 11 deletions

View File

@ -41,11 +41,13 @@ ivl_expr_width
ivl_logic_name
ivl_logic_basename
ivl_logic_scope
ivl_logic_type
ivl_logic_pin
ivl_logic_pins
ivl_logic_udp
ivl_lpm_basename
ivl_lpm_clk
ivl_lpm_data
ivl_lpm_datab
@ -54,6 +56,7 @@ ivl_lpm_enable
ivl_lpm_memory
ivl_lpm_name
ivl_lpm_q
ivl_lpm_scope
ivl_lpm_select
ivl_lpm_selects
ivl_lpm_size
@ -88,6 +91,7 @@ ivl_nexus_ptr_lpm
ivl_nexus_ptr_log
ivl_nexus_ptr_sig
ivl_scope_basename
ivl_scope_children
ivl_scope_def
ivl_scope_event
@ -99,6 +103,7 @@ ivl_scope_lpm
ivl_scope_mem
ivl_scope_mems
ivl_scope_name
ivl_scope_parent
ivl_scope_port
ivl_scope_ports
ivl_scope_sigs

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.77 2001/08/25 23:50:03 steve Exp $"
#ident "$Id: ivl_target.h,v 1.78 2001/08/28 04:07:17 steve Exp $"
#endif
#ifdef __cplusplus
@ -456,12 +456,16 @@ extern ivl_memory_t ivl_expr_memory(ivl_expr_t net);
* ivl_logic_basename
* This is the name of the gate without the scope part.
*
* ivl_logic_scope
* This is the scope that directly contains the logic device.
*
* ivl_logic_pins
* ivl_logic_pin
*/
extern const char* ivl_logic_name(ivl_net_logic_t net);
extern const char* ivl_logic_basename(ivl_net_logic_t net);
extern ivl_scope_t ivl_logic_scope(ivl_net_logic_t net);
extern ivl_logic_t ivl_logic_type(ivl_net_logic_t net);
extern ivl_nexus_t ivl_logic_pin(ivl_net_logic_t net, unsigned pin);
extern unsigned ivl_logic_pins(ivl_net_logic_t net);
@ -487,7 +491,13 @@ extern const char* ivl_udp_name(ivl_udp_t net);
* These are the functions that apply to all LPM devices:
*
* ivl_lpm_name
* Return the name of the device.
* ivl_lpm_basename
* Return the name of the device. The name is the name of the
* device with the scope part, and the basename is without the scope.
*
* ivl_lpm_scope
* LPM devices exist within a scope. Return the scope that contains
* this device.
*
* ivl_lpm_type
* Return the ivl_lpm_type_t of the secific LPM device.
@ -524,6 +534,8 @@ extern const char* ivl_udp_name(ivl_udp_t net);
* per bit for a MUX.
*/
extern const char* ivl_lpm_name(ivl_lpm_t net);
extern const char* ivl_lpm_basename(ivl_lpm_t net);
extern ivl_scope_t ivl_lpm_scope(ivl_lpm_t net);
extern ivl_lpm_type_t ivl_lpm_type(ivl_lpm_t net);
extern unsigned ivl_lpm_width(ivl_lpm_t net);
@ -720,8 +732,15 @@ extern ivl_signal_t ivl_nexus_ptr_sig(ivl_nexus_ptr_t net);
* represented by ivl_logic_t.
*
* ivl_scope_name
* ivl_scope_basename
* Every scope has a hierarchical name. This name is also a prefix
* of all the names of objects contained within the scope.
* of all the names of objects contained within the scope. The
* ivl_scope_basename is the name of the scope without the included
* hierarchy.
*
* ivl_scope_parent
* If this is a non-root scope, then the parent is the scope that
* contains this scope. Otherwise, the parent is nil.
*
* ivl_scope_port
* ivl_scope_ports
@ -760,6 +779,8 @@ extern ivl_lpm_t ivl_scope_lpm(ivl_scope_t, unsigned idx);
extern unsigned ivl_scope_mems(ivl_scope_t net);
extern ivl_memory_t ivl_scope_mem(ivl_scope_t net, unsigned idx);
extern const char* ivl_scope_name(ivl_scope_t net);
extern const char* ivl_scope_basename(ivl_scope_t net);
extern ivl_scope_t ivl_scope_parent(ivl_scope_t net);
extern unsigned ivl_scope_ports(ivl_scope_t net);
extern ivl_signal_t ivl_scope_port(ivl_scope_t net, unsigned idx);
extern unsigned ivl_scope_sigs(ivl_scope_t net);
@ -923,6 +944,9 @@ _END_DECL
/*
* $Log: ivl_target.h,v $
* Revision 1.78 2001/08/28 04:07:17 steve
* Add some ivl_target convenience functions.
*
* Revision 1.77 2001/08/25 23:50:03 steve
* Change the NetAssign_ class to refer to the signal
* instead of link into the netlist. This is faster

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.63 2001/08/25 23:50:03 steve Exp $"
#ident "$Id: t-dll-api.cc,v 1.64 2001/08/28 04:07:18 steve Exp $"
#endif
# include "config.h"
@ -418,6 +418,12 @@ extern "C" const char* ivl_logic_basename(ivl_net_logic_t net)
return basename(net->scope_, net->name_);
}
extern "C" ivl_scope_t ivl_logic_scope(ivl_net_logic_t net)
{
assert(net);
return net->scope_;
}
extern "C" ivl_logic_t ivl_logic_type(ivl_net_logic_t net)
{
return net->type_;
@ -476,6 +482,11 @@ extern "C" const char* ivl_udp_name(ivl_udp_t net)
return net->name;
}
extern "C" const char* ivl_lpm_basename(ivl_lpm_t net)
{
return basename(net->scope, net->name);
}
extern "C" ivl_nexus_t ivl_lpm_clk(ivl_lpm_t net)
{
@ -614,6 +625,12 @@ extern "C" ivl_nexus_t ivl_lpm_q(ivl_lpm_t net, unsigned idx)
}
}
extern "C" ivl_scope_t ivl_lpm_scope(ivl_lpm_t net)
{
assert(net);
return net->scope;
}
extern "C" ivl_nexus_t ivl_lpm_select(ivl_lpm_t net, unsigned idx)
{
switch (net->type) {
@ -860,6 +877,16 @@ extern "C" ivl_statement_t ivl_process_stmt(ivl_process_t net)
return net->stmt_;
}
extern "C" const char* ivl_scope_basename(ivl_scope_t net)
{
assert(net);
if (net->parent == 0)
return net->name_;
return basename(net->parent, net->name_);
}
extern "C" int ivl_scope_children(ivl_scope_t net,
ivl_scope_f func,
void*cd)
@ -936,6 +963,12 @@ extern "C" const char* ivl_scope_name(ivl_scope_t net)
return net->name_;
}
extern "C" ivl_scope_t ivl_scope_parent(ivl_scope_t net)
{
assert(net);
return net->parent;
}
extern "C" unsigned ivl_scope_ports(ivl_scope_t net)
{
assert(net);
@ -1318,6 +1351,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
/*
* $Log: t-dll-api.cc,v $
* Revision 1.64 2001/08/28 04:07:18 steve
* Add some ivl_target convenience functions.
*
* Revision 1.63 2001/08/25 23:50:03 steve
* Change the NetAssign_ class to refer to the signal
* instead of link into the netlist. This is faster

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.57 2001/08/10 00:40:45 steve Exp $"
#ident "$Id: t-dll.cc,v 1.58 2001/08/28 04:07:41 steve Exp $"
#endif
# include "config.h"
@ -349,6 +349,7 @@ bool dll_target::start_design(const Design*des)
des_.root_->name_ = strdup(des->find_root_scope()->name().c_str());
des_.root_->child_ = 0;
des_.root_->sibling_ = 0;
des_.root_->parent = 0;
des_.root_->nsigs_ = 0;
des_.root_->sigs_ = 0;
des_.root_->nlog_ = 0;
@ -1275,6 +1276,7 @@ void dll_target::scope(const NetScope*net)
scope->name_ = strdup(net->name().c_str());
scope->child_ = 0;
scope->sibling_ = 0;
scope->parent = find_scope(des_.root_, net->parent());
scope->nsigs_ = 0;
scope->sigs_ = 0;
scope->nlog_ = 0;
@ -1309,11 +1311,10 @@ void dll_target::scope(const NetScope*net)
break;
}
ivl_scope_t parent = find_scope(des_.root_, net->parent());
assert(parent != 0);
assert(scope->parent != 0);
scope->sibling_= parent->child_;
parent->child_ = scope;
scope->sibling_= scope->parent->child_;
scope->parent->child_ = scope;
}
}
@ -1485,6 +1486,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
/*
* $Log: t-dll.cc,v $
* Revision 1.58 2001/08/28 04:07:41 steve
* Add some ivl_target convenience functions.
*
* Revision 1.57 2001/08/10 00:40:45 steve
* tgt-vvp generates code that skips nets as inputs.
*

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: t-dll.h,v 1.60 2001/08/25 23:50:03 steve Exp $"
#ident "$Id: t-dll.h,v 1.61 2001/08/28 04:07:41 steve Exp $"
#endif
# include "target.h"
@ -428,7 +428,7 @@ struct ivl_process_s {
* there.
*/
struct ivl_scope_s {
ivl_scope_t child_, sibling_;
ivl_scope_t child_, sibling_, parent;
char* name_;
const char* tname_;
@ -562,6 +562,9 @@ struct ivl_statement_s {
/*
* $Log: t-dll.h,v $
* Revision 1.61 2001/08/28 04:07:41 steve
* Add some ivl_target convenience functions.
*
* Revision 1.60 2001/08/25 23:50:03 steve
* Change the NetAssign_ class to refer to the signal
* instead of link into the netlist. This is faster