Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

Confusion on signal attribute HIGH

Hello,

I have a probleb understanding the attribute HIGH. I googled and I can understand what it means and how it applies to certain cases. But I am trying to figured out an IP and it is essential that I absolutely correctly figure out how HIGH, or what value HIGH returns to understant the process.

Basically I have something like this:

ARCHITECTURE something OF someotherthing IS

CONSTANT constVal : positive := 100;

SIGNAL someSignal : unsigned (10 down to 0);

....

....

someSignal <= to_unsigned(constVal, someSignal'LENGTH);

Now there is a statement:

somesignal(somesginal'high)

I am a little confused what value it returns here. Some explanation is greatly appreciated.

Thank you.

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    someSignal(10) (type'high designates the highest index value of a bit vector)

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    the 'high attribute returns either the highest value of a type, or the highest index in an array type:

    signal slv0 : std_logic_vector(10 downto 0);

    signal slv1 : std_logic_vector(3 to 99);

    subtype myint0 is integer range -10 to 17;

    subtype myint1 is natural range 18 to 66;

    type sometype is (A, B, C, D, E);

    slv0'high = 10

    slv1'high = 99

    myint0'high = 17

    myint1'high = 66

    sometype'high = E
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thank you very much FvM, Tricky.

    I thought it is so but wasn't sure. Thank you for confirming it with examples.

    Cheers.