Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
VHDL
type casting / conversion again
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Jonathan Bromley, post: 4146617"] Yes - good catch. Sorry. Yes, the MSB is always 'left and I probably should have used that. However, there's still another potential goof because when writing acc(acc'left downto acc'left) you need to choose "to" or "downto" based on the original declaration of acc. However, if you get that wrong the compiler will pick it up. I wish it were possible to declare unconstrained arrays in VHDL with the to/downto direction constrained: type jonathans_unsigned is array(natural range >) of ... (where "range <>" allows both to/downto, "range >" allows only downto, "range <" allows only to) so that it would then be illegal to declare any jonathans_unsigned with a "to" direction. But it is not so :-( The standard defence against being given an array that might have inappropriate direction is to copy or alias it onto an array whose subscript range you've normalized. I'm pretty paranoid about always doing that in real code, but I got sloppy in this morning's post. Thanks Jonathan [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
VHDL
type casting / conversion again
Top