Last visit was: Tue May 17, 2022 3:11 pm
It is currently Tue May 17, 2022 3:11 pm

 [ 1 post ] 
 Some BCD arithmetic in an MSP430-based calculator 
Author Message

Joined: Wed Jan 09, 2013 6:54 pm
Posts: 1690
There are several blog posts near here which will be worth reading, for those interested in BCD and CORDIC and so on: ... tions.html ... Calculator

Interesting to see a difference in best practice between two CPU architectures:
In addition to the straightforward method of repeated additions, I tried the quarter squares and Russian peasant algorithms I learned about doing 6502 BCD multiplication. It was a surprise that using quarter squares was over 10% slower on the MSP430 than the Russian peasant algorithm, whereas it was over 4 times faster on the 6502! Part of the difference may be the speed up I get on the MSP430 by converting each digit of one argument to binary (so it can be halved) only once and saving it, rather than converting it every time like on the 6502. Another major difference is how much slower accessing tables on the MSP430 is compared to register operations. It's interesting how the timing of the architecture can decide which algorithm works the fastest. It's also great that the Russian peasant algorithm doesn't need any tables and is therefore much smaller.

Tue Jan 15, 2019 11:21 am
 [ 1 post ] 

Who is online

Users browsing this forum: CCBot and 0 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software