From a4d69e08da06522e098d907329b93dd8c6b24446 Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 5 Jun 2003 04:18:50 +0000 Subject: [PATCH] Better width testing for thread vector allocation. --- tgt-vvp/vector.c | 15 +++++++++------ tgt-vvp/vvp_priv.h | 10 ++++++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/tgt-vvp/vector.c b/tgt-vvp/vector.c index 36d743295..7b786431c 100644 --- a/tgt-vvp/vector.c +++ b/tgt-vvp/vector.c @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: vector.c,v 1.1 2002/09/27 16:33:34 steve Exp $" +#ident "$Id: vector.c,v 1.2 2003/06/05 04:18:50 steve Exp $" #endif # include "vvp_priv.h" @@ -70,11 +70,11 @@ void clr_vector(struct vector_info vec) * set. It never returns a bit addressed <8 (0-3 are constant, 4-7 are * condition codes). */ -unsigned short allocate_vector(unsigned short wid) +unsigned short allocate_vector(unsigned wid) { - unsigned short base = 8; + unsigned base = 8; + unsigned idx = 0; - unsigned short idx = 0; while (idx < wid) { assert((base + idx) < 0x10000); if (peek_bit(base+idx)) { @@ -156,7 +156,7 @@ static int compare_exp(ivl_expr_t l, ivl_expr_t r) } static unsigned short find_expression_lookaside(ivl_expr_t exp, - unsigned short wid) + unsigned wid) { unsigned top; unsigned idx, match; @@ -187,7 +187,7 @@ static unsigned short find_expression_lookaside(ivl_expr_t exp, return 0; } -unsigned short allocate_vector_exp(ivl_expr_t exp, unsigned short wid) +unsigned short allocate_vector_exp(ivl_expr_t exp, unsigned wid) { unsigned idx; unsigned short la = find_expression_lookaside(exp, wid); @@ -204,6 +204,9 @@ unsigned short allocate_vector_exp(ivl_expr_t exp, unsigned short wid) /* * $Log: vector.c,v $ + * Revision 1.2 2003/06/05 04:18:50 steve + * Better width testing for thread vector allocation. + * * Revision 1.1 2002/09/27 16:33:34 steve * Add thread expression lookaside map. * diff --git a/tgt-vvp/vvp_priv.h b/tgt-vvp/vvp_priv.h index c6378c991..141376b31 100644 --- a/tgt-vvp/vvp_priv.h +++ b/tgt-vvp/vvp_priv.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: vvp_priv.h,v 1.25 2003/03/15 04:45:18 steve Exp $" +#ident "$Id: vvp_priv.h,v 1.26 2003/06/05 04:18:50 steve Exp $" #endif # include "ivl_target.h" @@ -157,7 +157,7 @@ extern void draw_memory_index_expr(ivl_memory_t mem, ivl_expr_t exp); * lookaside. If it finds it, return a reallocated base for the * expression. Otherwise, return 0. */ -extern unsigned short allocate_vector(unsigned short wid); +extern unsigned short allocate_vector(unsigned wid); extern void clr_vector(struct vector_info vec); extern void clear_expression_lookaside(void); @@ -165,8 +165,7 @@ extern void save_expression_lookaside(unsigned short addr, ivl_expr_t exp, unsigned short wid); -extern unsigned short allocate_vector_exp(ivl_expr_t exp, - unsigned short wid); +extern unsigned short allocate_vector_exp(ivl_expr_t exp, unsigned wid); extern int number_is_unknown(ivl_expr_t ex); extern int number_is_immediate(ivl_expr_t ex, unsigned lim_wid); @@ -193,6 +192,9 @@ extern unsigned thread_count; /* * $Log: vvp_priv.h,v $ + * Revision 1.26 2003/06/05 04:18:50 steve + * Better width testing for thread vector allocation. + * * Revision 1.25 2003/03/15 04:45:18 steve * Allow real-valued vpi functions to have arguments. *