View Single Post
  #77   Report Post  
Posted to sci.electronics.design,alt.binaries.schematics.electronic,sci.electronics.basics
Jasen Betts[_2_] Jasen Betts[_2_] is offline
external usenet poster
 
Posts: 331
Default "Random" Circuit Needed.

On 2015-04-18, rickman wrote:
On 4/18/2015 6:30 AM, Jasen Betts wrote:
On 2015-04-18, rickman wrote:
On 4/17/2015 10:56 PM, Jasen Betts wrote:
On 2015-04-17, rickman wrote:
On 4/17/2015 7:51 AM, Jasen Betts wrote:

one 16 bit - 7 bit subtract
one 16 bit + 0 bit add with carry.

I'm not following. Are you saying a modulo 65537 operation can be done
with two adders?

yes.


I appreciate the effort in the drawing, but that isn't needed. Knowing
that you use adders doesn't help me understand how the arithmetic works.
Is there a simple explanation? BTW, what do you do with bit 16 on the
input? Is that a typo? Does it go with the lsbs or the msbs?


It's a typo (or a fence-post error).

this is the arithmetic in c:

// a=a % 65537 in c:

a = a & 0xffff - ( a & ~ 0xffff ) 16;
a = a0 ? a & 0xffff + 1 : a ;


I don't need an algebraic formula to understand the logic. I am asking
how this is equivalent to mod 65537. But running through a couple of
examples I think I understand. It does a division by 65536 and adjusts
the remainder with the quotient and an additional adjustment if the
result is negative. Interesting and fairly efficient. Where did you
learn about this?


I discovered it when I was ih highschool, it's not that different to
the trick to compute y=x%11 in base 10 only it's done in base 65536
and only does two digits.

--
umop apisdn