Reduce the while loop expression if needed.
This commit is contained in:
parent
4502da608d
commit
d482da4803
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT)
|
#if !defined(WINNT)
|
||||||
#ident "$Id: eval_expr.c,v 1.57 2002/04/14 18:41:34 steve Exp $"
|
#ident "$Id: eval_expr.c,v 1.58 2002/04/22 02:41:30 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "vvp_priv.h"
|
# include "vvp_priv.h"
|
||||||
|
|
@ -72,7 +72,7 @@ void clr_vector(struct vector_info vec)
|
||||||
clr_bit(vec.base + idx);
|
clr_bit(vec.base + idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned short allocate_vector(unsigned short wid)
|
unsigned short allocate_vector(unsigned short wid)
|
||||||
{
|
{
|
||||||
unsigned short base = 8;
|
unsigned short base = 8;
|
||||||
|
|
||||||
|
|
@ -1506,6 +1506,9 @@ struct vector_info draw_eval_expr(ivl_expr_t exp)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: eval_expr.c,v $
|
* $Log: eval_expr.c,v $
|
||||||
|
* Revision 1.58 2002/04/22 02:41:30 steve
|
||||||
|
* Reduce the while loop expression if needed.
|
||||||
|
*
|
||||||
* Revision 1.57 2002/04/14 18:41:34 steve
|
* Revision 1.57 2002/04/14 18:41:34 steve
|
||||||
* Support signed integer division.
|
* Support signed integer division.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT)
|
#if !defined(WINNT)
|
||||||
#ident "$Id: vvp_priv.h,v 1.12 2001/11/01 04:26:57 steve Exp $"
|
#ident "$Id: vvp_priv.h,v 1.13 2002/04/22 02:41:30 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "ivl_target.h"
|
# include "ivl_target.h"
|
||||||
|
|
@ -78,6 +78,7 @@ extern struct vector_info draw_eval_expr(ivl_expr_t exp);
|
||||||
extern struct vector_info draw_eval_expr_wid(ivl_expr_t exp, unsigned w);
|
extern struct vector_info draw_eval_expr_wid(ivl_expr_t exp, unsigned w);
|
||||||
extern void draw_memory_index_expr(ivl_memory_t mem, ivl_expr_t exp);
|
extern void draw_memory_index_expr(ivl_memory_t mem, ivl_expr_t exp);
|
||||||
|
|
||||||
|
extern unsigned short allocate_vector(unsigned short wid);
|
||||||
extern void clr_vector(struct vector_info vec);
|
extern void clr_vector(struct vector_info vec);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -88,6 +89,9 @@ extern unsigned thread_count;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: vvp_priv.h,v $
|
* $Log: vvp_priv.h,v $
|
||||||
|
* Revision 1.13 2002/04/22 02:41:30 steve
|
||||||
|
* Reduce the while loop expression if needed.
|
||||||
|
*
|
||||||
* Revision 1.12 2001/11/01 04:26:57 steve
|
* Revision 1.12 2001/11/01 04:26:57 steve
|
||||||
* Generate code for deassign and cassign.
|
* Generate code for deassign and cassign.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT)
|
#if !defined(WINNT)
|
||||||
#ident "$Id: vvp_process.c,v 1.56 2002/04/21 22:31:02 steve Exp $"
|
#ident "$Id: vvp_process.c,v 1.57 2002/04/22 02:41:30 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "vvp_priv.h"
|
# include "vvp_priv.h"
|
||||||
|
|
@ -786,6 +786,36 @@ static int show_stmt_wait(ivl_statement_t net, ivl_scope_t sscope)
|
||||||
return show_statement(ivl_stmt_sub_stmt(net), sscope);
|
return show_statement(ivl_stmt_sub_stmt(net), sscope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct vector_info reduction_or(struct vector_info cvec)
|
||||||
|
{
|
||||||
|
struct vector_info result;
|
||||||
|
|
||||||
|
switch (cvec.base) {
|
||||||
|
case 0:
|
||||||
|
result.base = 0;
|
||||||
|
result.wid = 1;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
result.base = 1;
|
||||||
|
result.wid = 1;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
result.base = 0;
|
||||||
|
result.wid = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
clr_vector(cvec);
|
||||||
|
result.base = allocate_vector(1);
|
||||||
|
result.wid = 1;
|
||||||
|
fprintf(vvp_out, " %%or/r %u, %u, %u;\n", result.base,
|
||||||
|
cvec.base, cvec.wid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static int show_stmt_while(ivl_statement_t net, ivl_scope_t sscope)
|
static int show_stmt_while(ivl_statement_t net, ivl_scope_t sscope)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
@ -800,6 +830,9 @@ static int show_stmt_while(ivl_statement_t net, ivl_scope_t sscope)
|
||||||
the result. If the expression evaluates to false, then
|
the result. If the expression evaluates to false, then
|
||||||
branch to the out label. */
|
branch to the out label. */
|
||||||
cvec = draw_eval_expr(ivl_stmt_cond_expr(net));
|
cvec = draw_eval_expr(ivl_stmt_cond_expr(net));
|
||||||
|
if (cvec.wid > 1)
|
||||||
|
cvec = reduction_or(cvec);
|
||||||
|
|
||||||
fprintf(vvp_out, " %%jmp/0xz T_%d.%d, %u;\n",
|
fprintf(vvp_out, " %%jmp/0xz T_%d.%d, %u;\n",
|
||||||
thread_count, out_label, cvec.base);
|
thread_count, out_label, cvec.base);
|
||||||
clr_vector(cvec);
|
clr_vector(cvec);
|
||||||
|
|
@ -1135,6 +1168,9 @@ int draw_func_definition(ivl_scope_t scope)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: vvp_process.c,v $
|
* $Log: vvp_process.c,v $
|
||||||
|
* Revision 1.57 2002/04/22 02:41:30 steve
|
||||||
|
* Reduce the while loop expression if needed.
|
||||||
|
*
|
||||||
* Revision 1.56 2002/04/21 22:31:02 steve
|
* Revision 1.56 2002/04/21 22:31:02 steve
|
||||||
* Redo handling of assignment internal delays.
|
* Redo handling of assignment internal delays.
|
||||||
* Leave it possible for them to be calculated
|
* Leave it possible for them to be calculated
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue