[SOLVED] bcd to decimal conversion

Status
Not open for further replies.

manasic

Junior Member level 1
Joined
Nov 2, 2013
Messages
15
Helped
1
Reputation
2
Reaction score
1
Trophy points
3
Visit site
Activity points
154
hello friends;

I have a requirement for my project in which, I need to extract individual digit from a BCD digit say(001000110001 => 231 like "0010", "0011", "0001"). How can I do it. What's the easiest method to get it?

Thanks & Regards;
Manasi CHoudhari
 

You really don't give us a lot of information. With C? with assembler? With PL-1? With BASIC? With...., shall I go on????
 

Hey Barry;

I thought you could interpret it should be in VHDL... As I have posted it under FPGA thread..... As by far people program it in VHDL... well its FPGA...
 

Hey Barry;

I thought you could interpret it should be in VHDL... As I have posted it under FPGA thread..... As by far people program it in VHDL... well its FPGA...

No he really couldn't. Because I thought it was totally obvious it would be in verilog. And it would be purely simulated (no hardware target) in Questa, because there is no logical alternative, right? right. translation: don't assume stuff, specify stuff. Saves all of us time.
 
Reactions: barry

    barry

    Points: 2
    Helpful Answer Positive Rating
ok, will keep in mind... I was to much thinking about the logic myself and assumed that everything else is obvious...
Sorry for incomplete information...

Manasi
 

[MERGED] BCD to decimal conversion question on algorithm

Hi all;

I want to write a function for converting a BCD number into decimal in VHDL. I looked for algorithms online but did not quite understand the logic behind it. I feel one can do it following way:

I have an address input as BCD value. So it can be broken into the chunks of 4 bits. And then converted into the corresponding decimals. However, I find it’s a bit crude. Is there any better way to achieve same thing.

Is there any standard algorithm for BCD to decimal conversion?

Manasi
 

Re: BCD to decimal conversion question on algorithm

Hi Manasi,

The same way You can broken the input BCD value into chunks of 4 and represent it in decimal.
Once you broken the BCD value into 4 bit of chunks, it will contains values from "0000" to "1001", means in decimal it is from 0 to 9.

Can you specify the input and output ports for your design, with number of bits ?
 
Is there any reason your input is in BCD? BCD -> hex conversion is a bit rubbish logic wise.
 

I want it that way , becos I am designing an irregular router algorithm... and input in BCD simplifies it a little bit....
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…