Extracting digits [0-9] from an number/integer

M

--mms

Hi:


I would like to know if there is any function/method, in VHDL, to
extract the digits of an integer.

What I wish to do is take, for example, an integer like 2043, and
extract first the number '3', then '4', '0', and '2'.

Each digit will then be converted to a std_logic_vector(3 downto 0).



Thank you!,
m m s
 
M

m__ m___s

Thank you. It seems that is what I was looking for. :)

It is an integer signal that holds the "i" of a counter. The counter
goes from 0 to 2046. I needed each digit separately to display it on
the LCD screen that has the Spartan-3A board.


--m m _s[/QUOTE]
 
R

rickman

Thank you. It seems that is what I was looking for. :)

It is an integer signal that holds the "i" of a counter. The counter
goes from 0 to 2046. I needed each digit separately to display it on
the LCD screen that has the Spartan-3A board.

There is more than one way to skin a cat. If you are incrementing the
counter, then you can just form a BCD counter and increment that.
That is likely going to use fewer resources than the conversion
code.

Rick
 
Joined
Mar 10, 2008
Messages
348
Reaction score
0
More then one way to skin a cat ....

I agree - it will properly cost you less logic if you implement a binary counter and a BCD counter as well

Jeppe
 
V

Victor

Hi:

I would like to know if there is any function/method, in VHDL, to
extract the digits of an integer.

What I wish to do is take, for example, an integer like 2043, and
extract first the number '3', then '4', '0', and '2'.

Each digit will then be converted to a std_logic_vector(3 downto 0).

Thank you!,
m m  s

you can have 4 counters for each integer.
each can advanced 1 when the before one reached 10.
 

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

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top