Support attributes to logic gates.

This commit is contained in:
steve 2001-09-16 22:19:42 +00:00
parent cefbb635c1
commit e99059e001
5 changed files with 56 additions and 4 deletions

View File

@ -41,6 +41,7 @@ ivl_expr_string
ivl_expr_uvalue
ivl_expr_width
ivl_logic_attr
ivl_logic_name
ivl_logic_basename
ivl_logic_scope

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.81 2001/09/09 22:21:57 steve Exp $"
#ident "$Id: ivl_target.h,v 1.82 2001/09/16 22:19:42 steve Exp $"
#endif
#ifdef __cplusplus
@ -466,6 +466,10 @@ extern ivl_memory_t ivl_expr_memory(ivl_expr_t net);
*
* ivl_logic_pins
* ivl_logic_pin
*
* ivl_logic_attr
* Return the value of a specific attribute, given the key name as
* a string. If the key is not defined, then return 0 (null).
*/
extern const char* ivl_logic_name(ivl_net_logic_t net);
@ -476,6 +480,8 @@ extern ivl_nexus_t ivl_logic_pin(ivl_net_logic_t net, unsigned pin);
extern unsigned ivl_logic_pins(ivl_net_logic_t net);
extern ivl_udp_t ivl_logic_udp(ivl_net_logic_t net);
extern const char* ivl_logic_attr(ivl_net_logic_t net, const char*key);
/* UDP
*
*/
@ -949,6 +955,9 @@ _END_DECL
/*
* $Log: ivl_target.h,v $
* Revision 1.82 2001/09/16 22:19:42 steve
* Support attributes to logic gates.
*
* Revision 1.81 2001/09/09 22:21:57 steve
* pin down some enumerated constants.
*

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.66 2001/09/01 01:57:31 steve Exp $"
#ident "$Id: t-dll-api.cc,v 1.67 2001/09/16 22:19:42 steve Exp $"
#endif
# include "config.h"
@ -418,6 +418,20 @@ extern "C" ivl_memory_t ivl_expr_memory(ivl_expr_t net)
return net->u_.memory_.mem_;
}
extern "C" const char* ivl_logic_attr(ivl_net_logic_t net, const char*key)
{
assert(net);
unsigned idx;
for (idx = 0 ; idx < net->nattr_ ; idx += 1) {
if (strcmp(net->akey_[idx], key) == 0)
return net->aval_[idx];
}
return 0;
}
extern "C" const char* ivl_logic_name(ivl_net_logic_t net)
{
assert(net);
@ -1371,6 +1385,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
/*
* $Log: t-dll-api.cc,v $
* Revision 1.67 2001/09/16 22:19:42 steve
* Support attributes to logic gates.
*
* Revision 1.66 2001/09/01 01:57:31 steve
* Make constants available through the design root
*

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.63 2001/09/15 18:27:04 steve Exp $"
#ident "$Id: t-dll.cc,v 1.64 2001/09/16 22:19:42 steve Exp $"
#endif
# include "config.h"
@ -560,6 +560,21 @@ void dll_target::logic(const NetLogic*net)
obj->scope_= scope;
obj->name_ = strdup(net->name());
obj->nattr_ = net->nattr();
if (obj->nattr_ > 0) {
obj->akey_ = (char**)calloc(obj->nattr_, sizeof(char*));
obj->aval_ = (char**)calloc(obj->nattr_, sizeof(char*));
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));
}
} else {
obj->akey_ = 0;
obj->aval_ = 0;
}
scope_add_logic(scope, obj);
}
@ -1535,6 +1550,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
/*
* $Log: t-dll.cc,v $
* Revision 1.64 2001/09/16 22:19:42 steve
* Support attributes to logic gates.
*
* Revision 1.63 2001/09/15 18:27:04 steve
* Make configure detect malloc.h
*

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.63 2001/09/01 01:57:31 steve Exp $"
#ident "$Id: t-dll.h,v 1.64 2001/09/16 22:19:42 steve Exp $"
#endif
# include "target.h"
@ -346,6 +346,10 @@ struct ivl_net_logic_s {
unsigned npins_;
ivl_nexus_t*pins_;
char**akey_;
char**aval_;
unsigned nattr_;
};
@ -565,6 +569,9 @@ struct ivl_statement_s {
/*
* $Log: t-dll.h,v $
* Revision 1.64 2001/09/16 22:19:42 steve
* Support attributes to logic gates.
*
* Revision 1.63 2001/09/01 01:57:31 steve
* Make constants available through the design root
*