Add the %load/nx opcode to index vpi nets.

This commit is contained in:
steve 2002-08-28 17:15:06 +00:00
parent aa390f2a91
commit 1db8319bce
4 changed files with 54 additions and 4 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: codes.h,v 1.47 2002/08/22 03:38:40 steve Exp $"
#ident "$Id: codes.h,v 1.48 2002/08/28 17:15:06 steve Exp $"
#endif
@ -73,6 +73,7 @@ extern bool of_JMP1(vthread_t thr, vvp_code_t code);
extern bool of_JOIN(vthread_t thr, vvp_code_t code);
extern bool of_LOAD(vthread_t thr, vvp_code_t code);
extern bool of_LOAD_MEM(vthread_t thr, vvp_code_t code);
extern bool of_LOAD_NX(vthread_t thr, vvp_code_t code);
extern bool of_LOAD_X(vthread_t thr, vvp_code_t code);
extern bool of_MOD(vthread_t thr, vvp_code_t code);
extern bool of_MOV(vthread_t thr, vvp_code_t code);
@ -153,6 +154,9 @@ extern vvp_code_t codespace_index(vvp_cpoint_t ptr);
/*
* $Log: codes.h,v $
* Revision 1.48 2002/08/28 17:15:06 steve
* Add the %load/nx opcode to index vpi nets.
*
* Revision 1.47 2002/08/22 03:38:40 steve
* Fix behavioral eval of x?a:b expressions.
*

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.138 2002/08/22 03:38:40 steve Exp $"
#ident "$Id: compile.cc,v 1.139 2002/08/28 17:15:06 steve Exp $"
#endif
# include "arith.h"
@ -69,6 +69,8 @@ enum operand_e {
OA_FUNC_PTR2,
/* The operand is a pointer to a memory */
OA_MEM_PTR,
/* The operand is a VPI handle */
OA_VPI_PTR,
};
struct opcode_table_s {
@ -116,6 +118,7 @@ const static struct opcode_table_s opcode_table[] = {
{ "%join", of_JOIN, 0, {OA_NONE, OA_NONE, OA_NONE} },
{ "%load", of_LOAD, 2, {OA_BIT1, OA_FUNC_PTR, OA_NONE} },
{ "%load/m", of_LOAD_MEM,2, {OA_BIT1, OA_MEM_PTR, OA_NONE} },
{ "%load/nx",of_LOAD_NX,3, {OA_BIT1, OA_VPI_PTR, OA_BIT2} },
{ "%load/x", of_LOAD_X, 3, {OA_BIT1, OA_FUNC_PTR, OA_BIT2} },
{ "%mod", of_MOD, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%mov", of_MOV, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
@ -1256,6 +1259,17 @@ void compile_code(char*label, char*mnem, comp_operands_t opa)
free(opa->argv[idx].symb.text);
break;
case OA_VPI_PTR:
/* The operand is a functor. Resolve the label to
a functor pointer, or postpone the resolution
if it is not defined yet. */
if (opa->argv[idx].ltype != L_SYMB) {
yyerror("operand format");
break;
}
compile_vpi_lookup(&code->handle, opa->argv[idx].symb.text);
break;
}
}
@ -1434,6 +1448,9 @@ void compile_net(char*label, char*name, int msb, int lsb, bool signed_flag,
/*
* $Log: compile.cc,v $
* Revision 1.139 2002/08/28 17:15:06 steve
* Add the %load/nx opcode to index vpi nets.
*
* Revision 1.138 2002/08/22 03:38:40 steve
* Fix behavioral eval of x?a:b expressions.
*

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
*
* $Id: opcodes.txt,v 1.38 2002/08/27 05:39:57 steve Exp $
* $Id: opcodes.txt,v 1.39 2002/08/28 17:15:06 steve Exp $
*/
@ -313,6 +313,13 @@ Bit address zero is the LSB of the first memory word. This
instruction loads only a single bit.
* %load/nx <bit>, <vpi-label>, <idx>
This instruction load a value from a .net object bit. Since .net
objects don't really exist (they are only named indirection into the
netlist) this instruction indexes into the .net list of bits.
* %load/x <bit>, <functor-label>, <idx>
This is an indexed load. It uses the contents of the specified index

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.82 2002/08/27 05:39:57 steve Exp $"
#ident "$Id: vthread.cc,v 1.83 2002/08/28 17:15:06 steve Exp $"
#endif
# include "vthread.h"
@ -1353,6 +1353,25 @@ bool of_LOAD_MEM(vthread_t thr, vvp_code_t cp)
return true;
}
/*
* Load net/indexed.
*/
bool of_LOAD_NX(vthread_t thr, vvp_code_t cp)
{
assert(cp->bit_idx[0] >= 4);
assert(cp->bit_idx[1] < 4);
assert(cp->handle->vpi_type->type_code == vpiNet);
struct __vpiSignal*sig =
reinterpret_cast<struct __vpiSignal*>(cp->handle);
unsigned idx = thr->index[cp->bit_idx[1]];
vvp_ipoint_t ptr = vvp_fvector_get(sig->bits, idx);
thr_put_bit(thr, cp->bit_idx[0], functor_get(ptr));
return true;
}
bool of_LOAD_X(vthread_t thr, vvp_code_t cp)
{
assert(cp->bit_idx[0] >= 4);
@ -2248,6 +2267,9 @@ bool of_CALL_UFUNC(vthread_t thr, vvp_code_t cp)
/*
* $Log: vthread.cc,v $
* Revision 1.83 2002/08/28 17:15:06 steve
* Add the %load/nx opcode to index vpi nets.
*
* Revision 1.82 2002/08/27 05:39:57 steve
* Fix l-value indexing of memories and vectors so that
* an unknown (x) index causes so cell to be addresses.