Add support for array iterator scan.
With the array vals_words method of getting compact vpiHandles to words of a var array, it becomes easy to support the array iterators.
This commit is contained in:
parent
3189efacbc
commit
4c3d764a86
18
vvp/array.cc
18
vvp/array.cc
|
|
@ -311,7 +311,8 @@ static void vpi_array_var_word_get_value(vpiHandle ref, p_vpi_value value)
|
||||||
|
|
||||||
unsigned index = decode_array_word_pointer(obj, parent);
|
unsigned index = decode_array_word_pointer(obj, parent);
|
||||||
|
|
||||||
assert(0);
|
vpip_vec4_get_value(parent->vals[index], parent->vals_width,
|
||||||
|
false, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static vpiHandle vpi_array_var_word_put_value(vpiHandle ref, p_vpi_value vp, int flags)
|
static vpiHandle vpi_array_var_word_put_value(vpiHandle ref, p_vpi_value vp, int flags)
|
||||||
|
|
@ -338,11 +339,18 @@ static vpiHandle array_iterator_scan(vpiHandle ref, int)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(obj->array->nets != 0);
|
unsigned use_index = obj->next;
|
||||||
|
|
||||||
vpiHandle res = obj->array->nets[obj->next];
|
|
||||||
obj->next += 1;
|
obj->next += 1;
|
||||||
return res;
|
|
||||||
|
if (obj->array->nets)
|
||||||
|
return obj->array->nets[obj->next];
|
||||||
|
|
||||||
|
assert(obj->array->vals);
|
||||||
|
|
||||||
|
if (obj->array->vals_words == 0)
|
||||||
|
array_make_vals_words(obj->array);
|
||||||
|
|
||||||
|
return &(obj->array->vals_words[use_index].base);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int array_iterator_free_object(vpiHandle ref)
|
static int array_iterator_free_object(vpiHandle ref)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue