Syntax for carrying sign with parameter.
This commit is contained in:
parent
dabdcf0fc9
commit
8defa4bcd0
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* $Id: README.txt,v 1.76 2006/03/08 05:29:42 steve Exp $
|
||||
* $Id: README.txt,v 1.77 2006/03/18 22:51:10 steve Exp $
|
||||
*/
|
||||
|
||||
VVP SIMULATION ENGINE
|
||||
|
|
@ -102,8 +102,8 @@ objects.
|
|||
The syntax of a parameter is:
|
||||
|
||||
<label> .param/str <name>, <value>;
|
||||
<label> .param/b <name>, <value> [<msb>,<lsb>,<s>];
|
||||
<label> .param/l <name>, <value> [<msb>,<lsb>,<s>];
|
||||
<label> .param/b <name>, <value> [<msb>,<lsb>];
|
||||
<label> .param/l <name>, <value> [<msb>,<lsb>];
|
||||
<label> .param/r <name>, <value>;
|
||||
|
||||
The <name> is a string that names the parameter. The name is placed in
|
||||
|
|
@ -119,6 +119,9 @@ The value, then, is appropriate for the data type. For example:
|
|||
|
||||
P_123 .param/str "hello", "Hello, World.";
|
||||
|
||||
The boolean and logic values can also be signed or not. If signed, the
|
||||
value is preceeded by a '+' character. (Note that the value is 2s
|
||||
compliment, so the '+' says only that it is signed, not positive.)
|
||||
|
||||
FUNCTOR STATEMENTS:
|
||||
|
||||
|
|
|
|||
|
|
@ -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.218 2006/03/08 05:29:42 steve Exp $"
|
||||
#ident "$Id: compile.cc,v 1.219 2006/03/18 22:51:10 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "arith.h"
|
||||
|
|
@ -1473,10 +1473,10 @@ void compile_thread(char*start_sym, char*flag)
|
|||
free(flag);
|
||||
}
|
||||
|
||||
void compile_param_logic(char*label, char*name, char*value)
|
||||
void compile_param_logic(char*label, char*name, char*value, bool signed_flag)
|
||||
{
|
||||
vvp_vector4_t value4 = c4string_to_vector4(value);
|
||||
vpiHandle obj = vpip_make_binary_param(name, value4);
|
||||
vpiHandle obj = vpip_make_binary_param(name, value4, signed_flag);
|
||||
compile_vpi_symbol(label, obj);
|
||||
vpip_attach_to_current_scope(obj);
|
||||
|
||||
|
|
@ -1495,6 +1495,9 @@ void compile_param_string(char*label, char*name, char*value)
|
|||
|
||||
/*
|
||||
* $Log: compile.cc,v $
|
||||
* Revision 1.219 2006/03/18 22:51:10 steve
|
||||
* Syntax for carrying sign with parameter.
|
||||
*
|
||||
* Revision 1.218 2006/03/08 05:29:42 steve
|
||||
* Add support for logic parameters.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: compile.h,v 1.79 2006/03/08 05:29:42 steve Exp $"
|
||||
#ident "$Id: compile.h,v 1.80 2006/03/18 22:51:10 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <stdio.h>
|
||||
|
|
@ -183,7 +183,8 @@ extern void compile_vpi_symbol(const char*label, vpiHandle obj);
|
|||
extern void compile_vpi_lookup(vpiHandle *objref, char*label);
|
||||
|
||||
extern void compile_param_string(char*label, char*name, char*value);
|
||||
extern void compile_param_logic(char*label, char*name, char*value);
|
||||
extern void compile_param_logic(char*label, char*name, char*value,
|
||||
bool signed_flag);
|
||||
|
||||
/*
|
||||
* This function schedules a lookup of an indexed label. The ref
|
||||
|
|
@ -342,6 +343,9 @@ extern void compile_alias_real(char*label, char*name,
|
|||
|
||||
/*
|
||||
* $Log: compile.h,v $
|
||||
* Revision 1.80 2006/03/18 22:51:10 steve
|
||||
* Syntax for carrying sign with parameter.
|
||||
*
|
||||
* Revision 1.79 2006/03/08 05:29:42 steve
|
||||
* Add support for logic parameters.
|
||||
*
|
||||
|
|
|
|||
10
vvp/parse.y
10
vvp/parse.y
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: parse.y,v 1.81 2006/03/08 05:29:42 steve Exp $"
|
||||
#ident "$Id: parse.y,v 1.82 2006/03/18 22:51:10 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "parse_misc.h"
|
||||
|
|
@ -502,7 +502,10 @@ statement
|
|||
{ compile_param_string($1, $3, $5); }
|
||||
|
||||
| T_LABEL K_PARAM_L T_STRING ',' T_SYMBOL ';'
|
||||
{ compile_param_logic($1, $3, $5); }
|
||||
{ compile_param_logic($1, $3, $5, false); }
|
||||
|
||||
| T_LABEL K_PARAM_L T_STRING ',' '+' T_SYMBOL ';'
|
||||
{ compile_param_logic($1, $3, $6, true); }
|
||||
|
||||
/* Oh and by the way, empty statements are OK as well. */
|
||||
|
||||
|
|
@ -736,6 +739,9 @@ int compile_design(const char*path)
|
|||
|
||||
/*
|
||||
* $Log: parse.y,v $
|
||||
* Revision 1.82 2006/03/18 22:51:10 steve
|
||||
* Syntax for carrying sign with parameter.
|
||||
*
|
||||
* Revision 1.81 2006/03/08 05:29:42 steve
|
||||
* Add support for logic parameters.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vpi_const.cc,v 1.34 2006/03/08 05:29:42 steve Exp $"
|
||||
#ident "$Id: vpi_const.cc,v 1.35 2006/03/18 22:51:10 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vpi_priv.h"
|
||||
|
|
@ -329,6 +329,7 @@ vpiHandle vpip_make_binary_const(unsigned wid, char*bits)
|
|||
obj->base.vpi_type = &vpip_binary_rt;
|
||||
|
||||
obj->signed_flag = 0;
|
||||
obj->sized_flag = 0;
|
||||
obj->bits = vvp_vector4_t(wid);
|
||||
|
||||
const char*bp = bits;
|
||||
|
|
@ -412,13 +413,15 @@ static const struct __vpirt vpip_binary_param_rt = {
|
|||
0
|
||||
};
|
||||
|
||||
vpiHandle vpip_make_binary_param(char*name, const vvp_vector4_t&bits)
|
||||
vpiHandle vpip_make_binary_param(char*name, const vvp_vector4_t&bits,
|
||||
bool signed_flag)
|
||||
{
|
||||
struct __vpiBinaryParam*obj = new __vpiBinaryParam;
|
||||
|
||||
obj->base.vpi_type = &vpip_binary_param_rt;
|
||||
obj->bits = bits;
|
||||
obj->signed_flag = 0;
|
||||
obj->signed_flag = signed_flag? 1 : 0;
|
||||
obj->sized_flag = 0;
|
||||
obj->basename = name;
|
||||
obj->scope = vpip_peek_current_scope();
|
||||
|
||||
|
|
@ -528,6 +531,9 @@ vpiHandle vpip_make_dec_const(int value)
|
|||
|
||||
/*
|
||||
* $Log: vpi_const.cc,v $
|
||||
* Revision 1.35 2006/03/18 22:51:10 steve
|
||||
* Syntax for carrying sign with parameter.
|
||||
*
|
||||
* Revision 1.34 2006/03/08 05:29:42 steve
|
||||
* Add support for logic parameters.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.69 2006/03/08 05:29:42 steve Exp $"
|
||||
#ident "$Id: vpi_priv.h,v 1.70 2006/03/18 22:51:10 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vpi_user.h"
|
||||
|
|
@ -291,11 +291,15 @@ vpiHandle vpip_make_string_param(char*name, char*value);
|
|||
struct __vpiBinaryConst {
|
||||
struct __vpiHandle base;
|
||||
vvp_vector4_t bits;
|
||||
unsigned signed_flag :1;
|
||||
/* TRUE if this constant is signed. */
|
||||
int signed_flag :1;
|
||||
/* TRUE if this constant has an explicit size (i.e. 19'h0 vs. 'h0) */
|
||||
int sized_flag :1;
|
||||
};
|
||||
|
||||
vpiHandle vpip_make_binary_const(unsigned wid, char*bits);
|
||||
vpiHandle vpip_make_binary_param(char*name, const vvp_vector4_t&bits);
|
||||
vpiHandle vpip_make_binary_param(char*name, const vvp_vector4_t&bits,
|
||||
bool signed_flag);
|
||||
|
||||
struct __vpiDecConst {
|
||||
struct __vpiHandle base;
|
||||
|
|
@ -428,6 +432,9 @@ extern char *need_result_buf(unsigned cnt, vpi_rbuf_t type);
|
|||
|
||||
/*
|
||||
* $Log: vpi_priv.h,v $
|
||||
* Revision 1.70 2006/03/18 22:51:10 steve
|
||||
* Syntax for carrying sign with parameter.
|
||||
*
|
||||
* Revision 1.69 2006/03/08 05:29:42 steve
|
||||
* Add support for logic parameters.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue