Integer Array - Help

M

Matt North

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
 
R

Ralf Hildebrandt

Matt said:
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
 
M

Mike Treseler

Matt said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,416
Latest member
LionelQ387

Latest Threads

Top