Add support for arrays of real nets.
This patch adds support for arrays of real values nets (wire real).
This commit is contained in:
parent
9b89ca49bb
commit
22ddb26389
|
|
@ -443,12 +443,13 @@ extern void compile_net_real(char*label, char*name,
|
|||
|
||||
extern void compile_netw(char*label, char*array_symbol,
|
||||
unsigned long array_addr,
|
||||
int msb, int lsb, bool signed_flag,
|
||||
bool net8_flag,
|
||||
unsigned argc, struct symb_s*argv);
|
||||
int msb, int lsb, bool signed_flag,
|
||||
bool net8_flag,
|
||||
unsigned argc, struct symb_s*argv);
|
||||
extern void compile_netw_real(char*label, char*array_symbol,
|
||||
int msb, int lsb,
|
||||
unsigned argc, struct symb_s*argv);
|
||||
unsigned long array_addr,
|
||||
int msb, int lsb,
|
||||
unsigned argc, struct symb_s*argv);
|
||||
|
||||
extern void compile_alias(char*label, char*name,
|
||||
int msb, int lsb, bool signed_flag,
|
||||
|
|
|
|||
|
|
@ -668,6 +668,11 @@ statement
|
|||
symbols_net ';'
|
||||
{ compile_netw($1, $3, $4, $6, $7, true, true, $9.cnt, $9.vect); }
|
||||
|
||||
| T_LABEL K_NET_R T_SYMBOL T_NUMBER ','
|
||||
signed_t_number signed_t_number ','
|
||||
symbols_net ';'
|
||||
{ compile_netw_real($1, $3, $4, $6, $7, $9.cnt, $9.vect); }
|
||||
|
||||
/* Array word versions of alias directives. */
|
||||
|
||||
| T_LABEL K_ALIAS T_SYMBOL T_NUMBER ','
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ vpiHandle vpip_make_real_var(const char*name, vvp_net_t*net)
|
|||
|
||||
obj->base.vpi_type = &vpip_real_var_rt;
|
||||
obj->parent = 0;
|
||||
obj->id.name = vpip_name_string(name);
|
||||
obj->id.name = name ? vpip_name_string(name) : 0;
|
||||
obj->net = net;
|
||||
|
||||
obj->scope = vpip_peek_current_scope();
|
||||
|
|
|
|||
43
vvp/words.cc
43
vvp/words.cc
|
|
@ -154,8 +154,8 @@ static void __compile_net(char*label, char*name,
|
|||
|
||||
vvp_net_t*node = new vvp_net_t;
|
||||
|
||||
vvp_array_t array = array_label? array_find(array_label) : 0;
|
||||
assert(array_label? array!=0 : true);
|
||||
vvp_array_t array = array_label ? array_find(array_label) : 0;
|
||||
assert(array_label ? array!=0 : true);
|
||||
|
||||
vvp_fun_signal_base*vsig = net8_flag
|
||||
? dynamic_cast<vvp_fun_signal_base*>(new vvp_fun_signal8(wid))
|
||||
|
|
@ -210,11 +210,16 @@ void compile_netw(char*label, char*array_label, unsigned long array_addr,
|
|||
argc, argv);
|
||||
}
|
||||
|
||||
void compile_net_real(char*label, char*name, int msb, int lsb, bool local_flag,
|
||||
unsigned argc, struct symb_s*argv)
|
||||
static void __compile_real(char*label, char*name,
|
||||
char*array_label, unsigned long array_addr,
|
||||
int msb, int lsb, bool local_flag,
|
||||
unsigned argc, struct symb_s*argv)
|
||||
{
|
||||
vvp_net_t*net = new vvp_net_t;
|
||||
|
||||
vvp_array_t array = array_label ? array_find(array_label) : 0;
|
||||
assert(array_label ? array!=0 : true);
|
||||
|
||||
vvp_fun_signal_real*fun = new vvp_fun_signal_real;
|
||||
net->fun = fun;
|
||||
|
||||
|
|
@ -226,18 +231,40 @@ void compile_net_real(char*label, char*name, int msb, int lsb, bool local_flag,
|
|||
/* Connect the source to my input. */
|
||||
inputs_connect(net, 1, argv);
|
||||
|
||||
vpiHandle obj = 0;
|
||||
if (! local_flag) {
|
||||
/* Make the vpiHandle for the reg. */
|
||||
vpiHandle obj = vpip_make_real_var(name, net);
|
||||
obj = vpip_make_real_var(name, net);
|
||||
/* This attaches the label to the vpiHandle */
|
||||
compile_vpi_symbol(label, obj);
|
||||
vpip_attach_to_current_scope(obj);
|
||||
}
|
||||
|
||||
/* If this is an array word, then attach it to the
|
||||
array. Otherwise, attach it to the current scope. */
|
||||
if (array)
|
||||
array_attach_word(array, array_addr, obj);
|
||||
else if (obj)
|
||||
vpip_attach_to_current_scope(obj);
|
||||
free(label);
|
||||
free(name);
|
||||
if (name) free(name);
|
||||
if (array_label) free(array_label);
|
||||
free(argv);
|
||||
}
|
||||
|
||||
void compile_net_real(char*label, char*name, int msb, int lsb, bool local_flag,
|
||||
unsigned argc, struct symb_s*argv)
|
||||
{
|
||||
__compile_real(label, name, 0, 0,
|
||||
msb, lsb, local_flag, argc, argv);
|
||||
}
|
||||
|
||||
void compile_netw_real(char*label, char*array_label, unsigned long array_addr,
|
||||
int msb, int lsb,
|
||||
unsigned argc, struct symb_s*argv)
|
||||
{
|
||||
__compile_real(label, 0, array_label, array_addr,
|
||||
msb, lsb, false, argc, argv);
|
||||
}
|
||||
|
||||
void compile_aliasw(char*label, char*array_label, unsigned long array_addr,
|
||||
int msb, int lsb, unsigned argc, struct symb_s*argv)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue