Handle bit selects in l-values to assignments.

This commit is contained in:
steve 2005-02-14 01:51:39 +00:00
parent c5e7e2ec0a
commit aaf35ab1a9
3 changed files with 27 additions and 16 deletions

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: ivl_target.h,v 1.141 2005/02/13 01:15:07 steve Exp $"
#ident "$Id: ivl_target.h,v 1.142 2005/02/14 01:51:39 steve Exp $"
#endif
#ifdef __cplusplus
@ -921,6 +921,18 @@ extern ivl_memory_t ivl_lpm_memory(ivl_lpm_t net);
* If the l-value is a memory, this method returns an
* ivl_expr_t that represents the index expression. Otherwise, it
* returns 0.
*
* SEMANTIC NOTES
* The ivl_lval_width is not necessarily the same as the width of the
* signal or memory word it represents. It is the width of the vector
* it receives and assigns. This may be less then the width of the
* signal (or even 1) if only a part of the l-value signal is to be
* assigned.
*
* The ivl_lval_part_off is the cannonical base of a constant part or
* bit select. If the bit select base is non-constant, then the
* ivl_lval_mux will contain an expression. If there is a mux
* expression, then the ivl_lval_part_off result can be ignored.
*/
extern unsigned ivl_lval_width(ivl_lval_t net);
@ -1504,6 +1516,9 @@ _END_DECL
/*
* $Log: ivl_target.h,v $
* Revision 1.142 2005/02/14 01:51:39 steve
* Handle bit selects in l-values to assignments.
*
* Revision 1.141 2005/02/13 01:15:07 steve
* Replace supply nets with wires connected to pullup/down supply devices.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: statement.c,v 1.3 2004/12/18 18:55:08 steve Exp $"
#ident "$Id: statement.c,v 1.4 2005/02/14 01:51:39 steve Exp $"
#endif
# include "config.h"
@ -52,7 +52,10 @@ static unsigned show_assign_lval(ivl_lval_t lval, unsigned ind)
ivl_signal_width(sig),
ivl_lval_part_off(lval),
ivl_lval_width(lval));
if (ivl_lval_mux(lval)) {
fprintf(out, "%*sBit select expression:\n", ind+4, "");
show_expression(ivl_lval_mux(lval), ind+8);
}
wid = ivl_lval_width(lval);
}

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vvp_process.c,v 1.98 2005/01/28 19:39:03 steve Exp $"
#ident "$Id: vvp_process.c,v 1.99 2005/02/14 01:51:39 steve Exp $"
#endif
# include "vvp_priv.h"
@ -82,18 +82,8 @@ static void set_to_lvariable(ivl_lval_t lval, unsigned idx,
if (ivl_lval_mux(lval)) {
assert(wid == 1);
if ((ivl_signal_pins(sig)-1) <= 0xffffU) {
fprintf(vvp_out, " %%set/x0 V_%s, %u, %u;\n",
vvp_signal_label(sig), bit, ivl_signal_pins(sig)-1);
} else {
/* If the target bound is too big for the %set/x0
instruction, then use the %set/x0/x instruction
instead. */
fprintf(vvp_out, " %%ix/load 3, %u;\n",
ivl_signal_pins(sig)-1);
fprintf(vvp_out, " %%set/x0/x V_%s, %u, 3;\n",
vvp_signal_label(sig), bit);
}
fprintf(vvp_out, " %%set/x0 V_%s, %u;\n",
vvp_signal_label(sig), bit);
} else {
fprintf(vvp_out, " %%set/v V_%s, %u, %u;\n",
@ -1560,6 +1550,9 @@ int draw_func_definition(ivl_scope_t scope)
/*
* $Log: vvp_process.c,v $
* Revision 1.99 2005/02/14 01:51:39 steve
* Handle bit selects in l-values to assignments.
*
* Revision 1.98 2005/01/28 19:39:03 steve
* Integrate fixes from 0.8 branch.
*