Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - type casting vs. type converting

 
Thread Tools Search this Thread
Old 09-07-2005, 01:42 PM   #1
Default type casting vs. type converting


type casting vs. type converting... what is the difference? which is
better? any examples would be helpful.



Toby
  Reply With Quote
Old 09-07-2005, 01:57 PM   #2
Toby
 
Posts: n/a
Default Re: type casting vs. type converting
more specifically i am interested in changing between std_logic_vectors
and signed and unsigned types (i.e. from std_logic_vector to unsigned
and from unsigned to std_logic_vector). there doesnt seem to be any
to_unsigned(std_logic_vector) function in the numeric_std library, why
is that? is there any way around that?



Toby
  Reply With Quote
Old 09-07-2005, 02:31 PM   #3
Ben Jones
 
Posts: n/a
Default Re: type casting vs. type converting
Hi Toby,

> there doesnt seem to be any to_unsigned(std_logic_vector) function
> in the numeric_std library, why is that? is there any way around that?


The numeric_std "signed" and "unsigned" types are defined exactly like the
type "std_logic_vector" is defined in std_logic_1164 - they are all arrays
with elements of type std_logic. This makes them what VHDL calls "related"
types, which can easily be convered between. For example:

signal x,y : std_logic_vector(7 downto 0);
signal a,b : unsigned(7 downto 0);

x <= std_logic_vector(a);
b <= unsigned(y);

-Ben-




Ben Jones
  Reply With Quote
Old 09-07-2005, 02:42 PM   #4
Mike Treseler
 
Posts: n/a
Default Re: type casting vs. type converting
Toby wrote:
> more specifically i am interested in changing between std_logic_vectors
> and signed and unsigned types (i.e. from std_logic_vector to unsigned
> and from unsigned to std_logic_vector). there doesnt seem to be any
> to_unsigned(std_logic_vector) function in the numeric_std library, why
> is that? is there any way around that?
>


http://groups.google.com/groups?q=vh...related+typ e

-- Mike Treseler


Mike Treseler
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Eclipse - Axis2 - Java Webservices Error amanjsingh Software 1 10-09-2007 09:03 AM
Need help on Modelsim VHDL syntax? ASAP:) kaji General Help Related Topics 0 03-14-2007 10:43 PM
Need help on a Modelsim VHDL Syntax? ASAP:) kaji Software 0 03-14-2007 10:43 PM
Need Help on a Modelsim VHDL Syntax....ASAP:) kaji Hardware 0 03-14-2007 10:41 PM
HD-DVD and DVD's future Phil Riker DVD Video 68 09-28-2003 09:32 PM




SEO by vBSEO 3.3.2 ©2009, 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