From 52d05c021594aa961f7a765cd075a1a872f9d3d9 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 12 Oct 2011 09:29:55 -0700 Subject: [PATCH] Use correct name to iterate on enumeration constants. The standard defines how to calculate the name for an access function or iterator if one is not given. It is supposed to be vpi followed by the words in the name with each word capitalized. For the one to many (iterator) interface from the enumeration typespec to the individual constants this is vpiEnumConst not vpiMember. --- vpi/v2009_enum.c | 6 +++--- vvp/enum_type.cc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vpi/v2009_enum.c b/vpi/v2009_enum.c index a48f3c9d0..366185e86 100644 --- a/vpi/v2009_enum.c +++ b/vpi/v2009_enum.c @@ -281,7 +281,7 @@ static PLI_INT32 ivl_enum_method_next_prev_calltf(PLI_BYTE8*name) } /* Search for the current value in the enumeration list. */ - enum_list = vpi_iterate(vpiMember, arg_enum); + enum_list = vpi_iterate(vpiEnumConst, arg_enum); assert(enum_list); do { cur = vpi_scan(enum_list); @@ -307,7 +307,7 @@ static PLI_INT32 ivl_enum_method_next_prev_calltf(PLI_BYTE8*name) if (strcmp(name, "$ivl_enum_method$next") == 0) { /* Check to see if we need to wrap to the beginning. */ if (loc + count > enum_size) { - enum_list = vpi_iterate(vpiMember, arg_enum); + enum_list = vpi_iterate(vpiEnumConst, arg_enum); assert(enum_list); count -= (enum_size - loc); } @@ -321,7 +321,7 @@ static PLI_INT32 ivl_enum_method_next_prev_calltf(PLI_BYTE8*name) } else { /* The element we want is before the current * element (at the beginning of the list). */ - enum_list = vpi_iterate(vpiMember, arg_enum); + enum_list = vpi_iterate(vpiEnumConst, arg_enum); assert(enum_list); count = loc - count; } diff --git a/vvp/enum_type.cc b/vvp/enum_type.cc index b59b74641..13ad72b4b 100644 --- a/vvp/enum_type.cc +++ b/vvp/enum_type.cc @@ -87,7 +87,7 @@ static vpiHandle enum_type_iterate(int code, vpiHandle obj) struct __vpiEnumTypespec*ref = vpip_enum_typespec_from_handle(obj); assert(ref); - if (code == vpiMember) { + if (code == vpiEnumConst) { vpiHandle*args = (vpiHandle*) calloc(ref->names.size(), sizeof(vpiHandle*)); for (size_t idx = 0 ; idx < ref->names.size() ; idx += 1)