Add support for special integer vectors.
This commit is contained in:
parent
cd94019733
commit
f4a4ee00d0
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: compile.cc,v 1.130 2002/06/02 18:55:58 steve Exp $"
|
||||
#ident "$Id: compile.cc,v 1.131 2002/06/21 04:58:55 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "arith.h"
|
||||
|
|
@ -207,7 +207,8 @@ static vvp_ipoint_t ipoint_lookup(const char *label, unsigned idx)
|
|||
if (val.ptr) {
|
||||
vpiHandle vpi = (vpiHandle) val.ptr;
|
||||
assert((vpi->vpi_type->type_code == vpiNet)
|
||||
|| (vpi->vpi_type->type_code == vpiReg));
|
||||
|| (vpi->vpi_type->type_code == vpiReg)
|
||||
|| (vpi->vpi_type->type_code == vpiIntegerVar));
|
||||
|
||||
__vpiSignal*sig = (__vpiSignal*)vpi;
|
||||
return vvp_fvector_get(sig->bits, idx);
|
||||
|
|
@ -1354,7 +1355,7 @@ void compile_thread(char*start_sym)
|
|||
* write the label into the symbol table.
|
||||
*/
|
||||
void compile_variable(char*label, char*name, int msb, int lsb,
|
||||
bool signed_flag)
|
||||
char signed_flag)
|
||||
{
|
||||
unsigned wid = ((msb > lsb)? msb-lsb : lsb-msb) + 1;
|
||||
|
||||
|
|
@ -1368,7 +1369,9 @@ void compile_variable(char*label, char*name, int msb, int lsb,
|
|||
|
||||
/* Make the vpiHandle for the reg. */
|
||||
vvp_fvector_t vec = vvp_fvector_continuous_new(wid, fdx);
|
||||
vpiHandle obj = vpip_make_reg(name, msb, lsb, signed_flag, vec);
|
||||
vpiHandle obj = (signed_flag > 1) ?
|
||||
vpip_make_int(name, msb, lsb, vec) :
|
||||
vpip_make_reg(name, msb, lsb, signed_flag!=0, vec);
|
||||
compile_vpi_symbol(label, obj);
|
||||
vpip_attach_to_current_scope(obj);
|
||||
|
||||
|
|
@ -1414,6 +1417,9 @@ vvp_ipoint_t debug_lookup_functor(const char*name)
|
|||
|
||||
/*
|
||||
* $Log: compile.cc,v $
|
||||
* Revision 1.131 2002/06/21 04:58:55 steve
|
||||
* Add support for special integer vectors.
|
||||
*
|
||||
* Revision 1.130 2002/06/02 18:55:58 steve
|
||||
* Add %cmpi/u instruction.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: compile.h,v 1.42 2002/05/18 02:34:11 steve Exp $"
|
||||
#ident "$Id: compile.h,v 1.43 2002/06/21 04:58:55 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <stdio.h>
|
||||
|
|
@ -241,7 +241,7 @@ extern void compile_thread(char*start_sym);
|
|||
* This function is called to create a var vector with the given name.
|
||||
*/
|
||||
extern void compile_variable(char*label, char*name,
|
||||
int msb, int lsb, bool signed_flag);
|
||||
int msb, int lsb, char signed_flag);
|
||||
|
||||
extern void compile_net(char*label, char*name,
|
||||
int msb, int lsb, bool signed_flag,
|
||||
|
|
@ -249,6 +249,9 @@ extern void compile_net(char*label, char*name,
|
|||
|
||||
/*
|
||||
* $Log: compile.h,v $
|
||||
* Revision 1.43 2002/06/21 04:58:55 steve
|
||||
* Add support for special integer vectors.
|
||||
*
|
||||
* Revision 1.42 2002/05/18 02:34:11 steve
|
||||
* Add vpi support for named events.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: lexor.lex,v 1.33 2002/04/14 03:53:20 steve Exp $"
|
||||
#ident "$Id: lexor.lex,v 1.34 2002/06/21 04:58:55 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "parse_misc.h"
|
||||
|
|
@ -103,6 +103,7 @@
|
|||
".ufunc" { return K_UFUNC; }
|
||||
".var" { return K_VAR; }
|
||||
".var/s" { return K_VAR_S; }
|
||||
".var/i" { return K_VAR_I; /* integer */ }
|
||||
".udp" { return K_UDP; }
|
||||
".udp/c"(omb)? { return K_UDP_C; }
|
||||
".udp/s"(equ)? { return K_UDP_S; }
|
||||
|
|
@ -172,6 +173,9 @@ int yywrap()
|
|||
|
||||
/*
|
||||
* $Log: lexor.lex,v $
|
||||
* Revision 1.34 2002/06/21 04:58:55 steve
|
||||
* Add support for special integer vectors.
|
||||
*
|
||||
* Revision 1.33 2002/04/14 03:53:20 steve
|
||||
* Allow signed constant vectors for call_vpi parameters.
|
||||
*
|
||||
|
|
|
|||
14
vvp/parse.y
14
vvp/parse.y
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: parse.y,v 1.46 2002/05/18 02:34:11 steve Exp $"
|
||||
#ident "$Id: parse.y,v 1.47 2002/06/21 04:58:55 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "parse_misc.h"
|
||||
|
|
@ -64,7 +64,7 @@ extern FILE*yyin;
|
|||
%token K_UDP K_UDP_C K_UDP_S
|
||||
%token K_MEM K_MEM_P K_MEM_I
|
||||
%token K_FORCE
|
||||
%token K_VAR K_VAR_S K_vpi_call K_vpi_func K_disable K_fork
|
||||
%token K_VAR K_VAR_S K_VAR_I K_vpi_call K_vpi_func K_disable K_fork
|
||||
%token K_vpi_module K_vpi_time_precision
|
||||
|
||||
%token <text> T_INSTR
|
||||
|
|
@ -306,10 +306,13 @@ statement
|
|||
the variable in the netlist. */
|
||||
|
||||
| T_LABEL K_VAR T_STRING ',' T_NUMBER ',' T_NUMBER ';'
|
||||
{ compile_variable($1, $3, $5, $7, false); }
|
||||
{ compile_variable($1, $3, $5, $7, 0 /* unsigned */ ); }
|
||||
|
||||
| T_LABEL K_VAR_S T_STRING ',' T_NUMBER ',' T_NUMBER ';'
|
||||
{ compile_variable($1, $3, $5, $7, true); }
|
||||
{ compile_variable($1, $3, $5, $7, 1 /* signed */ ); }
|
||||
|
||||
| T_LABEL K_VAR_I T_STRING ',' T_NUMBER ',' T_NUMBER ';'
|
||||
{ compile_variable($1, $3, $5, $7, 2 /* integer */); }
|
||||
|
||||
/* Net statements are similar to .var statements, except that they
|
||||
declare nets, and they have an input list. */
|
||||
|
|
@ -550,6 +553,9 @@ int compile_design(const char*path)
|
|||
|
||||
/*
|
||||
* $Log: parse.y,v $
|
||||
* Revision 1.47 2002/06/21 04:58:55 steve
|
||||
* Add support for special integer vectors.
|
||||
*
|
||||
* Revision 1.46 2002/05/18 02:34:11 steve
|
||||
* Add vpi support for named events.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: vpi_priv.cc,v 1.16 2002/06/02 19:05:50 steve Exp $"
|
||||
#ident "$Id: vpi_priv.cc,v 1.17 2002/06/21 04:58:55 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vpi_priv.h"
|
||||
|
|
@ -64,8 +64,13 @@ int vpi_get(int property, vpiHandle ref)
|
|||
if (ref == 0)
|
||||
return vpip_get_global(property);
|
||||
|
||||
if (property == vpiType)
|
||||
return ref->vpi_type->type_code;
|
||||
if (property == vpiType) {
|
||||
struct __vpiSignal*rfp = (struct __vpiSignal*)ref;
|
||||
if (ref->vpi_type->type_code == vpiReg && rfp->isint_)
|
||||
return vpiIntegerVar;
|
||||
else
|
||||
return ref->vpi_type->type_code;
|
||||
}
|
||||
|
||||
if (ref->vpi_type->vpi_get_ == 0)
|
||||
return -1;
|
||||
|
|
@ -207,6 +212,9 @@ extern "C" void vpi_sim_vcontrol(int operation, va_list ap)
|
|||
|
||||
/*
|
||||
* $Log: vpi_priv.cc,v $
|
||||
* Revision 1.17 2002/06/21 04:58:55 steve
|
||||
* Add support for special integer vectors.
|
||||
*
|
||||
* Revision 1.16 2002/06/02 19:05:50 steve
|
||||
* Check for null pointers from users.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: vpi_priv.h,v 1.36 2002/05/19 05:18:16 steve Exp $"
|
||||
#ident "$Id: vpi_priv.h,v 1.37 2002/06/21 04:58:55 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vpi_user.h"
|
||||
|
|
@ -161,11 +161,13 @@ struct __vpiSignal {
|
|||
int msb, lsb;
|
||||
/* Flags */
|
||||
unsigned signed_flag : 1;
|
||||
unsigned isint_ : 1; // origial type was integer
|
||||
/* The represented value is here. */
|
||||
vvp_fvector_t bits;
|
||||
/* This is the callback event functor */
|
||||
struct callback_functor_s *callback;
|
||||
};
|
||||
extern vpiHandle vpip_make_int(char*name, int msb, int lsb, vvp_fvector_t vec);
|
||||
extern vpiHandle vpip_make_reg(char*name, int msb, int lsb, bool signed_flag,
|
||||
vvp_fvector_t vec);
|
||||
extern vpiHandle vpip_make_net(char*name, int msb, int lsb, bool signed_flag,
|
||||
|
|
@ -358,6 +360,9 @@ extern void vpip_oct_str_to_bits(unsigned char*bits, unsigned nbits,
|
|||
|
||||
/*
|
||||
* $Log: vpi_priv.h,v $
|
||||
* Revision 1.37 2002/06/21 04:58:55 steve
|
||||
* Add support for special integer vectors.
|
||||
*
|
||||
* Revision 1.36 2002/05/19 05:18:16 steve
|
||||
* Add callbacks for vpiNamedEvent objects.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: vpi_signal.cc,v 1.34 2002/05/15 04:48:46 steve Exp $"
|
||||
#ident "$Id: vpi_signal.cc,v 1.35 2002/06/21 04:58:55 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -609,6 +609,20 @@ static const struct __vpirt vpip_net_rt = {
|
|||
0
|
||||
};
|
||||
|
||||
/*
|
||||
* Construct a vpiIntegetVar object. Indicate the type using a flag
|
||||
* to minimize the code modifications. Icarus implements integers
|
||||
* as 'reg signed [31:0]'.
|
||||
*/
|
||||
vpiHandle vpip_make_int(char*name, int msb, int lsb, vvp_fvector_t vec)
|
||||
{
|
||||
vpiHandle obj = vpip_make_net(name, msb,lsb, true, vec);
|
||||
struct __vpiSignal*rfp = (struct __vpiSignal*)obj;
|
||||
obj->vpi_type = &vpip_reg_rt;
|
||||
rfp->isint_ = true;
|
||||
return obj;
|
||||
}
|
||||
|
||||
/*
|
||||
* Construct a vpiReg object. It's like a net, except for the type.
|
||||
*/
|
||||
|
|
@ -634,6 +648,7 @@ vpiHandle vpip_make_net(char*name, int msb, int lsb, bool signed_flag,
|
|||
obj->msb = msb;
|
||||
obj->lsb = lsb;
|
||||
obj->signed_flag = signed_flag? 1 : 0;
|
||||
obj->isint_ = false;
|
||||
obj->bits = vec;
|
||||
obj->callback = 0;
|
||||
|
||||
|
|
@ -645,6 +660,9 @@ vpiHandle vpip_make_net(char*name, int msb, int lsb, bool signed_flag,
|
|||
|
||||
/*
|
||||
* $Log: vpi_signal.cc,v $
|
||||
* Revision 1.35 2002/06/21 04:58:55 steve
|
||||
* Add support for special integer vectors.
|
||||
*
|
||||
* Revision 1.34 2002/05/15 04:48:46 steve
|
||||
* Support set by string for reg objects.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue