How to step through an enumerated type?

Discussion in 'VHDL' started by Andrew FPGA, Jun 25, 2006.

  1. Andrew FPGA

    Andrew FPGA Guest

    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, Jun 25, 2006
    #1
    1. Advertising

  2. Andrew FPGA

    amakyonin Guest

    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.
     
    amakyonin, Jun 26, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jaap de verwant slachter
    Replies:
    0
    Views:
    1,270
    jaap de verwant slachter
    Jul 1, 2003
  2. Roy in

    need step by step example

    Roy in, Aug 3, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    361
    Roy in
    Aug 3, 2003
  3. Steve Richter

    a step by step page

    Steve Richter, May 3, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    380
    Steve Richter
    May 3, 2005
  4. craig dicker
    Replies:
    1
    Views:
    377
    Peter Rilling
    Jul 10, 2005
  5. =?Utf-8?B?Qm9va2VyVw==?=

    Need Step by Step guide for setting up IIS 6 for ASP

    =?Utf-8?B?Qm9va2VyVw==?=, Jan 12, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    7,324
    =?Utf-8?B?Qm9va2VyVw==?=
    Feb 9, 2006
Loading...

Share This Page