Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - How to step through an enumerated type?

 
Thread Tools Search this Thread
Old 06-25-2006, 11:51 PM   #1
Default How to step through an enumerated type?


Hi,
It would seem the use of the predifined attribute "succ" is a nice way
to sequence through the values in an enumerated type.
e.g. next_enum_value := enum_value_type'succ(current_enum_value);

Only problem is, it does not appear to be synthesizable in XST 8.1i
sp3. I get the error message below:
Analyzing Entity <Dummy> (Architecture <dummyarch>).
ERROR:Xst:772 - "C:/project...../Dummy.vhd" line 92: Attribute is not
authorized : 'succ'.

Can anyone suggest a better way of doing this? I.e. it needs to be
synthesisable.

Regards
Andrew



Andrew FPGA
  Reply With Quote
Old 06-26-2006, 03:33 AM   #2
amakyonin
 
Posts: n/a
Default 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_en um_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.

  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump