Re: How to step through an enumerated type?
- From: "amakyonin" <amakyonin-u1@xxxxxxxxx>
- Date: 25 Jun 2006 19:33:25 -0700
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.
.
- References:
- How to step through an enumerated type?
- From: Andrew FPGA
- How to step through an enumerated type?
- Prev by Date: Re: Gold code generator
- Next by Date: Re: AHB protocol document - clarification
- Previous by thread: How to step through an enumerated type?
- Index(es):
Relevant Pages
|