Some BCD arithmetic in an MSP430-based calculator
Page 1 of 1

Author:  BigEd [ Tue Jan 15, 2019 11:21 am ]
Post subject:  Some BCD arithmetic in an MSP430-based calculator

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.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group