- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Type conversion problem
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-26-2008 12:17 PM
Trying to convert std_logic vector to signed data type, but I keep getting - "no feasible entry for subprogram conv_signed"
I have declared all the libraries -
USE ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.all;
USE ieee.std_logic_signed.all;
USE ieee.std_logic_arith.all;
Conv and signal declaration in architecture-
SIGNAL ys: signed(7 downto 0);
ys<=conv_signed(sum,8);
Any help?
Solved! Go to Solution.
Re: Type conversion problem
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-29-2008 09:42 AM
hithesh wrote:Trying to convert std_logic vector to signed data type, but I keep getting - "no feasible entry for subprogram conv_signed"
I have declared all the libraries -
USE ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.all;
USE ieee.std_logic_signed.all;
USE ieee.std_logic_arith.all;
Conv and signal declaration in architecture-
SIGNAL ys: signed(7 downto 0);
ys<=conv_signed(sum,8);
Any help?
yeah -- DO NOT use std_logic_arith and its compadres std_logic_unsigned and std_logic_signed.
Use numeric_std instead.
-a
----------------------------------------------------------------
Yes, I do this for a living.
Re: Type conversion problem
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-29-2008 10:27 AM
Bassman, thanks for the response.
But I also tried numeric_std.all library. I get the following error -
(vcom 1136) unknown identifier conv_signed.
The usage of numeric_std - is it something new, bcoz most of the books dont mention it at all.
Re: Type conversion problem
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-30-2008 09:33 AM
Something new? It's at least 15 years old!
"conv_signed" is a pretty bad name for a function anyway ... does it convert FROM signed or TO signed?
Which is why the equivalent function in nomeric_std is called... "to_signed". Use that instead.
Re: Type conversion problem
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-30-2008 10:45 AM
I am trying to convert a std_logic_vector to a signed type.
Conv_signed should convert, std_logic_vector, unsigned, signed, and integer to signed datatype.
Apparently it is not working.
I tried to_signed , got an error - "No feasible entries for subprogram to_signed"
Re: Type conversion problem
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-30-2008 12:46 PM
oops, sorry:
to_signed would convert from integer types to signed.
std_logic and signed are compatible subtypes; you only need a cast, not a conversion.
my_signed <= signed(my_slv);
my_other_slv <= std_logic_vector(my_signed);
Of course the signals need to be the same size.
Re: Type conversion problem
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-04-2009 08:24 PM
hithesh wrote:I am trying to convert a std_logic_vector to a signed type.
Conv_signed should convert, std_logic_vector, unsigned, signed, and integer to signed datatype.
Apparently it is not working.
I tried to_signed , got an error - "No feasible entries for subprogram to_signed"
See VHDL Math Tricks of the Trade.
----------------------------------------------------------------
Yes, I do this for a living.
Re: Type conversion problem
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-04-2009 09:38 PM
Thanks guys. It worked.
But now, I don't see the point of having signed type.
Signed subration and unsigned subration give the same result, except that the MSB of singed indicates sign.
(If I consider 3-5 in binary, unsigned gives 110, signed results in 1110. Both are the same : -2).
Why have 2 types?
Re: Type conversion problem
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-06-2009 09:42 AM
hithesh wrote:Thanks guys. It worked.
But now, I don't see the point of having signed type.
Signed subration and unsigned subration give the same result, except that the MSB of singed indicates sign.
(If I consider 3-5 in binary, unsigned gives 110, signed results in 1110. Both are the same : -2).
Why have 2 types?
Google "2's Complement."
-a
----------------------------------------------------------------
Yes, I do this for a living.
Re: Type conversion problem
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-06-2009 04:46 PM
I know 2s complement.
Here's why I am unable understand signed type-
I have two std logic vectors - a and b , both 8 bit
Lets say a= -4 (1111 1100) and b= -5 (1111 1011)
If I compare a and b in unsiged, then b is greater than a.
But if they are signed type, then a should be greater than b.
But I get the same result for both signed and unsigned.
I am using signed(a) to convert a to singed type.
Please correct me if I am wrong.











