Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   VHDL (http://www.velocityreviews.com/forums/f18-vhdl.html)
-   -   How portable is this code? (http://www.velocityreviews.com/forums/t644469-how-portable-is-this-code.html)

Tricky 11-14-2008 03:03 PM

How portable is this code?
 
consider the following functions:

function get_i return integer is
begin
return 10;
end function get_i;

function get_i return boolean is
begin
return true;
end function get_i;

they both have the same name but different return types. are these
going to be safe in something like this statement across most, if not
all simulators?

echo(integer'image(get_i) & " " & boolean'image(get_i) & LF);

Am I creating a potentially confusing (for the simulator/synthesisor)
situation?

Mike Treseler 11-14-2008 04:08 PM

Re: How portable is this code?
 
Tricky wrote:

> Am I creating a potentially confusing (for the simulator/synthesisor)
> situation?


As long as the return types are different,
the function IDs can be the same.

-- Mike Treseler

Martin Thompson 11-17-2008 10:57 AM

Re: How portable is this code?
 
Tricky <Trickyhead@gmail.com> writes:

> consider the following functions:
>
> function get_i return integer is
> begin
> return 10;
> end function get_i;
>
> function get_i return boolean is
> begin
> return true;
> end function get_i;
>


I make lots of use of this in my simulations. For example, I have
functions to decode data streams which can return several different types,
depending on how much the data I'm interested in having returned to
me.

I've never tried it in synthesis though - it ought to work,
but... well, let's say I'm a bit more pessimistic in my expectations
of synth tools (although not as much as some are :)

Cheers,
Martin

--
martin.j.thompson@trw.com
TRW Conekt - Consultancy in Engineering, Knowledge and Technology
http://www.conekt.net/electronics.html


All times are GMT. The time now is 06:31 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57