Where can I find soft-multiply and divide algorithms?

前端 未结 7 1981
萌比男神i
萌比男神i 2021-02-19 09:00

I\'m working on a micro-controller without hardware multiply and divide. I need to cook up software algorithms for these basic operations that are a nice balance of compact siz

7条回答
  •  不思量自难忘°
    2021-02-19 09:51

    The Microchip PICmicro 16Fxxx series chips do not have a multiply or divide instruction. Perhaps some of the soft multiply and soft divide routines for it can be ported to your MCU.

    PIC Microcontroller Basic Math Multiplication Methods

    PIC Microcontroller Basic Math Division Methods

    Also check out "Newton's method" for division. I think that method gives the smallest executable size of any division algorithm I've ever seen, although the explanation makes it sound more complicated than it really is. I hear that some early Cray supercomputers used Newton's method for division.

提交回复
热议问题