Re: How to step through an enumerated type?




I have not checked out how XST handles enumeration attributes. You may
have some luck using the 'val and 'pos attributes to replicate 'succ:

next_enum_value :=
enum_value_type'val(enum_value_type'pos(current_enum_val)+1);

You will have to ensure you don't attempt to index past the end of the
enum.

If you're iterating over a fixed sequence of elements in the
enumeration type you should try using the 'range attribute in a loop or
a for-generate:

for i in enum_value_type'range loop
...
end for;

With Synplify this works provided the enum has a binary encoding. If
you only want to iterate over a subset of the enum then you can create
a subtype with the necessary bounds and use its 'range attribute for
the loop boundy condition.

.



Relevant Pages

  • Re: enum type int or unsigned int?
    ... that have type int and may appear wherever such are permitted. ... values of all the members of the enumeration. ... "enum" types are declared via the following syntax: ... so the loop will continue to run. ...
    (comp.lang.c)
  • Re: enum type int or unsigned int?
    ... that have type int and may appear wherever such are permitted. ... values of all the members of the enumeration. ... "enum" types are declared via the following syntax: ... so the loop will continue to run. ...
    (comp.lang.c)
  • Binding a list to an enumeration...
    ... How would I bind a list to an enumeration so that enumeration value becomes ... list values and enumeration constants becomes list text? ... Do you loop ... through enum and add manually or is there a way to databind like when using ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Custom Attributes, Shared methods, Derived classes and reflection
    ... description associated with an enum value. ... enumeration value will give you the name as defined by the enumeration, ... Dim fi As FieldInfo = value.GetType.GetField ... Public Shared Function GetEnumValue ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Custom Attributes, Shared methods, Derived classes and reflection
    ... description associated with an enum value. ... enumeration value will give you the name as defined by the enumeration, ... Dim fi As FieldInfo = value.GetType.GetField ... Public Shared Function GetEnumValue ...
    (microsoft.public.dotnet.languages.vb)