Special handling of exploded memory arguments.
This commit is contained in:
parent
79add47002
commit
4ec8b38a5c
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: t-dll-expr.cc,v 1.39.2.1 2006/03/12 07:34:19 steve Exp $"
|
||||
#ident "$Id: t-dll-expr.cc,v 1.39.2.2 2006/09/15 23:56:05 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -226,44 +226,59 @@ void dll_target::expr_memory(const NetEMemory*net)
|
|||
|
||||
if (const NetNet*reg = mem->reg_from_explode()) {
|
||||
|
||||
cur->type_ = IVL_EX_SELECT;
|
||||
cur->value_ = IVL_VT_VECTOR;
|
||||
cur->width_ = net->expr_width();
|
||||
cur->signed_ = net->has_sign()? 1 : 0;
|
||||
if (expr_ == 0) {
|
||||
// If there is no index expression for the
|
||||
// exploded memory, then replace it with the
|
||||
// entire exploded reg.
|
||||
cur->type_ = IVL_EX_SIGNAL;
|
||||
cur->value_ = IVL_VT_VECTOR;
|
||||
cur->width_= reg->pin_count();
|
||||
cur->signed_ = net->has_sign()? 1 : 0;
|
||||
cur->u_.signal_.sig = find_signal(des_, reg);
|
||||
cur->u_.signal_.lsi = 0;
|
||||
cur->u_.signal_.msi = cur->width_ - 1;
|
||||
|
||||
// Create an expression form of the exploded
|
||||
// memory. This is what the select will apply to.
|
||||
ivl_expr_t sig = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
|
||||
sig->type_ = IVL_EX_SIGNAL;
|
||||
sig->value_ = IVL_VT_VECTOR;
|
||||
sig->width_ = reg->pin_count();
|
||||
sig->signed_ = 0;
|
||||
sig->u_.signal_.sig = find_signal(des_, reg);
|
||||
sig->u_.signal_.lsi = 0;
|
||||
sig->u_.signal_.msi = reg->pin_count()-1;
|
||||
cur->u_.binary_.lef_ = sig;
|
||||
} else {
|
||||
cur->type_ = IVL_EX_SELECT;
|
||||
cur->value_ = IVL_VT_VECTOR;
|
||||
cur->width_ = net->expr_width();
|
||||
cur->signed_ = net->has_sign()? 1 : 0;
|
||||
|
||||
// Create an expression of the address calculation.
|
||||
cur->u_.binary_.rig_ = expr_;
|
||||
// Create an expression form of the exploded
|
||||
// memory. This is what the select will apply to.
|
||||
ivl_expr_t sig = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
|
||||
sig->type_ = IVL_EX_SIGNAL;
|
||||
sig->value_ = IVL_VT_VECTOR;
|
||||
sig->width_ = reg->pin_count();
|
||||
sig->signed_ = 0;
|
||||
sig->u_.signal_.sig = find_signal(des_, reg);
|
||||
assert(sig->u_.signal_.sig);
|
||||
sig->u_.signal_.lsi = 0;
|
||||
sig->u_.signal_.msi = reg->pin_count()-1;
|
||||
cur->u_.binary_.lef_ = sig;
|
||||
|
||||
if (cur->width_ > 1) {
|
||||
ivl_expr_t mul = (ivl_expr_t)calloc(2, sizeof(struct ivl_expr_s));
|
||||
ivl_expr_t fac = mul+1;
|
||||
// Create an expression of the address calculation.
|
||||
cur->u_.binary_.rig_ = expr_;
|
||||
|
||||
fac->type_ = IVL_EX_ULONG;
|
||||
fac->value_ = IVL_VT_VECTOR;
|
||||
fac->width_ = 8*sizeof(cur->width_);
|
||||
fac->signed_= 0;
|
||||
fac->u_.ulong_.value = cur->width_;
|
||||
if (cur->width_ > 1) {
|
||||
ivl_expr_t mul = (ivl_expr_t)calloc(2, sizeof(struct ivl_expr_s));
|
||||
ivl_expr_t fac = mul+1;
|
||||
|
||||
mul->type_ = IVL_EX_BINARY;
|
||||
mul->value_ = IVL_VT_VECTOR;
|
||||
mul->width_ = fac->width_;
|
||||
mul->signed_= 0;
|
||||
mul->u_.binary_.op_ = '*';
|
||||
mul->u_.binary_.lef_ = cur->u_.binary_.rig_;
|
||||
mul->u_.binary_.rig_ = fac;
|
||||
cur->u_.binary_.rig_ = mul;
|
||||
fac->type_ = IVL_EX_ULONG;
|
||||
fac->value_ = IVL_VT_VECTOR;
|
||||
fac->width_ = 8*sizeof(cur->width_);
|
||||
fac->signed_= 0;
|
||||
fac->u_.ulong_.value = cur->width_;
|
||||
|
||||
mul->type_ = IVL_EX_BINARY;
|
||||
mul->value_ = IVL_VT_VECTOR;
|
||||
mul->width_ = fac->width_;
|
||||
mul->signed_= 0;
|
||||
mul->u_.binary_.op_ = '*';
|
||||
mul->u_.binary_.lef_ = cur->u_.binary_.rig_;
|
||||
mul->u_.binary_.rig_ = fac;
|
||||
cur->u_.binary_.rig_ = mul;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -650,6 +665,9 @@ void dll_target::expr_variable(const NetEVariable*net)
|
|||
|
||||
/*
|
||||
* $Log: t-dll-expr.cc,v $
|
||||
* Revision 1.39.2.2 2006/09/15 23:56:05 steve
|
||||
* Special handling of exploded memory arguments.
|
||||
*
|
||||
* Revision 1.39.2.1 2006/03/12 07:34:19 steve
|
||||
* Fix the memsynth1 case.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: stub.c,v 1.90.2.10 2006/07/23 19:42:35 steve Exp $"
|
||||
#ident "$Id: stub.c,v 1.90.2.11 2006/09/15 23:56:05 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -81,12 +81,21 @@ static void show_expression(ivl_expr_t net, unsigned ind)
|
|||
show_expression(ivl_expr_oper1(net), ind+3);
|
||||
break;
|
||||
|
||||
case IVL_EX_BINARY:
|
||||
fprintf(out, "%*s<\"%c\" width=%u, %s, type=%s>\n", ind, "",
|
||||
ivl_expr_opcode(net), width, sign, vt);
|
||||
show_expression(ivl_expr_oper1(net), ind+3);
|
||||
show_expression(ivl_expr_oper2(net), ind+3);
|
||||
break;
|
||||
case IVL_EX_BINARY: {
|
||||
ivl_expr_t oper1 = ivl_expr_oper1(net);
|
||||
ivl_expr_t oper2 = ivl_expr_oper2(net);
|
||||
fprintf(out, "%*s<\"%c\" width=%u, %s, type=%s>\n", ind, "",
|
||||
ivl_expr_opcode(net), width, sign, vt);
|
||||
if (oper1)
|
||||
show_expression(oper1, ind+3);
|
||||
else
|
||||
fprintf(out, "%*sERROR: nil oper1\n", ind+3, "");
|
||||
if (oper2)
|
||||
show_expression(oper2, ind+3);
|
||||
else
|
||||
fprintf(out, "%*sERROR: nil oper2\n", ind+3, "");
|
||||
break;
|
||||
}
|
||||
|
||||
case IVL_EX_CONCAT:
|
||||
fprintf(out, "%*s<concat repeat=%u, width=%u, %s, type=%s>\n",
|
||||
|
|
@ -122,9 +131,13 @@ static void show_expression(ivl_expr_t net, unsigned ind)
|
|||
/* The SELECT expression can be used to express part
|
||||
select, or if the base is null vector extension. */
|
||||
if (ivl_expr_oper2(net)) {
|
||||
ivl_expr_t o1 = ivl_expr_oper1(net);
|
||||
fprintf(out, "%*s<select: width=%u, %s>\n", ind, "",
|
||||
width, sign);
|
||||
show_expression(ivl_expr_oper1(net), ind+3);
|
||||
if (o1)
|
||||
show_expression(ivl_expr_oper1(net), ind+3);
|
||||
else
|
||||
fprintf(out, "%*sERROR: Missing oper1\n", ind+3, "");
|
||||
show_expression(ivl_expr_oper2(net), ind+3);
|
||||
} else {
|
||||
fprintf(out, "%*s<expr pad: width=%u, %s>\n", ind, "",
|
||||
|
|
@ -1118,6 +1131,9 @@ int target_design(ivl_design_t des)
|
|||
|
||||
/*
|
||||
* $Log: stub.c,v $
|
||||
* Revision 1.90.2.11 2006/09/15 23:56:05 steve
|
||||
* Special handling of exploded memory arguments.
|
||||
*
|
||||
* Revision 1.90.2.10 2006/07/23 19:42:35 steve
|
||||
* Handle statement output override better in blocks.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue