Performing modulus in PASM
escher
Posts: 138
I have a dynamic value, n, that I need to perform modulus on within a cog's PASM code in order to calculate a hub RAM memory offset.
Is there a fast/low instruction count trick to performing this operation? Google and forum searches haven't helped.
Thank you!
Is there a fast/low instruction count trick to performing this operation? Google and forum searches haven't helped.
Thank you!
Comments
As to the "modulus" thing. That is easy or hard depending if your modulus is a power of 2 or not.
Fortunately it was modulus-8, so I was in luck on that front!
I bookmarked the page that Escher linked to at Stanford.edu, bithacks. It reminds me of Hacker's Delight, wherein chapters 9 and 10 cover a lot of the same ground. A great reference.