Remove short int restrictions from vvp opcodes.

This commit is contained in:
steve 2003-06-17 19:17:42 +00:00
parent bbdf03b457
commit 96ca885aca
8 changed files with 68 additions and 55 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: eval_expr.c,v 1.100 2003/06/16 22:14:15 steve Exp $"
#ident "$Id: eval_expr.c,v 1.101 2003/06/17 19:17:42 steve Exp $"
#endif
# include "vvp_priv.h"
@ -180,7 +180,7 @@ static struct vector_info draw_eq_immediate(ivl_expr_t exp, unsigned ewid,
uses. This is because that bit may be clobbered by other
expressions. */
if (lv.base < 8) {
unsigned short base = allocate_vector(ewid);
unsigned base = allocate_vector(ewid);
fprintf(vvp_out, " %%mov %u, %u, 1;\n", base, lv.base);
lv.base = base;
lv.wid = ewid;
@ -188,7 +188,7 @@ static struct vector_info draw_eq_immediate(ivl_expr_t exp, unsigned ewid,
fprintf(vvp_out, " %%mov %u, 0, %u;\n", base+1, ewid-1);
} else if (lv.wid < ewid) {
unsigned short base = allocate_vector(ewid);
unsigned base = allocate_vector(ewid);
if (lv.base >= 8)
clr_vector(lv);
fprintf(vvp_out, " %%mov %u, %u, %u;\n", base,
@ -348,7 +348,7 @@ static struct vector_info draw_binary_expr_eq(ivl_expr_t exp,
/* Move the result out out the 4-7 bit that the compare
uses. This is because that bit may be clobbered by other
expressions. */
{ unsigned short base = allocate_vector(ewid);
{ unsigned base = allocate_vector(ewid);
fprintf(vvp_out, " %%mov %u, %u, 1;\n", base, lv.base);
lv.base = base;
lv.wid = ewid;
@ -421,7 +421,7 @@ static struct vector_info draw_binary_expr_land(ivl_expr_t exp, unsigned wid)
return lv;
/* Write the result into a zero-padded result. */
{ unsigned short base = allocate_vector(wid);
{ unsigned base = allocate_vector(wid);
fprintf(vvp_out, " %%mov %u, %u, 1;\n", base, lv.base);
clr_vector(lv);
lv.base = base;
@ -499,7 +499,7 @@ static struct vector_info draw_binary_expr_lor(ivl_expr_t exp, unsigned wid)
return lv;
/* Write the result into a zero-padded result. */
{ unsigned short base = allocate_vector(wid);
{ unsigned base = allocate_vector(wid);
fprintf(vvp_out, " %%mov %u, %u, 1;\n", base, lv.base);
clr_vector(lv);
lv.base = base;
@ -627,7 +627,7 @@ static struct vector_info draw_binary_expr_le(ivl_expr_t exp,
/* Move the result out out the 4-7 bit that the compare
uses. This is because that bit may be clobbered by other
expressions. */
{ unsigned short base = allocate_vector(wid);
{ unsigned base = allocate_vector(wid);
fprintf(vvp_out, " %%mov %u, 5, 1;\n", base);
lv.base = base;
lv.wid = wid;
@ -2036,6 +2036,9 @@ struct vector_info draw_eval_expr(ivl_expr_t exp, int stuff_ok_flag)
/*
* $Log: eval_expr.c,v $
* Revision 1.101 2003/06/17 19:17:42 steve
* Remove short int restrictions from vvp opcodes.
*
* Revision 1.100 2003/06/16 22:14:15 steve
* Fix fprintf warning.
*

View File

@ -16,17 +16,24 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vector.c,v 1.2 2003/06/05 04:18:50 steve Exp $"
#ident "$Id: vector.c,v 1.3 2003/06/17 19:17:42 steve Exp $"
#endif
# include "vvp_priv.h"
# include <assert.h>
/* Maximum vector bits in a thread. If a thread co-processor is
* implemented, this value may need to be reduced. At that time
* wider operatons will need to be partitioned. For example
* shift operations on WIDE (say > 64k bit) registers.
*/
#define MAX_VEC (128*1024)
static struct allocation_score_s {
ivl_expr_t exp;
unsigned bit :16;
unsigned bit;
unsigned alloc : 1;
} allocation_map[0x10000] = { {0} };
} allocation_map[MAX_VEC] = { {0} };
/* This is the largest bit to have lookaside values. */
static unsigned lookaside_top = 0;
@ -70,13 +77,13 @@ 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 wid)
unsigned allocate_vector(unsigned wid)
{
unsigned base = 8;
unsigned idx = 0;
while (idx < wid) {
assert((base + idx) < 0x10000);
assert((base + idx) < MAX_VEC);
if (peek_bit(base+idx)) {
base = base + idx + 1;
idx = 0;
@ -109,12 +116,12 @@ void clear_expression_lookaside(void)
lookaside_top = 0;
}
void save_expression_lookaside(unsigned short addr, ivl_expr_t exp,
unsigned short wid)
void save_expression_lookaside(unsigned addr, ivl_expr_t exp,
unsigned wid)
{
unsigned idx;
assert(addr >= 8);
assert((addr+wid) <= 0x10000);
assert((addr+wid) <= MAX_VEC);
for (idx = 0 ; idx < wid ; idx += 1) {
allocation_map[addr+idx].exp = exp;
@ -155,7 +162,7 @@ static int compare_exp(ivl_expr_t l, ivl_expr_t r)
return 0;
}
static unsigned short find_expression_lookaside(ivl_expr_t exp,
static unsigned find_expression_lookaside(ivl_expr_t exp,
unsigned wid)
{
unsigned top;
@ -187,10 +194,10 @@ static unsigned short find_expression_lookaside(ivl_expr_t exp,
return 0;
}
unsigned short allocate_vector_exp(ivl_expr_t exp, unsigned wid)
unsigned allocate_vector_exp(ivl_expr_t exp, unsigned wid)
{
unsigned idx;
unsigned short la = find_expression_lookaside(exp, wid);
unsigned la = find_expression_lookaside(exp, wid);
for (idx = 0 ; idx < wid ; idx += 1)
if (allocation_map[la+idx].alloc)
@ -204,6 +211,9 @@ unsigned short allocate_vector_exp(ivl_expr_t exp, unsigned wid)
/*
* $Log: vector.c,v $
* Revision 1.3 2003/06/17 19:17:42 steve
* Remove short int restrictions from vvp opcodes.
*
* Revision 1.2 2003/06/05 04:18:50 steve
* Better width testing for thread vector allocation.
*

View File

@ -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.26 2003/06/05 04:18:50 steve Exp $"
#ident "$Id: vvp_priv.h,v 1.27 2003/06/17 19:17:42 steve Exp $"
#endif
# include "ivl_target.h"
@ -110,8 +110,8 @@ extern void draw_input_from_net(ivl_nexus_t nex);
* result in any of the 4-7 vthread bits.
*/
struct vector_info {
unsigned short base;
unsigned short wid;
unsigned base;
unsigned wid;
};
extern struct vector_info draw_eval_expr(ivl_expr_t exp, int stuff_ok_flag);
@ -157,15 +157,15 @@ 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 wid);
extern unsigned allocate_vector(unsigned wid);
extern void clr_vector(struct vector_info vec);
extern void clear_expression_lookaside(void);
extern void save_expression_lookaside(unsigned short addr,
extern void save_expression_lookaside(unsigned addr,
ivl_expr_t exp,
unsigned short wid);
unsigned wid);
extern unsigned short allocate_vector_exp(ivl_expr_t exp, unsigned wid);
extern unsigned 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);
@ -192,6 +192,9 @@ extern unsigned thread_count;
/*
* $Log: vvp_priv.h,v $
* Revision 1.27 2003/06/17 19:17:42 steve
* Remove short int restrictions from vvp opcodes.
*
* Revision 1.26 2003/06/05 04:18:50 steve
* Better width testing for thread vector allocation.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: codes.h,v 1.61 2003/05/26 04:44:54 steve Exp $"
#ident "$Id: codes.h,v 1.62 2003/06/17 19:17:42 steve Exp $"
#endif
@ -138,7 +138,7 @@ struct vvp_code_s {
};
union {
unsigned short bit_idx[2];
unsigned bit_idx[2];
vvp_ipoint_t iptr2;
vvp_cpoint_t cptr2;
struct ufunc_core*ufunc_core_ptr;
@ -173,6 +173,9 @@ extern vvp_code_t codespace_index(vvp_cpoint_t ptr);
/*
* $Log: codes.h,v $
* Revision 1.62 2003/06/17 19:17:42 steve
* Remove short int restrictions from vvp opcodes.
*
* Revision 1.61 2003/05/26 04:44:54 steve
* Add the set/x0/x instruction.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: compile.cc,v 1.164 2003/05/26 04:44:54 steve Exp $"
#ident "$Id: compile.cc,v 1.165 2003/06/17 19:17:42 steve Exp $"
#endif
# include "arith.h"
@ -1254,14 +1254,6 @@ void compile_code(char*label, char*mnem, comp_operands_t opa)
yyerror("operand format");
break;
}
// Make sure we dont overflow the short index
if (opa->argv[idx].numb > 65535) {
fprintf(stderr, "%lu overflows index for instruction %s\n",
opa->argv[idx].numb, mnem);
assert(0);
}
code->bit_idx[0] = opa->argv[idx].numb;
break;
@ -1270,14 +1262,6 @@ void compile_code(char*label, char*mnem, comp_operands_t opa)
yyerror("operand format");
break;
}
// Make sure we dont overflow the short index
if (opa->argv[idx].numb > 65535) {
fprintf(stderr, "%lu overflows index for instruction %s\n",
opa->argv[idx].numb, mnem);
assert(0);
}
code->bit_idx[1] = opa->argv[idx].numb;
break;
@ -1556,6 +1540,9 @@ void compile_param_string(char*label, char*name, char*str, char*value)
/*
* $Log: compile.cc,v $
* Revision 1.165 2003/06/17 19:17:42 steve
* Remove short int restrictions from vvp opcodes.
*
* Revision 1.164 2003/05/26 04:44:54 steve
* Add the set/x0/x instruction.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_priv.h,v 1.55 2003/05/29 02:21:45 steve Exp $"
#ident "$Id: vpi_priv.h,v 1.56 2003/06/17 19:17:42 steve Exp $"
#endif
# include "vpi_user.h"
@ -256,8 +256,8 @@ struct __vpiSysTaskCall {
/* Support for vpi_get_userdata. */
void*userdata;
/* These represent where in the vthread to put the return value. */
unsigned short vbit;
signed short vwid;
unsigned vbit;
signed vwid;
};
extern struct __vpiSysTaskCall*vpip_cur_task;
@ -418,6 +418,9 @@ extern char *need_result_buf(unsigned cnt, vpi_rbuf_t type);
/*
* $Log: vpi_priv.h,v $
* Revision 1.56 2003/06/17 19:17:42 steve
* Remove short int restrictions from vvp opcodes.
*
* Revision 1.55 2003/05/29 02:21:45 steve
* Implement acc_fetch_defname and its infrastructure in vvp.
*

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_vthr_vector.cc,v 1.17 2003/06/11 05:07:31 steve Exp $"
#ident "$Id: vpi_vthr_vector.cc,v 1.18 2003/06/17 19:17:42 steve Exp $"
#endif
/*
@ -37,8 +37,8 @@
struct __vpiVThrVec {
struct __vpiHandle base;
unsigned short bas;
unsigned short wid;
unsigned bas;
unsigned wid;
unsigned signed_flag : 1;
char *name;
};
@ -400,7 +400,7 @@ struct __vpiVThrWord {
struct __vpiHandle base;
char* name;
int subtype;
unsigned short index;
unsigned index;
};
static int vthr_word_get(int code, vpiHandle ref)
@ -519,6 +519,9 @@ vpiHandle vpip_make_vthr_word(unsigned base, const char*type)
/*
* $Log: vpi_vthr_vector.cc,v $
* Revision 1.18 2003/06/17 19:17:42 steve
* Remove short int restrictions from vvp opcodes.
*
* Revision 1.17 2003/06/11 05:07:31 steve
* support vpiVectorVal for value of thread vector.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vthread.cc,v 1.108 2003/05/26 04:44:54 steve Exp $"
#ident "$Id: vthread.cc,v 1.109 2003/06/17 19:17:42 steve Exp $"
#endif
# include "vthread.h"
@ -103,7 +103,7 @@ struct vthread_s {
double w_real;
} words[16];
unsigned nbits :16;
unsigned nbits;
/* My parent sets this when it wants me to wake it up. */
unsigned schedule_parent_on_end :1;
unsigned i_have_ended :1;
@ -128,7 +128,6 @@ struct vthread_s {
static void thr_check_addr(struct vthread_s*thr, unsigned addr)
{
assert(addr < 0x10000);
while (thr->nbits <= addr) {
unsigned word_cnt = thr->nbits/(CPU_WORD_BITS/2) + 1;
thr->bits = (unsigned long*)
@ -528,7 +527,6 @@ bool of_ASSIGN_V0(vthread_t thr, vvp_code_t cp)
{
unsigned wid = thr->words[0].w_int;
assert(wid > 0);
assert(wid < 0x10000);
unsigned delay = cp->bit_idx[0];
unsigned bit = cp->bit_idx[1];
@ -2724,6 +2722,9 @@ bool of_JOIN_UFUNC(vthread_t thr, vvp_code_t cp)
/*
* $Log: vthread.cc,v $
* Revision 1.109 2003/06/17 19:17:42 steve
* Remove short int restrictions from vvp opcodes.
*
* Revision 1.108 2003/05/26 04:44:54 steve
* Add the set/x0/x instruction.
*