Add value change callback for vpiPartSelect.
The __vpiPV objects express themselves as vpiPartSelect objects. Add support for value change callbacks by attaching the callback to the signal that we part select from.
This commit is contained in:
parent
34efc7db51
commit
24da00bd5a
|
|
@ -1119,6 +1119,7 @@ static PLI_INT32 sys_monitor_calltf(PLI_BYTE8*name)
|
|||
case vpiReg:
|
||||
case vpiIntegerVar:
|
||||
case vpiRealVar:
|
||||
case vpiPartSelect:
|
||||
/* Monitoring reg and net values involves setting
|
||||
a callback for value changes. Pass the storage
|
||||
pointer for the callback itself as user_data so
|
||||
|
|
|
|||
|
|
@ -164,6 +164,10 @@ static struct __vpiCallback* make_value_change(p_cb_data data)
|
|||
vpip_array_word_change(obj, data->obj);
|
||||
break;
|
||||
|
||||
case vpiPartSelect:
|
||||
vpip_part_select_value_change(obj, data->obj);
|
||||
break;
|
||||
|
||||
case vpiModule:
|
||||
case vpiConstant:
|
||||
case vpiParameter:
|
||||
|
|
|
|||
|
|
@ -234,6 +234,10 @@ struct __vpiPV {
|
|||
extern vpiHandle vpip_make_PV(char*name, int base, int width);
|
||||
extern vpiHandle vpip_make_PV(char*name, int tbase, int twid, int width);
|
||||
|
||||
extern struct __vpiPV* vpip_PV_from_handle(vpiHandle obj);
|
||||
extern void vpip_part_select_value_change(struct __vpiCallback*cbh, vpiHandle obj);
|
||||
|
||||
|
||||
/*
|
||||
* This function safely converts a vpiHandle back to a
|
||||
* __vpiSignal. Return a nil if the type is not appropriate.
|
||||
|
|
|
|||
|
|
@ -1146,6 +1146,14 @@ static const struct __vpirt vpip_PV_rt = {
|
|||
0
|
||||
};
|
||||
|
||||
struct __vpiPV* vpip_PV_from_handle(vpiHandle obj)
|
||||
{
|
||||
if (obj->vpi_type->type_code == vpiPartSelect)
|
||||
return (__vpiPV*) obj;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
vpiHandle vpip_make_PV(char*var, int base, int width)
|
||||
{
|
||||
|
||||
|
|
@ -1174,3 +1182,16 @@ vpiHandle vpip_make_PV(char*var, int tbase, int twid, int width)
|
|||
|
||||
return &obj->base;
|
||||
}
|
||||
|
||||
void vpip_part_select_value_change(struct __vpiCallback*cbh, vpiHandle ref)
|
||||
{
|
||||
struct __vpiPV*obj = vpip_PV_from_handle(ref);
|
||||
assert(obj);
|
||||
|
||||
vvp_fun_signal_base*sig_fun;
|
||||
sig_fun = dynamic_cast<vvp_fun_signal_base*>(obj->net->fun);
|
||||
assert(sig_fun);
|
||||
|
||||
/* Attach the __vpiCallback object to the signal. */
|
||||
sig_fun->add_vpi_callback(cbh);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue