Make constants available through the design root
This commit is contained in:
parent
a9e54e7553
commit
d762a320dc
2
ivl.def
2
ivl.def
|
|
@ -1,5 +1,7 @@
|
|||
EXPORTS
|
||||
|
||||
ivl_design_const
|
||||
ivl_design_consts
|
||||
ivl_design_flag
|
||||
ivl_design_process
|
||||
ivl_design_root
|
||||
|
|
|
|||
30
ivl_target.h
30
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.79 2001/08/31 22:58:39 steve Exp $"
|
||||
#ident "$Id: ivl_target.h,v 1.80 2001/09/01 01:57:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -203,16 +203,18 @@ typedef enum ivl_logic_e {
|
|||
|
||||
/* This is the type of an LPM object. */
|
||||
typedef enum ivl_lpm_type_e {
|
||||
IVL_LPM_ADD,
|
||||
IVL_LPM_CMP_GE,
|
||||
IVL_LPM_CMP_GT,
|
||||
IVL_LPM_FF,
|
||||
IVL_LPM_MULT,
|
||||
IVL_LPM_MUX,
|
||||
IVL_LPM_SHIFTL,
|
||||
IVL_LPM_SHIFTR,
|
||||
IVL_LPM_SUB,
|
||||
IVL_LPM_RAM
|
||||
IVL_LPM_ADD = 0,
|
||||
IVL_LPM_CMP_EQ = 10,
|
||||
IVL_LPM_CMP_GE = 1,
|
||||
IVL_LPM_CMP_GT = 2,
|
||||
IVL_LPM_CMP_NE = 11,
|
||||
IVL_LPM_FF = 3,
|
||||
IVL_LPM_MULT = 4,
|
||||
IVL_LPM_MUX = 5,
|
||||
IVL_LPM_SHIFTL = 6,
|
||||
IVL_LPM_SHIFTR = 7,
|
||||
IVL_LPM_SUB = 8,
|
||||
IVL_LPM_RAM = 9
|
||||
} ivl_lpm_type_t;
|
||||
|
||||
/* Processes are initial or always blocks with a statement. This is
|
||||
|
|
@ -331,6 +333,9 @@ extern int ivl_design_process(ivl_design_t des,
|
|||
extern ivl_scope_t ivl_design_root(ivl_design_t des);
|
||||
extern int ivl_design_time_precision(ivl_design_t des);
|
||||
|
||||
extern unsigned ivl_design_consts(ivl_design_t des);
|
||||
extern ivl_net_const_t ivl_design_const(ivl_design_t, unsigned idx);
|
||||
|
||||
/*
|
||||
* These methods apply to ivl_net_const_t objects.
|
||||
*/
|
||||
|
|
@ -944,6 +949,9 @@ _END_DECL
|
|||
|
||||
/*
|
||||
* $Log: ivl_target.h,v $
|
||||
* Revision 1.80 2001/09/01 01:57:31 steve
|
||||
* Make constants available through the design root
|
||||
*
|
||||
* Revision 1.79 2001/08/31 22:58:39 steve
|
||||
* Support DFF CE inputs.
|
||||
*
|
||||
|
|
|
|||
24
t-dll-api.cc
24
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.65 2001/08/31 22:58:40 steve Exp $"
|
||||
#ident "$Id: t-dll-api.cc,v 1.66 2001/09/01 01:57:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -54,6 +54,17 @@ extern "C" int ivl_design_time_precision(ivl_design_t des)
|
|||
return des->time_precision;
|
||||
}
|
||||
|
||||
extern "C" unsigned ivl_design_consts(ivl_design_t des)
|
||||
{
|
||||
return des->nconsts;
|
||||
}
|
||||
|
||||
extern "C" ivl_net_const_t ivl_design_const(ivl_design_t des, unsigned idx)
|
||||
{
|
||||
assert(idx < des->nconsts);
|
||||
return des->consts[idx];
|
||||
}
|
||||
|
||||
extern "C" ivl_expr_type_t ivl_expr_type(ivl_expr_t net)
|
||||
{
|
||||
if (net == 0)
|
||||
|
|
@ -519,8 +530,10 @@ extern "C" ivl_nexus_t ivl_lpm_data(ivl_lpm_t net, unsigned idx)
|
|||
assert(net);
|
||||
switch (net->type) {
|
||||
case IVL_LPM_ADD:
|
||||
case IVL_LPM_CMP_EQ:
|
||||
case IVL_LPM_CMP_GE:
|
||||
case IVL_LPM_CMP_GT:
|
||||
case IVL_LPM_CMP_NE:
|
||||
case IVL_LPM_MULT:
|
||||
case IVL_LPM_SUB:
|
||||
assert(idx < net->u_.arith.width);
|
||||
|
|
@ -551,8 +564,10 @@ extern "C" ivl_nexus_t ivl_lpm_datab(ivl_lpm_t net, unsigned idx)
|
|||
switch (net->type) {
|
||||
|
||||
case IVL_LPM_ADD:
|
||||
case IVL_LPM_CMP_EQ:
|
||||
case IVL_LPM_CMP_GE:
|
||||
case IVL_LPM_CMP_GT:
|
||||
case IVL_LPM_CMP_NE:
|
||||
case IVL_LPM_MULT:
|
||||
case IVL_LPM_SUB:
|
||||
assert(idx < net->u_.arith.width);
|
||||
|
|
@ -597,6 +612,8 @@ extern "C" ivl_nexus_t ivl_lpm_q(ivl_lpm_t net, unsigned idx)
|
|||
|
||||
case IVL_LPM_CMP_GE:
|
||||
case IVL_LPM_CMP_GT:
|
||||
case IVL_LPM_CMP_EQ:
|
||||
case IVL_LPM_CMP_NE:
|
||||
assert(idx == 0);
|
||||
return net->u_.arith.q[0];
|
||||
|
||||
|
|
@ -702,8 +719,10 @@ extern "C" unsigned ivl_lpm_width(ivl_lpm_t net)
|
|||
case IVL_LPM_MUX:
|
||||
return net->u_.mux.width;
|
||||
case IVL_LPM_ADD:
|
||||
case IVL_LPM_CMP_EQ:
|
||||
case IVL_LPM_CMP_GE:
|
||||
case IVL_LPM_CMP_GT:
|
||||
case IVL_LPM_CMP_NE:
|
||||
case IVL_LPM_MULT:
|
||||
case IVL_LPM_SUB:
|
||||
return net->u_.arith.width;
|
||||
|
|
@ -1352,6 +1371,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
|
|||
|
||||
/*
|
||||
* $Log: t-dll-api.cc,v $
|
||||
* Revision 1.66 2001/09/01 01:57:31 steve
|
||||
* Make constants available through the design root
|
||||
*
|
||||
* Revision 1.65 2001/08/31 22:58:40 steve
|
||||
* Support DFF CE inputs.
|
||||
*
|
||||
|
|
|
|||
32
t-dll.cc
32
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.59 2001/08/31 22:58:39 steve Exp $"
|
||||
#ident "$Id: t-dll.cc,v 1.60 2001/09/01 01:57:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -363,6 +363,10 @@ bool dll_target::start_design(const Design*des)
|
|||
des_.root_->type_ = IVL_SCT_MODULE;
|
||||
des_.root_->tname_ = des_.root_->name_;
|
||||
|
||||
des_.consts = (ivl_net_const_t*)
|
||||
malloc(sizeof(ivl_net_const_t));
|
||||
des_.nconsts = 0;
|
||||
|
||||
target_ = (target_design_f)ivl_dlsym(dll_, LU "target_design" TU);
|
||||
if (target_ == 0) {
|
||||
cerr << dll_path_ << ": error: target_design entry "
|
||||
|
|
@ -868,6 +872,24 @@ void dll_target::lpm_compare(const NetCompare*net)
|
|||
|
||||
swap_operands = true;
|
||||
|
||||
} else if (net->pin_AEB().is_linked()) {
|
||||
const Nexus*nex = net->pin_AEB().nexus();
|
||||
obj->type = IVL_LPM_CMP_EQ;
|
||||
|
||||
assert(nex->t_cookie());
|
||||
obj->u_.arith.q[0] = (ivl_nexus_t) nex->t_cookie();
|
||||
nexus_lpm_add(obj->u_.arith.q[0], obj, 0,
|
||||
IVL_DR_STRONG, IVL_DR_STRONG);
|
||||
|
||||
} else if (net->pin_ANEB().is_linked()) {
|
||||
const Nexus*nex = net->pin_AEB().nexus();
|
||||
obj->type = IVL_LPM_CMP_NE;
|
||||
|
||||
assert(nex->t_cookie());
|
||||
obj->u_.arith.q[0] = (ivl_nexus_t) nex->t_cookie();
|
||||
nexus_lpm_add(obj->u_.arith.q[0], obj, 0,
|
||||
IVL_DR_STRONG, IVL_DR_STRONG);
|
||||
|
||||
} else {
|
||||
assert(0);
|
||||
}
|
||||
|
|
@ -1268,6 +1290,11 @@ bool dll_target::net_const(const NetConst*net)
|
|||
}
|
||||
}
|
||||
|
||||
des_.nconsts += 1;
|
||||
des_.consts = (ivl_net_const_t*)
|
||||
realloc(des_.consts, des_.nconsts * sizeof(ivl_net_const_t));
|
||||
des_.consts[des_.nconsts-1] = obj;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1498,6 +1525,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
|
|||
|
||||
/*
|
||||
* $Log: t-dll.cc,v $
|
||||
* Revision 1.60 2001/09/01 01:57:31 steve
|
||||
* Make constants available through the design root
|
||||
*
|
||||
* Revision 1.59 2001/08/31 22:58:39 steve
|
||||
* Support DFF CE inputs.
|
||||
*
|
||||
|
|
|
|||
8
t-dll.h
8
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.62 2001/08/31 22:58:40 steve Exp $"
|
||||
#ident "$Id: t-dll.h,v 1.63 2001/09/01 01:57:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "target.h"
|
||||
|
|
@ -44,6 +44,9 @@ struct ivl_design_s {
|
|||
|
||||
ivl_process_t threads_;
|
||||
|
||||
ivl_net_const_t*consts;
|
||||
unsigned nconsts;
|
||||
|
||||
const Design*self;
|
||||
};
|
||||
|
||||
|
|
@ -562,6 +565,9 @@ struct ivl_statement_s {
|
|||
|
||||
/*
|
||||
* $Log: t-dll.h,v $
|
||||
* Revision 1.63 2001/09/01 01:57:31 steve
|
||||
* Make constants available through the design root
|
||||
*
|
||||
* Revision 1.62 2001/08/31 22:58:40 steve
|
||||
* Support DFF CE inputs.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue