Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Convert a signed binary number into a signed one ?

Reply
Thread Tools

Convert a signed binary number into a signed one ?

 
 
Rob1bureau Rob1bureau is offline
Junior Member
Join Date: Feb 2010
Posts: 1
 
      02-26-2010
Hello, I'm new in VHDL.


I have a basic question, but 3 hours of searches didn't provide any useful answer.

I got two SIGNALs, one unsigned, the other signed. I want to do something like :

Code:
SIGNAL Consigne_TMP : signed(7 DOWNTO 0);
SIGNAL Mot_Labview : unsigned(7 DOWNTO 0);

Mot_Labview(7) <= to_unsigned(Consigne_TMP(7), 8);
How should I do ?
 
Reply With Quote
 
 
 
 
joris joris is offline
Senior Member
Join Date: Jan 2009
Posts: 152
 
      02-27-2010
Uhm writing only Mot_Labview(7) doesn't need any "conversion" (just copies the individual bit) :
Code:
Mot_Labview(7) <= Consigne_TMP(7);
Copying a larger part does need a "conversion" (reinterpretation of the bits) :
Code:
Mot_Labview(6 downto 0) <= unsigned(Consigne_TMP(6 downto 0));
"to_unsigned" is used to "convert" an integer into an unsigned:
Code:
SIGNAL int_Mot_Labview : integer range -128 to 127;
SIGNAL Mot_Labview : unsigned(7 DOWNTO 0);

Mot_Labview <= to_unsigned(int_Mot_Labview, 8);
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
conversion of real number into binary number rajeswari01 Hardware 1 07-15-2011 05:30 AM
conversion of real number into binary number rajeswari01 Hardware 0 10-15-2010 12:30 AM
How do you convert a hexadecimal number to a binary number? Bob Sanders Ruby 5 05-30-2008 11:50 AM
real number to 16 bit signed number hari VHDL 6 05-02-2004 04:10 PM
Convert decimal number in binary number makok VHDL 1 02-23-2004 06:04 PM



Advertisments