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

Reply

VHDL - Integer Array - Help

 
Thread Tools Search this Thread
Old 12-02-2003, 02:27 PM   #1
Default Integer Array - Help


I am looking at converting a signal of integer range 0 to 11000 into an
array which holds each digit of the integer.
The obvious solution is to divide the number by 10 then 100 etc, placing the
result in the correct address of the array.
However dividing is far too area intensive on the silicon.

Anyone got any bright ideas?

Thanks,
Matt




Matt North
  Reply With Quote
Old 12-02-2003, 04:16 PM   #2
Ralf Hildebrandt
 
Posts: n/a
Default Re: Integer Array - Help
Matt North wrote:

> I am looking at converting a signal of integer range 0 to 11000 into an
> array which holds each digit of the integer.


If I understand you right, it is a binary->BCD converter.

BCD=binary coded decimals (4 Bit with values in [0,9] )


Ralf



Ralf Hildebrandt
  Reply With Quote
Old 12-02-2003, 06:36 PM   #3
Mike Treseler
 
Posts: n/a
Default Re: Integer Array - Help
Matt North wrote:
> I am looking at converting a signal of integer range 0 to 11000 into an
> array which holds each digit of the integer.


An efficient internal representation is unsigned:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
-- ...

subtype my_type_t is unsigned(13 downto 0);
constant my_num : my_type_t := to_unsigned(11000,my_type_t'length);

Conversion of binary to bcd has been covered in this group.

-- 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
constants as of array of integers, for loops octavsly Hardware 0 04-25-2009 11:53 AM
Array Programme rits Software 2 03-04-2009 05:18 PM
How to convert string contain Hex data into integer asifjavaid Software 0 09-09-2008 08:50 AM
getting integer values from electronic weigh scale through serial port dotnet_smart Software 2 09-17-2006 05:24 AM
getting integer values from electrolnic weigh scale through serial port dotnet_smart Hardware 0 07-28-2006 11:54 AM




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