Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > How to step through an enumerated type?

Reply
Thread Tools

How to step through an enumerated type?

 
 
Andrew FPGA
Guest
Posts: n/a
 
      06-25-2006
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

 
Reply With Quote
 
 
 
 
amakyonin
Guest
Posts: n/a
 
      06-26-2006

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

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Step By Step Instructions Glenallan Wireless Networking 15 12-29-2004 12:13 AM
can somebody guide me through this step by step? Taquin Noel Wireless Networking 5 12-26-2004 01:31 AM
Re: Office XP Step by Step Interactive Training Jeffrey W. Roach Microsoft Certification 2 07-13-2003 11:25 PM
step by step loading a design into flash with nios excalibur jaap de verwant slachter VHDL 0 07-01-2003 01:02 PM



Advertisments