Add support for logic parameters.
This commit is contained in:
parent
5f5a6b5396
commit
6f46d12e07
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: vvp_scope.c,v 1.139 2006/01/02 05:33:20 steve Exp $"
|
#ident "$Id: vvp_scope.c,v 1.140 2006/03/08 05:29:42 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "vvp_priv.h"
|
# include "vvp_priv.h"
|
||||||
|
|
@ -2091,11 +2091,24 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
||||||
ivl_expr_t pex = ivl_parameter_expr(par);
|
ivl_expr_t pex = ivl_parameter_expr(par);
|
||||||
switch (ivl_expr_type(pex)) {
|
switch (ivl_expr_type(pex)) {
|
||||||
case IVL_EX_STRING:
|
case IVL_EX_STRING:
|
||||||
fprintf(vvp_out, "P_%p .param \"%s\", string, \"%s\";\n",
|
fprintf(vvp_out, "P_%p .param/str \"%s\", \"%s\";\n",
|
||||||
par, ivl_parameter_basename(par),
|
par, ivl_parameter_basename(par),
|
||||||
ivl_expr_string(pex));
|
ivl_expr_string(pex));
|
||||||
break;
|
break;
|
||||||
|
case IVL_EX_NUMBER:
|
||||||
|
fprintf(vvp_out, "P_%p .param/l \"%s\", C4<",
|
||||||
|
par, ivl_parameter_basename(par));
|
||||||
|
{ const char*bits = ivl_expr_bits(pex);
|
||||||
|
unsigned nbits = ivl_expr_width(pex);
|
||||||
|
unsigned bb;
|
||||||
|
for (bb = 0 ; bb < nbits; bb += 1)
|
||||||
|
fprintf(vvp_out, "%c", bits[nbits-bb-1]);
|
||||||
|
}
|
||||||
|
fprintf(vvp_out, ">;\n");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
|
fprintf(vvp_out, "; parameter type %d unsupported\n",
|
||||||
|
ivl_expr_type(pex));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2153,6 +2166,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: vvp_scope.c,v $
|
* $Log: vvp_scope.c,v $
|
||||||
|
* Revision 1.140 2006/03/08 05:29:42 steve
|
||||||
|
* Add support for logic parameters.
|
||||||
|
*
|
||||||
* Revision 1.139 2006/01/02 05:33:20 steve
|
* Revision 1.139 2006/01/02 05:33:20 steve
|
||||||
* Node delays can be more general expressions in structural contexts.
|
* Node delays can be more general expressions in structural contexts.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* $Id: README.txt,v 1.75 2006/01/02 05:32:06 steve Exp $
|
* $Id: README.txt,v 1.76 2006/03/08 05:29:42 steve Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VVP SIMULATION ENGINE
|
VVP SIMULATION ENGINE
|
||||||
|
|
@ -101,22 +101,23 @@ objects.
|
||||||
|
|
||||||
The syntax of a parameter is:
|
The syntax of a parameter is:
|
||||||
|
|
||||||
<label> .param <name>, <type>, <value>;
|
<label> .param/str <name>, <value>;
|
||||||
|
<label> .param/b <name>, <value> [<msb>,<lsb>,<s>];
|
||||||
|
<label> .param/l <name>, <value> [<msb>,<lsb>,<s>];
|
||||||
|
<label> .param/r <name>, <value>;
|
||||||
|
|
||||||
The <name> is a string that names the parameter. The name is placed in
|
The <name> is a string that names the parameter. The name is placed in
|
||||||
the current scope as a vpiParameter object. The <type> is one of the
|
the current scope as a vpiParameter object. The .param suffix
|
||||||
following:
|
specifies the parameter type.
|
||||||
|
|
||||||
real -- The parameter has a real value
|
.param/str -- The parameter has a string value
|
||||||
string -- The parameter has a string value
|
.param/l -- The parameter has a logic vector value
|
||||||
[<msb>,<lsb>,<s>]
|
.param/b -- The parameter has a boolean vector value
|
||||||
-- The parameter is a vector, with specified
|
.param/r -- The parameter has a real value
|
||||||
indices. The <s> is s or u for signed or
|
|
||||||
unsigned.
|
|
||||||
|
|
||||||
The value, then, is appropriate for the data type. For example:
|
The value, then, is appropriate for the data type. For example:
|
||||||
|
|
||||||
P_123 .param "hello", string, "Hello, World.";
|
P_123 .param/str "hello", "Hello, World.";
|
||||||
|
|
||||||
|
|
||||||
FUNCTOR STATEMENTS:
|
FUNCTOR STATEMENTS:
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: compile.cc,v 1.217 2006/02/02 02:44:00 steve Exp $"
|
#ident "$Id: compile.cc,v 1.218 2006/03/08 05:29:42 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "arith.h"
|
# include "arith.h"
|
||||||
|
|
@ -686,30 +686,7 @@ void input_connect(vvp_net_t*fdx, unsigned port, char*label)
|
||||||
&& (tp[1] == 0)
|
&& (tp[1] == 0)
|
||||||
&& (strspn(label+3, "01xz")+3 == (unsigned)(tp-label))) {
|
&& (strspn(label+3, "01xz")+3 == (unsigned)(tp-label))) {
|
||||||
|
|
||||||
size_t v4size = tp-label-3;
|
vvp_vector4_t tmp = c4string_to_vector4(label);
|
||||||
vvp_vector4_t tmp (v4size);
|
|
||||||
|
|
||||||
for (unsigned idx = 0 ; idx < v4size ; idx += 1) {
|
|
||||||
vvp_bit4_t bit;
|
|
||||||
switch (label[3+idx]) {
|
|
||||||
case '0':
|
|
||||||
bit = BIT4_0;
|
|
||||||
break;
|
|
||||||
case '1':
|
|
||||||
bit = BIT4_1;
|
|
||||||
break;
|
|
||||||
case 'x':
|
|
||||||
bit = BIT4_X;
|
|
||||||
break;
|
|
||||||
case 'z':
|
|
||||||
bit = BIT4_Z;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
assert(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
tmp.set_bit(v4size-idx-1, bit);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inputs that are constants are schedule to execute as
|
// Inputs that are constants are schedule to execute as
|
||||||
// soon at the simulation starts. In Verilog, constants
|
// soon at the simulation starts. In Verilog, constants
|
||||||
|
|
@ -1496,11 +1473,19 @@ void compile_thread(char*start_sym, char*flag)
|
||||||
free(flag);
|
free(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compile_param_string(char*label, char*name, char*str, char*value)
|
void compile_param_logic(char*label, char*name, char*value)
|
||||||
{
|
{
|
||||||
assert(strcmp(str,"string") == 0);
|
vvp_vector4_t value4 = c4string_to_vector4(value);
|
||||||
free(str);
|
vpiHandle obj = vpip_make_binary_param(name, value4);
|
||||||
|
compile_vpi_symbol(label, obj);
|
||||||
|
vpip_attach_to_current_scope(obj);
|
||||||
|
|
||||||
|
free(label);
|
||||||
|
free(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void compile_param_string(char*label, char*name, char*value)
|
||||||
|
{
|
||||||
vpiHandle obj = vpip_make_string_param(name, value);
|
vpiHandle obj = vpip_make_string_param(name, value);
|
||||||
compile_vpi_symbol(label, obj);
|
compile_vpi_symbol(label, obj);
|
||||||
vpip_attach_to_current_scope(obj);
|
vpip_attach_to_current_scope(obj);
|
||||||
|
|
@ -1510,6 +1495,9 @@ void compile_param_string(char*label, char*name, char*str, char*value)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: compile.cc,v $
|
* $Log: compile.cc,v $
|
||||||
|
* Revision 1.218 2006/03/08 05:29:42 steve
|
||||||
|
* Add support for logic parameters.
|
||||||
|
*
|
||||||
* Revision 1.217 2006/02/02 02:44:00 steve
|
* Revision 1.217 2006/02/02 02:44:00 steve
|
||||||
* Allow part selects of memory words in l-values.
|
* Allow part selects of memory words in l-values.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: compile.h,v 1.78 2006/01/02 05:32:07 steve Exp $"
|
#ident "$Id: compile.h,v 1.79 2006/03/08 05:29:42 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
|
|
@ -182,8 +182,8 @@ extern void compile_timescale(long units);
|
||||||
extern void compile_vpi_symbol(const char*label, vpiHandle obj);
|
extern void compile_vpi_symbol(const char*label, vpiHandle obj);
|
||||||
extern void compile_vpi_lookup(vpiHandle *objref, char*label);
|
extern void compile_vpi_lookup(vpiHandle *objref, char*label);
|
||||||
|
|
||||||
extern void compile_param_string(char*label, char*name,
|
extern void compile_param_string(char*label, char*name, char*value);
|
||||||
char*str, char*value);
|
extern void compile_param_logic(char*label, char*name, char*value);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function schedules a lookup of an indexed label. The ref
|
* This function schedules a lookup of an indexed label. The ref
|
||||||
|
|
@ -342,6 +342,9 @@ extern void compile_alias_real(char*label, char*name,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: compile.h,v $
|
* $Log: compile.h,v $
|
||||||
|
* Revision 1.79 2006/03/08 05:29:42 steve
|
||||||
|
* Add support for logic parameters.
|
||||||
|
*
|
||||||
* Revision 1.78 2006/01/02 05:32:07 steve
|
* Revision 1.78 2006/01/02 05:32:07 steve
|
||||||
* Require explicit delay node from source.
|
* Require explicit delay node from source.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: lexor.lex,v 1.58 2006/01/02 05:32:07 steve Exp $"
|
#ident "$Id: lexor.lex,v 1.59 2006/03/08 05:29:42 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "parse_misc.h"
|
# include "parse_misc.h"
|
||||||
|
|
@ -114,7 +114,8 @@
|
||||||
".net8/s" { return K_NET8_S; }
|
".net8/s" { return K_NET8_S; }
|
||||||
".net/real" { return K_NET_R; }
|
".net/real" { return K_NET_R; }
|
||||||
".net/s" { return K_NET_S; }
|
".net/s" { return K_NET_S; }
|
||||||
".param" { return K_PARAM; }
|
".param/l" { return K_PARAM_L; }
|
||||||
|
".param/str" { return K_PARAM_STR; }
|
||||||
".part" { return K_PART; }
|
".part" { return K_PART; }
|
||||||
".part/pv" { return K_PART_PV; }
|
".part/pv" { return K_PART_PV; }
|
||||||
".part/v" { return K_PART_V; }
|
".part/v" { return K_PART_V; }
|
||||||
|
|
@ -205,6 +206,9 @@ int yywrap()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: lexor.lex,v $
|
* $Log: lexor.lex,v $
|
||||||
|
* Revision 1.59 2006/03/08 05:29:42 steve
|
||||||
|
* Add support for logic parameters.
|
||||||
|
*
|
||||||
* Revision 1.58 2006/01/02 05:32:07 steve
|
* Revision 1.58 2006/01/02 05:32:07 steve
|
||||||
* Require explicit delay node from source.
|
* Require explicit delay node from source.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
14
vvp/parse.y
14
vvp/parse.y
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: parse.y,v 1.80 2006/01/02 05:32:07 steve Exp $"
|
#ident "$Id: parse.y,v 1.81 2006/03/08 05:29:42 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "parse_misc.h"
|
# include "parse_misc.h"
|
||||||
|
|
@ -64,7 +64,7 @@ extern FILE*yyin;
|
||||||
%token K_CONCAT K_DELAY K_DFF
|
%token K_CONCAT K_DELAY K_DFF
|
||||||
%token K_EVENT K_EVENT_OR K_EXTEND_S K_FUNCTOR K_NET K_NET_S K_NET_R
|
%token K_EVENT K_EVENT_OR K_EXTEND_S K_FUNCTOR K_NET K_NET_S K_NET_R
|
||||||
%token K_NET8 K_NET8_S
|
%token K_NET8 K_NET8_S
|
||||||
%token K_PARAM K_PART K_PART_PV
|
%token K_PARAM_STR K_PARAM_L K_PART K_PART_PV
|
||||||
%token K_PART_V K_REDUCE_AND K_REDUCE_OR K_REDUCE_XOR
|
%token K_PART_V K_REDUCE_AND K_REDUCE_OR K_REDUCE_XOR
|
||||||
%token K_REDUCE_NAND K_REDUCE_NOR K_REDUCE_XNOR K_REPEAT
|
%token K_REDUCE_NAND K_REDUCE_NOR K_REDUCE_XNOR K_REPEAT
|
||||||
%token K_RESOLV K_SCOPE K_SHIFTL K_SHIFTR K_THREAD K_TIMESCALE K_UFUNC
|
%token K_RESOLV K_SCOPE K_SHIFTL K_SHIFTR K_THREAD K_TIMESCALE K_UFUNC
|
||||||
|
|
@ -498,8 +498,11 @@ statement
|
||||||
/* Parameter statements come in a few simple forms. The most basic
|
/* Parameter statements come in a few simple forms. The most basic
|
||||||
is the string parameter. */
|
is the string parameter. */
|
||||||
|
|
||||||
| T_LABEL K_PARAM T_STRING ',' T_SYMBOL ',' T_STRING ';'
|
| T_LABEL K_PARAM_STR T_STRING ',' T_STRING ';'
|
||||||
{ compile_param_string($1, $3, $5, $7); }
|
{ compile_param_string($1, $3, $5); }
|
||||||
|
|
||||||
|
| T_LABEL K_PARAM_L T_STRING ',' T_SYMBOL ';'
|
||||||
|
{ compile_param_logic($1, $3, $5); }
|
||||||
|
|
||||||
/* Oh and by the way, empty statements are OK as well. */
|
/* Oh and by the way, empty statements are OK as well. */
|
||||||
|
|
||||||
|
|
@ -733,6 +736,9 @@ int compile_design(const char*path)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: parse.y,v $
|
* $Log: parse.y,v $
|
||||||
|
* Revision 1.81 2006/03/08 05:29:42 steve
|
||||||
|
* Add support for logic parameters.
|
||||||
|
*
|
||||||
* Revision 1.80 2006/01/02 05:32:07 steve
|
* Revision 1.80 2006/01/02 05:32:07 steve
|
||||||
* Require explicit delay node from source.
|
* Require explicit delay node from source.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: vpi_const.cc,v 1.33 2006/03/06 05:43:15 steve Exp $"
|
#ident "$Id: vpi_const.cc,v 1.34 2006/03/08 05:29:42 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "vpi_priv.h"
|
# include "vpi_priv.h"
|
||||||
|
|
@ -253,7 +253,8 @@ vpiHandle vpip_make_string_param(char*name, char*text)
|
||||||
static int binary_get(int code, vpiHandle ref)
|
static int binary_get(int code, vpiHandle ref)
|
||||||
{
|
{
|
||||||
struct __vpiBinaryConst*rfp = (struct __vpiBinaryConst*)ref;
|
struct __vpiBinaryConst*rfp = (struct __vpiBinaryConst*)ref;
|
||||||
assert(ref->vpi_type->type_code == vpiConstant);
|
assert(ref->vpi_type->type_code == vpiConstant
|
||||||
|
|| ref->vpi_type->type_code == vpiParameter);
|
||||||
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case vpiConstType:
|
case vpiConstType:
|
||||||
|
|
@ -276,10 +277,10 @@ static int binary_get(int code, vpiHandle ref)
|
||||||
|
|
||||||
static void binary_value(vpiHandle ref, p_vpi_value vp)
|
static void binary_value(vpiHandle ref, p_vpi_value vp)
|
||||||
{
|
{
|
||||||
assert(ref->vpi_type->type_code == vpiConstant);
|
assert(ref->vpi_type->type_code == vpiConstant
|
||||||
|
|| ref->vpi_type->type_code == vpiParameter);
|
||||||
|
|
||||||
struct __vpiBinaryConst*rfp = (struct __vpiBinaryConst*)ref;
|
struct __vpiBinaryConst*rfp = (struct __vpiBinaryConst*)ref;
|
||||||
char*rbuf = 0;
|
|
||||||
|
|
||||||
|
|
||||||
switch (vp->format) {
|
switch (vp->format) {
|
||||||
|
|
@ -324,8 +325,7 @@ vpiHandle vpip_make_binary_const(unsigned wid, char*bits)
|
||||||
{
|
{
|
||||||
struct __vpiBinaryConst*obj;
|
struct __vpiBinaryConst*obj;
|
||||||
|
|
||||||
obj = (struct __vpiBinaryConst*)
|
obj = new __vpiBinaryConst;
|
||||||
malloc(sizeof (struct __vpiBinaryConst));
|
|
||||||
obj->base.vpi_type = &vpip_binary_rt;
|
obj->base.vpi_type = &vpip_binary_rt;
|
||||||
|
|
||||||
obj->signed_flag = 0;
|
obj->signed_flag = 0;
|
||||||
|
|
@ -361,6 +361,69 @@ vpiHandle vpip_make_binary_const(unsigned wid, char*bits)
|
||||||
return &(obj->base);
|
return &(obj->base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct __vpiBinaryParam : public __vpiBinaryConst {
|
||||||
|
const char*basename;
|
||||||
|
struct __vpiScope*scope;
|
||||||
|
};
|
||||||
|
|
||||||
|
static char* binary_param_get_str(int code, vpiHandle obj)
|
||||||
|
{
|
||||||
|
struct __vpiBinaryParam*rfp = (struct __vpiBinaryParam*)obj;
|
||||||
|
char *rbuf = need_result_buf(strlen(rfp->basename) + 1, RBUF_STR);
|
||||||
|
|
||||||
|
assert(obj->vpi_type->type_code == vpiParameter);
|
||||||
|
|
||||||
|
switch (code) {
|
||||||
|
case vpiName:
|
||||||
|
strcpy(rbuf, rfp->basename);
|
||||||
|
return rbuf;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static vpiHandle binary_param_handle(int code, vpiHandle obj)
|
||||||
|
{
|
||||||
|
struct __vpiBinaryParam*rfp = (struct __vpiBinaryParam*)obj;
|
||||||
|
|
||||||
|
assert(obj->vpi_type->type_code == vpiParameter);
|
||||||
|
|
||||||
|
switch (code) {
|
||||||
|
case vpiScope:
|
||||||
|
return &rfp->scope->base;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct __vpirt vpip_binary_param_rt = {
|
||||||
|
vpiParameter,
|
||||||
|
binary_get,
|
||||||
|
binary_param_get_str,
|
||||||
|
binary_value,
|
||||||
|
0,
|
||||||
|
|
||||||
|
binary_param_handle,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
vpiHandle vpip_make_binary_param(char*name, const vvp_vector4_t&bits)
|
||||||
|
{
|
||||||
|
struct __vpiBinaryParam*obj = new __vpiBinaryParam;
|
||||||
|
|
||||||
|
obj->base.vpi_type = &vpip_binary_param_rt;
|
||||||
|
obj->bits = bits;
|
||||||
|
obj->signed_flag = 0;
|
||||||
|
obj->basename = name;
|
||||||
|
obj->scope = vpip_peek_current_scope();
|
||||||
|
|
||||||
|
return &obj->base;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int dec_get(int code, vpiHandle ref)
|
static int dec_get(int code, vpiHandle ref)
|
||||||
|
|
@ -465,6 +528,9 @@ vpiHandle vpip_make_dec_const(int value)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: vpi_const.cc,v $
|
* $Log: vpi_const.cc,v $
|
||||||
|
* Revision 1.34 2006/03/08 05:29:42 steve
|
||||||
|
* Add support for logic parameters.
|
||||||
|
*
|
||||||
* Revision 1.33 2006/03/06 05:43:15 steve
|
* Revision 1.33 2006/03/06 05:43:15 steve
|
||||||
* Cleanup vpi_const to use vec4 values.
|
* Cleanup vpi_const to use vec4 values.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: vpi_priv.h,v 1.68 2006/03/06 05:43:15 steve Exp $"
|
#ident "$Id: vpi_priv.h,v 1.69 2006/03/08 05:29:42 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "vpi_user.h"
|
# include "vpi_user.h"
|
||||||
|
|
@ -295,6 +295,7 @@ struct __vpiBinaryConst {
|
||||||
};
|
};
|
||||||
|
|
||||||
vpiHandle vpip_make_binary_const(unsigned wid, char*bits);
|
vpiHandle vpip_make_binary_const(unsigned wid, char*bits);
|
||||||
|
vpiHandle vpip_make_binary_param(char*name, const vvp_vector4_t&bits);
|
||||||
|
|
||||||
struct __vpiDecConst {
|
struct __vpiDecConst {
|
||||||
struct __vpiHandle base;
|
struct __vpiHandle base;
|
||||||
|
|
@ -427,6 +428,9 @@ extern char *need_result_buf(unsigned cnt, vpi_rbuf_t type);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: vpi_priv.h,v $
|
* $Log: vpi_priv.h,v $
|
||||||
|
* Revision 1.69 2006/03/08 05:29:42 steve
|
||||||
|
* Add support for logic parameters.
|
||||||
|
*
|
||||||
* Revision 1.68 2006/03/06 05:43:15 steve
|
* Revision 1.68 2006/03/06 05:43:15 steve
|
||||||
* Cleanup vpi_const to use vec4 values.
|
* Cleanup vpi_const to use vec4 values.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ident "$Id: vvp_net.cc,v 1.50 2006/01/03 06:19:31 steve Exp $"
|
#ident "$Id: vvp_net.cc,v 1.51 2006/03/08 05:29:42 steve Exp $"
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
# include "vvp_net.h"
|
# include "vvp_net.h"
|
||||||
|
|
@ -1119,6 +1119,42 @@ vvp_vector4_t vector2_to_vector4(const vvp_vector2_t&that, unsigned wid)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vvp_vector4_t c4string_to_vector4(const char*str)
|
||||||
|
{
|
||||||
|
assert((str[0]=='C') && (str[1]=='4') && (str[2]=='<'));
|
||||||
|
|
||||||
|
str += 3;
|
||||||
|
char*tp = str + strspn(str,"01xz");
|
||||||
|
assert(tp[0] == '>');
|
||||||
|
|
||||||
|
vvp_vector4_t tmp (tp-str);
|
||||||
|
|
||||||
|
for (unsigned idx = 0 ; idx < tmp.size() ; idx += 1) {
|
||||||
|
vvp_bit4_t bit;
|
||||||
|
switch (str[idx]) {
|
||||||
|
case '0':
|
||||||
|
bit = BIT4_0;
|
||||||
|
break;
|
||||||
|
case '1':
|
||||||
|
bit = BIT4_1;
|
||||||
|
break;
|
||||||
|
case 'x':
|
||||||
|
bit = BIT4_X;
|
||||||
|
break;
|
||||||
|
case 'z':
|
||||||
|
bit = BIT4_Z;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert(0);
|
||||||
|
bit = BIT4_0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tmp.set_bit(tmp.size()-idx-1, bit);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
ostream& operator<< (ostream&out, const vvp_vector2_t&that)
|
ostream& operator<< (ostream&out, const vvp_vector2_t&that)
|
||||||
{
|
{
|
||||||
if (that.is_NaN()) {
|
if (that.is_NaN()) {
|
||||||
|
|
@ -2127,6 +2163,9 @@ vvp_bit4_t compare_gtge_signed(const vvp_vector4_t&a,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: vvp_net.cc,v $
|
* $Log: vvp_net.cc,v $
|
||||||
|
* Revision 1.51 2006/03/08 05:29:42 steve
|
||||||
|
* Add support for logic parameters.
|
||||||
|
*
|
||||||
* Revision 1.50 2006/01/03 06:19:31 steve
|
* Revision 1.50 2006/01/03 06:19:31 steve
|
||||||
* Support wide divide nodes.
|
* Support wide divide nodes.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ident "$Id: vvp_net.h,v 1.49 2005/11/26 17:16:05 steve Exp $"
|
#ident "$Id: vvp_net.h,v 1.50 2006/03/08 05:29:42 steve Exp $"
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
|
|
@ -309,6 +309,9 @@ extern vvp_vector2_t operator * (const vvp_vector2_t&, const vvp_vector2_t&);
|
||||||
extern vvp_vector2_t operator / (const vvp_vector2_t&, const vvp_vector2_t&);
|
extern vvp_vector2_t operator / (const vvp_vector2_t&, const vvp_vector2_t&);
|
||||||
extern vvp_vector2_t operator % (const vvp_vector2_t&, const vvp_vector2_t&);
|
extern vvp_vector2_t operator % (const vvp_vector2_t&, const vvp_vector2_t&);
|
||||||
extern vvp_vector4_t vector2_to_vector4(const vvp_vector2_t&, unsigned wid);
|
extern vvp_vector4_t vector2_to_vector4(const vvp_vector2_t&, unsigned wid);
|
||||||
|
/* A c4string is of the form C4<...> where ... are bits. */
|
||||||
|
extern vvp_vector4_t c4string_to_vector4(const char*str);
|
||||||
|
|
||||||
extern ostream& operator<< (ostream&, const vvp_vector2_t&);
|
extern ostream& operator<< (ostream&, const vvp_vector2_t&);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1005,6 +1008,9 @@ inline void vvp_send_vec4_pv(vvp_net_ptr_t ptr, const vvp_vector4_t&val,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: vvp_net.h,v $
|
* $Log: vvp_net.h,v $
|
||||||
|
* Revision 1.50 2006/03/08 05:29:42 steve
|
||||||
|
* Add support for logic parameters.
|
||||||
|
*
|
||||||
* Revision 1.49 2005/11/26 17:16:05 steve
|
* Revision 1.49 2005/11/26 17:16:05 steve
|
||||||
* Force instruction that can be indexed.
|
* Force instruction that can be indexed.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue