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

Reply

VHDL - binary to decimal

 
Thread Tools Search this Thread
Old 06-16-2005, 11:39 AM   #1
Default binary to decimal


hi all
i need code for two functions in vhdl.
1. binary to integer ( any lenth _ no problem)
2. interger to binary

iam very thankful to you all .
bye



srinukasam
  Reply With Quote
Old 06-16-2005, 03:25 PM   #2
Ralf Hildebrandt
 
Posts: n/a
Default Re: binary to decimal
srinukasam wrote:

> i need code for two functions in vhdl.
> 1. binary to integer ( any lenth _ no problem)
> 2. interger to binary


Take a look into the packages!

library IEEE;
use IEEE.numeric_std.all;
--
signal my_sulv1 : std_ulogic_vector(15 downto 0);
signal my_int : integer;
signal my_sulv2 : std_ulogic_vector(15 downto 0);
--
my_int <= to_integer(unsigned(my_sulv1));

my_sulv2 <= std_ulogic_vector(to_unsigned(my_int, 16));


Ralf


Ralf Hildebrandt
  Reply With Quote
Old 06-17-2005, 01:36 PM   #3
bstaicu
 
Posts: n/a
Default Re: binary to decimal
try conv_integer(unsigned(x)) and conv_std_logic_vector(integer,
number_of_bits_for_conversion)

I believe they're both defined in IEEE.std_logic_arith



bstaicu
  Reply With Quote
Old 06-17-2005, 02:27 PM   #4
Ralf Hildebrandt
 
Posts: n/a
Default Re: binary to decimal
bstaicu wrote:

> try conv_integer(unsigned(x)) and conv_std_logic_vector(integer,
> number_of_bits_for_conversion)
>
> I believe they're both defined in IEEE.std_logic_arith


Non, please don't try them, because std_logic_arith is NOT a standard
library while numeric_std is one. Therefore your code may not run as
expected on different simulators and synthesis tools.

Ralf


Ralf Hildebrandt
  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
image (jpg,bmp,gif, etc.) convert to equivalent binary representation using vb.net? archieSupremo Software 0 09-06-2009 12:20 PM
reading mp3 file in binary format in vhdl latheesh General Help Related Topics 0 02-05-2008 05:40 AM
how to round off decimal point arianne75 General Help Related Topics 0 06-08-2007 07:17 AM
Hexadecimal to Decimal Paul Ashworth A+ Certification 1 01-05-2005 09:30 AM
Counting In Binary Raymond A+ Certification 13 03-07-2004 07:28 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