Report that vpi_handle_by_index() is not supported for a vpiNet
This commit is contained in:
parent
9e25884f12
commit
92e4ca3a92
|
|
@ -279,6 +279,7 @@ struct __vpiSignal : public __vpiHandle {
|
|||
vpiHandle vpi_put_value(p_vpi_value val, int flags);
|
||||
vpiHandle vpi_handle(int code);
|
||||
vpiHandle vpi_iterate(int code);
|
||||
vpiHandle vpi_index(int idx);
|
||||
|
||||
union { // The scope or parent array that contains me.
|
||||
vpiHandle parent;
|
||||
|
|
|
|||
|
|
@ -653,6 +653,24 @@ static vpiHandle signal_iterate(int code, vpiHandle ref)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static vpiHandle signal_index(int idx, vpiHandle ref)
|
||||
{
|
||||
struct __vpiSignal*rfp = dynamic_cast<__vpiSignal*>(ref);
|
||||
assert(rfp);
|
||||
/* Check to see if the index is in range. */
|
||||
if (rfp->msb >= rfp->lsb) {
|
||||
if ((idx > rfp->msb) || (idx < rfp->lsb)) return 0;
|
||||
} else {
|
||||
if ((idx < rfp->msb) || (idx > rfp->lsb)) return 0;
|
||||
}
|
||||
/* Return a handle for the individual bit. */
|
||||
cerr << "Sorry: Icarus does not currently support "
|
||||
<< "vpi_get_handle_by_index() for "
|
||||
<< vpi_get_str(vpiType, ref);
|
||||
cerr << " objects (" << vpi_get_str(vpiName, ref) << ")." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned signal_width(const struct __vpiSignal*rfp)
|
||||
{
|
||||
unsigned wid = (rfp->msb >= rfp->lsb)
|
||||
|
|
@ -895,6 +913,9 @@ vpiHandle __vpiSignal::vpi_handle(int code)
|
|||
vpiHandle __vpiSignal::vpi_iterate(int code)
|
||||
{ return signal_iterate(code, this); }
|
||||
|
||||
vpiHandle __vpiSignal::vpi_index(int idx)
|
||||
{ return signal_index(idx, this); }
|
||||
|
||||
struct signal_reg : public __vpiSignal {
|
||||
inline signal_reg() { }
|
||||
int get_type_code(void) const { return vpiReg; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue