Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21325 Discussions

BCD to binary conversion

Altera_Forum
Honored Contributor II
2,346 Views

Hello, I have implemented 32-bit to BCD converter, simple algorithm was easy to find on the internet, doing conversion with single shifting pass through data register. Can you please suggest backward conversion - BCD to 32-bit (e.g. without multiplications)? Thanks!

0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
953 Views

Finally found it here http://forums.terraria.org/index.php?threads/project-bcd-to-binary-converter.30458/ 

 

"The double-dabble mechanism is a well known algorithm to convert binary-to-BCD, so reversing the algorithm allows for the reverse conversion. In the reverse algorithm, the information stored in the bits is right shifted, and then any number greater than 7 stored in any of the BCD units is reduced by 3". Simple and clear. 

 

Was worth of an hour of searching as there were some more sources which are badly explained or just seem to be wrong!
0 Kudos
Altera_Forum
Honored Contributor II
953 Views

Thanks for the sharing.

0 Kudos
Reply