Searching \ for '16x16 multiplication' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/method/math.htm?key=multiplication
Search entire site for: '16x16 multiplication'.

Truncated match.
PICList Thread
'16x16 multiplication'
1997\08\04@085541 by David BALDWIN

flavicon
face
Has anybody a 16x16 mutilpy code? Thanks a lot. I tried the one from
Microchip but it doesn't work properly all the time:

       8AD3h * 0919h : result OK, but if second 16 bit number > 0919, the
result shift from about 257, and then the multiplication is OK BUT it
has this kind of offset too much. I would appreciate any help. Thanks a
lot.

David

1997\08\04@091428 by WF AUTOMA‚̀O

flavicon
face
David BALDWIN wrote:
>
> Has anybody a 16x16 mutilpy code? Thanks a lot. I tried the one from
> Microchip but it doesn't work properly all the time:
>
>         8AD3h * 0919h : result OK, but if second 16 bit number > 0919, the
> result shift from about 257, and then the multiplication is OK BUT it
> has this kind of offset too much. I would appreciate any help. Thanks a
> lot.
>
> David

Sometimes when i have this kind of problem, i use the Pic C compiler to
see how it does a multiplication in Assembly!

Miguel.

1997\08\04@092043 by Clyde Smith-Stubbs

flavicon
face
On Mon, Aug 04, 1997 at 10:15:27AM -0700, WF AUTOMAGCO  wrote:

> Sometimes when i have this kind of problem, i use the Pic C compiler to
> see how it does a multiplication in Assembly!

Here's the 16 bit multiply code from our C library. Enjoy.

--
Clyde Smith-Stubbs  |HI-TECH Software,      |Email: spam_OUTclydeTakeThisOuTspamhtsoft.com
Ph:  +61 7 3354 2411|P.O. Box 103, Alderley,|WWW:  http://www.htsoft.com/
Fax: +61 7 3354 2422|QLD, 4051, AUSTRALIA.  |PGP: finger .....clydeKILLspamspam@spam@htsoft.com
---------------------------------------------------------------------------
ANSI C for the PIC! Now shipping! See http://www.htsoft.com for more info.


Attachment converted: wonderland:wmul.as (TEXT/MSIE) (00003756)

1997\08\04@093750 by Bob Fehrenbach

picon face
David BALDWIN <baldwinspamKILLspamETCA.ALCATEL.BE> wrote:
>Has anybody a 16x16 mutilpy code? Thanks a lot. I tried the one from
>Microchip but it doesn't work properly all the time:


David,  try this:


;*******************************************************************
;  Double Precision Multiplication
;
;  n_2 : n_1 * n_4 : n_3    -> q_4:q_3:q_2:q_1
;
;  Standard shift and add.
;  Execution time: 215 to 295 clock cycles.
;  Code space: 22 locations
;
;  Cleaned up and corrected version from Microchip Ap note by BF.
;  Note: Ap note has errors!  Additional mods by Scott Dattalo.
;
;*******************************************************************


mpy16b16: macro
  local   m1, m2
  clrf    q_4
  clrf    q_3
  clrf    q_2
  clrf    q_1
  bsf     q_2, 7
m1:
  rrf     n_2, f
  rrf     n_1, f
  skpc
  goto    m2
  movf    n_3, w
  addwf   q_3, f
  movf    n_4, w
  skpnc
  incfsz  n_4, w
  addwf   q_4, f
m2:
  rrf     q_4, f
  rrf     q_3, f
  rrf     q_2, f
  rrf     q_1, f
  skpc
  goto    m1

  endm


--
Bob Fehrenbach    Wauwatosa, WI     .....bfehrenbKILLspamspam.....execpc.com

1997\08\04@101703 by David BALDWIN

flavicon
face
Thanks for multiply routines, but I had like to have the corrections to
bring ti Mchip one to put it to work. Any idea?

Thanks

David

1997\08\04@202010 by blunn

flavicon
face
Bob Lunn
08/05/97 10:12 AM


> Thanks for multiply routines, but I had like to have
> the corrections to bring ti Mchip one to put it to work.
> Any idea?

    Not an idea (?) but a comment and suggestion.

    Comment.  Why bother?

    Suggestion.  You now have at least a couple of implementations
    of 16x16 multiply.  By studying these known good implementations
    you will quickly understand what is required.  Apply your new
    found knowledge to the task of repairing Mchip's broken code.

___Bob

1997\08\05@025844 by David BALDWIN

flavicon
face
Ok, I fixed the bug. It was in the code I found in a frech book, not in
Mchip app notes. :)

David

More... (looser matching)
- Last day of these posts
- In 1997 , 1998 only
- Today
- New search...