Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/08/04 11:30
Read: times


 
#82752 - Rotate in hardware.
Responding to: ???'s previous message
Probably not really applicable here but if you have long numbers to rotate by fixed amount of bits, and you have a lot of spare pins (i.e. memory mapped), rotating bits is one of the most (if not THE most) simple operations.

Rotate 64bit by 3 right:
Input   Output

NC |----o 63
NC |----o 62
NC |----o 61
63 o----o 60 
62 o----o 59 
61 o----o 58 
60 o----o 57 
59 o----o 56 
...
5  o----o 2 
4  o----o 1 
3  o----o 0
2  o---|GND
1  o---|GND
0  o---|GND


...zero gates, near-zero reaction time, just connect output to input.

Sometimes it's the extra effort, but sometimes it makes things much simpler. I.e. note that (x1+x2+...+xn)/n is equivalent to x1/n + x2/n + ... + x3/n so if yo want to average the input from some external device, you may shift the readout signal by "misaligning" it at the input pins, then just add the readouts in MPU instead of first adding and then shifting the results. (of course round-off error increases... there's no such thing as a free lunch.)

Note you can do something very similar in FFT - flipping the byte backwards can be done just the same way.

List of 8 messages in thread
TopicAuthorDate
24bit /8bit long division            01/01/70 00:00      
   24bit /8bit long division            01/01/70 00:00      
      How about rotate left?            01/01/70 00:00      
         multibyte rotate            01/01/70 00:00      
            Compact code            01/01/70 00:00      
               Rotate in hardware.            01/01/70 00:00      
         Yes, that's better            01/01/70 00:00      
            Some other suggestions            01/01/70 00:00      

Back to Subject List