Ha - I woke up in the middle of the night and scrawled something like this out:
fract32 better_mult_sim (fract32 x, fract32 y) {
return ( (long)(x>>12) * (long) (y>>12) ) >> 7;
}
So if your guess is as good as mine then I will try it! What would be really handy would be to figure out how to run some simulator debug comparing bfin math primitives to the mockup byte-for-byte.
Ashamed to say have been flying blind hacking on the bfin and don’t currently know any way to do ‘hello world’ from the bfin, through the avr32 and out through the serial usb device. If I can figure that out then I can get a much better understanding of the fractional math primitives…
Currently using fract32 mult_fr, add_fr & sub_fr for everything, believing I had built up a totally coherent mental model what those guys are doing (and wasn’t running out of cycles). Turns out there are some gaps in my understanding…
Also I read somewhere online that even integer / and % are very expensive on the bfin - does that information sound correct to you? Was previously assuming that the compiler is smart enough to know that, e.g:
x / 256 == x >> 8