Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Cascading the attributes

Reply
Thread Tools

Cascading the attributes

 
 
valtih1978
Guest
Posts: n/a
 
      05-25-2013
What is supposed to happen when one invokes
boolean'base'base'image(true)'base'base'val(1) or E'SIMPLE_NAME'length
or S'transaction'transaction?
 
Reply With Quote
 
 
 
 
valtih1978
Guest
Posts: n/a
 
      05-28-2013
and, the most intriguing,

val := a'range'high

It seems that there is internal range type in VHDL. Although it is not
exposed explicitly and, therefore you cannot instantiate objects of this
type, I see no rule that forbids testing its attributes this way.

Similarly to OOP, where you write object.method(arg), where methods are
just functions, tied to the object, I consider the attribute as a
function (operators are the other kind of fancy functions). It takes an
object and produces a result. I see no objection against cascading
function calls.
 
Reply With Quote
 
 
 
 
valtih1978
Guest
Posts: n/a
 
      05-29-2013
arr : string (5 downto 3);

Should arr'range'rightof(5) evaluate to 6 or 4?
 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      06-03-2013
Actually, the string type's index is positive (which is an integer subtype), so

arr'range is integer range 5 downto 3;

Therefore arr'range'rightof(5) evaluates to an integer value of 4.

Andy
 
Reply With Quote
 
valtih1978
Guest
Posts: n/a
 
      06-03-2013
Thanks for your answers. You is the first one who almost explicitly says
that cascading is not prohibited in the LRM and "should just work". I
asked this question just because our de-facto standard implementaion,
called Modelsim, does not think so. Particularly, he produces
compilation error

| Prefix (attribute name "range") for attribute "rightof"
| is not a type mark

for arr'range'rightof(5) whose syntax you have approved.

Might be somebody can comment on Modelsim behaviour.

 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      06-03-2013
Alan,

Per LRM (200 16.2 Predefined attributes, A'range is of kind "range", whereas T'base is of kind "type". Also, the result of A'range is defined as a range of the index type of A, which is not a type itself.

So arr'range is just "5 downto 3", not "integer range 5 downto 3".

Accordingly, you would not be able to use A'range as follows:

variable arr_ndx : arr'range;

But you could use:

variable arr_ndx : integer range arr'range;

To get what was apparently desired from arr'range'rightof(5), you'd probably need to write a function.

Andy
 
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
The node.js Community is Quietly Changing the Face of Open Source Rodrick Brown Python 2 04-17-2013 04:47 PM
Re: The node.js Community is Quietly Changing the Face of Open Source Sven Python 0 04-16-2013 04:41 PM
Re: The node.js Community is Quietly Changing the Face of Open Source Ned Batchelder Python 0 04-16-2013 04:25 PM
Is there a difference between the use of the word montage vscollage Danny D. Digital Photography 8 04-15-2013 02:24 PM
Windows 8 - so bad it's hastening the death of the PC? ~misfit~ NZ Computing 18 04-15-2013 04:15 AM



Advertisments