On Tue, 10 Nov 2009, Michel Bouissou wrote: > Hi there, > > Well, I've finally converted my PIC16 project to PIC18, and I was taking a > look > at the first SDCC .asm output that accepted to compile OK. > > My attention was drawn by the following SDCC-generated comment in the .asm > file > : > > ; ;multiply lit val:0x02 by variable _resetSource and store in r0x00 > ; ;Unrolled 8 X 8 multiplication > ; ;FIXME: the function does not support result==WREG > > This pops 2 questions in my mind : > > 1/ Is this "FIXME" the sign of anything I should worry about ? ;-) > > 2/ As the PIC18 datasheet says "All PIC18 include an 8x8 hardware multiplier > as part of the ALU [...] Making multiplication a hardware operation allows it > to be completed in a single instruction cycle". > > And this corresponds to the PIC18 "MULLW" and "MULWF" asm instructions. > > Datasheet-provided "performance comparison" chart shows that a 8x8 unsigned > MULT will take 1 CPU cycle and use 1 program memory word using the hardware > multiplier, where it would use 69 (max) CPU cycles and use 13 program memory > words if performed "the software way" in assembly code. > > And the SDCC .asm file when I saw the comment that drew my attention contains > no trace of ever using a MULLW or MULWF, so I assume it performs > multiplications the long, soft way... > > Any light on these 2 questions would be greatly appreciated...
Saw this posting recently which made me think... Especially as I'm doing a lot of floating pint work which would no-doubt be accellerated by the hardware multiply, however I've just had a look at some of the code in my project... Although it has that warning, it is using the MUL instructions. E.G.: ; ;multiply lit val:0x14 by variable _textY and store in r0x05 ; ;Unrolled 8 X 8 multiplication ; ;FIXME: the function does not support result==WREG BANKSEL _textY ; .line 153; oledWrite.c screenY = textY * 20 ; MOVF _textY, W, B MULLW 0x14 MOVFF PRODL, r0x05 MOVFF PRODH, r0x06 Perhaps the version of the compiler I'm using supports it and your version doesn't? I have: sdcc -v SDCC : pic16 2.9.0 #5416 (Oct 21 2009) (UNIX) Gordon ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user