Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > binary to decimal

Reply
Thread Tools

binary to decimal

 
 
srinukasam
Guest
Posts: n/a
 
      06-16-2005
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

 
Reply With Quote
 
 
 
 
Ralf Hildebrandt
Guest
Posts: n/a
 
      06-16-2005
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
 
Reply With Quote
 
 
 
 
bstaicu
Guest
Posts: n/a
 
      06-17-2005
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

 
Reply With Quote
 
Ralf Hildebrandt
Guest
Posts: n/a
 
      06-17-2005
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
 
Reply With Quote
 
vipinlal vipinlal is offline
Member
Join Date: Feb 2010
Posts: 39
 
      04-19-2010
hop this helps:
vhdlguru.blogspot.com/2010/04/8-bit-binary-to-bcd-converter-double.html
 
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
decimal.Decimal formatting python@lists.fastmail.net Python 0 07-19-2010 12:32 PM
how to convert from Decimal('1.23456789') to Decimal('1.234') valpa Python 11 03-24-2009 07:11 AM
Error: Cannot convert Decimal("0.0000") to Decimal Vitaliy Python 1 05-29-2008 10:36 AM
TypeError: unsupported operand type(s) for -: 'Decimal' and 'Decimal'. Why? Gilbert Fine Python 8 08-01-2007 01:58 AM
Decimal to Packed Decimal Conversion in C++ Ven C++ 3 08-01-2006 03:56 PM



Advertisments