Handle non-constant delays on indexed non-blocking assignments.

This commit is contained in:
steve 2006-10-05 01:23:53 +00:00
parent 4af28e2b77
commit 26e2e85ffa
5 changed files with 66 additions and 14 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: vvp_process.c,v 1.124 2006/08/08 05:11:37 steve Exp $"
#ident "$Id: vvp_process.c,v 1.125 2006/10/05 01:23:53 steve Exp $"
#endif
# include "vvp_priv.h"
@ -183,12 +183,24 @@ static void assign_to_lvector(ivl_lval_t lval, unsigned bit,
offset. Load that into index x1 and generate a
single-bit set instruction. */
assert(ivl_lval_width(lval) == width);
assert(dexp == 0);
fprintf(vvp_out, " %%ix/load 0, %u;\n", width);
fprintf(vvp_out, " %%ix/load 1, %u;\n", part_off);
fprintf(vvp_out, " %%assign/v0/x1 V_%s, %u, %u;\n",
vvp_signal_label(sig), delay, bit);
if (dexp == 0) {
/* Constant delay... */
fprintf(vvp_out, " %%ix/load 0, %u;\n", width);
fprintf(vvp_out, " %%ix/load 1, %u;\n", part_off);
fprintf(vvp_out, " %%assign/v0/x1 V_%s, %u, %u;\n",
vvp_signal_label(sig), delay, bit);
} else {
/* Calculated delay... */
int delay_index = allocate_word();
draw_eval_expr_into_integer(dexp, delay_index);
fprintf(vvp_out, " %%ix/load 0, %u;\n", width);
fprintf(vvp_out, " %%ix/load 1, %u;\n", part_off);
fprintf(vvp_out, " %%assign/v0/x1/d V_%s, %u, %u;\n",
vvp_signal_label(sig), delay_index, bit);
clr_word(delay_index);
}
} else if (dexp != 0) {
draw_eval_expr_into_integer(dexp, 1);
@ -445,9 +457,6 @@ static int show_stmt_assign_nb(ivl_statement_t net)
unsigned lidx;
unsigned cur_rbit = 0;
if (del != 0)
calculate_into_x1(del);
for (lidx = 0 ; lidx < ivl_stmt_lvals(net) ; lidx += 1) {
unsigned bit_limit = wid - cur_rbit;
lval = ivl_stmt_lval(net, lidx);
@ -1487,6 +1496,9 @@ int draw_func_definition(ivl_scope_t scope)
/*
* $Log: vvp_process.c,v $
* Revision 1.125 2006/10/05 01:23:53 steve
* Handle non-constant delays on indexed non-blocking assignments.
*
* Revision 1.124 2006/08/08 05:11:37 steve
* Handle 64bit delay constants.
*

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.79 2006/08/09 05:19:08 steve Exp $"
#ident "$Id: codes.h,v 1.80 2006/10/05 01:23:53 steve Exp $"
#endif
@ -45,6 +45,7 @@ extern bool of_ASSIGN_MV(vthread_t thr, vvp_code_t code);
extern bool of_ASSIGN_V0(vthread_t thr, vvp_code_t code);
extern bool of_ASSIGN_V0D(vthread_t thr, vvp_code_t code);
extern bool of_ASSIGN_V0X1(vthread_t thr, vvp_code_t code);
extern bool of_ASSIGN_V0X1D(vthread_t thr, vvp_code_t code);
extern bool of_ASSIGN_WR(vthread_t thr, vvp_code_t code);
extern bool of_ASSIGN_X0(vthread_t thr, vvp_code_t code);
extern bool of_BLEND(vthread_t thr, vvp_code_t code);
@ -179,6 +180,9 @@ extern vvp_code_t codespace_null(void);
/*
* $Log: codes.h,v $
* Revision 1.80 2006/10/05 01:23:53 steve
* Handle non-constant delays on indexed non-blocking assignments.
*
* Revision 1.79 2006/08/09 05:19:08 steve
* Add support for real valued modulus.
*

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.225 2006/09/29 03:57:01 steve Exp $"
#ident "$Id: compile.cc,v 1.226 2006/10/05 01:23:53 steve Exp $"
#endif
# include "arith.h"
@ -91,6 +91,7 @@ const static struct opcode_table_s opcode_table[] = {
{ "%assign/v0",of_ASSIGN_V0,3,{OA_FUNC_PTR,OA_BIT1, OA_BIT2} },
{ "%assign/v0/d",of_ASSIGN_V0D,3,{OA_FUNC_PTR,OA_BIT1, OA_BIT2} },
{ "%assign/v0/x1",of_ASSIGN_V0X1,3,{OA_FUNC_PTR,OA_BIT1,OA_BIT2} },
{ "%assign/v0/x1/d",of_ASSIGN_V0X1D,3,{OA_FUNC_PTR,OA_BIT1,OA_BIT2} },
{ "%assign/wr",of_ASSIGN_WR,3,{OA_VPI_PTR,OA_BIT1, OA_BIT2} },
{ "%assign/x0",of_ASSIGN_X0,3,{OA_FUNC_PTR,OA_BIT1, OA_BIT2} },
{ "%blend", of_BLEND, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
@ -1534,6 +1535,9 @@ void compile_param_string(char*label, char*name, char*value)
/*
* $Log: compile.cc,v $
* Revision 1.226 2006/10/05 01:23:53 steve
* Handle non-constant delays on indexed non-blocking assignments.
*
* Revision 1.225 2006/09/29 03:57:01 steve
* Modpath delay chooses correct delay for edge.
*

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 2001-2003 Stephen Williams (steve@icarus.com)
*
* $Id: opcodes.txt,v 1.71 2006/08/09 05:19:08 steve Exp $
* $Id: opcodes.txt,v 1.72 2006/10/05 01:23:54 steve Exp $
*/
@ -87,7 +87,8 @@ course, because integer 0 is taken with the vector width.
The <var-label> references a .var object that can receive non-blocking
assignments. For blocking assignments, see %set/v.
* %assign/v0x1 <var-label>, <delay>, <bit>
* %assign/v0/x1 <var-label>, <delay>, <bit>
* %assign/v0/x1/d <var-label>, <delayx>, <bit>
This is similar to the %assign/v0 instruction, but adds the index-1
index register with the canonical index of the destination where the

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.156 2006/08/09 05:19:08 steve Exp $"
#ident "$Id: vthread.cc,v 1.157 2006/10/05 01:23:54 steve Exp $"
#endif
# include "config.h"
@ -604,6 +604,34 @@ bool of_ASSIGN_V0X1(vthread_t thr, vvp_code_t cp)
return true;
}
/*
* This is %assign/v0/x1 <label>, <delayx>, <bit>
* Index register 0 contains a vector part width.
* Index register 1 contains the offset into the destination vector.
*/
bool of_ASSIGN_V0X1D(vthread_t thr, vvp_code_t cp)
{
unsigned wid = thr->words[0].w_int;
unsigned off = thr->words[1].w_int;
unsigned delay = thr->words[cp->bit_idx[0]].w_int;
unsigned bit = cp->bit_idx[1];
vvp_fun_signal_vec*sig
= reinterpret_cast<vvp_fun_signal_vec*> (cp->net->fun);
assert(sig);
assert(wid > 0);
if (off >= sig->size())
return true;
vvp_vector4_t value = vthread_bits_to_vector(thr, bit, wid);
vvp_net_ptr_t ptr (cp->net, 0);
schedule_assign_vector(ptr, off, sig->size(), value, delay);
return true;
}
/*
* This is %assign/wr <vpi-label>, <delay>, <index>
*
@ -3284,6 +3312,9 @@ bool of_JOIN_UFUNC(vthread_t thr, vvp_code_t cp)
/*
* $Log: vthread.cc,v $
* Revision 1.157 2006/10/05 01:23:54 steve
* Handle non-constant delays on indexed non-blocking assignments.
*
* Revision 1.156 2006/08/09 05:19:08 steve
* Add support for real valued modulus.
*