![]() |
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? |
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 |
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.