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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/15/05 19:30
Read: times


 
Msg Score: +1
 +2 Informative
 -1 Answer is Wrong
#91695 - Just?
Responding to: ???'s previous message
Prahlad J. Purohit said:
- Max time= 3uS Max. approx. 15 Instruction cycles [ @ 12MHz 2 clock core LPC932A1]
- Internal RAM approx. 400 bytes free. Flash approx. 2k free.
- Resolution accuracy down to 1 bit.

You might just be able to do it with a look up table within these parameters. A 10 bit number squared needs 20 bits for the answer and a 1024 entry table of 20 bit values obviously will not fit into 2K. However, if you look at a hex table of squares you will find the LS hex digit repeats every 8 values i.e is totaly dependent on the LS 3 bits i.e.

0000H ^2 = 0000H
0001H ^2 = 0001H
0002H ^2 = 0004H
0003H ^2 = 0009H
0004H ^2 = 0010H
0005H ^2 = 0019H
0006H ^2 = 0024H
0007H ^2 = 0021H
.................
0008H ^2 = 0040H
0009H ^2 = 0051H
000AH ^2 = 0064H
etc

The LS hex digit sequence 0,1,4,9,0,9,4,1 repeats for the entire table. So, the 16 MS bits of the answer could be held in a 1024 entry (2K byte) table) and the LS hex digit in an 8 byte table.

I have not coded it but it looks like it should be doable in 15 cycles.

Ian



List of 66 messages in thread
TopicAuthorDate
Fast Square.            01/01/70 00:00      
   Square dancing            01/01/70 00:00      
      table lookup???            01/01/70 00:00      
   code & algorithm            01/01/70 00:00      
      16*16 bit is slower than what I want.            01/01/70 00:00      
         How fast?            01/01/70 00:00      
            Re: How Fast            01/01/70 00:00      
               ... probably impossible in 15 cycles            01/01/70 00:00      
                  why cycles ?            01/01/70 00:00      
                     Re: Microseconds            01/01/70 00:00      
                  table lookup            01/01/70 00:00      
   Natsemi appnote or CORDIC            01/01/70 00:00      
      Natsemi link to appnote            01/01/70 00:00      
   (a+b)^2=a^2+2*a*b+b^2            01/01/70 00:00      
      Thats Slow.            01/01/70 00:00      
         faster need hardware            01/01/70 00:00      
         How fast do you need?            01/01/70 00:00      
            Re: How Fast.            01/01/70 00:00      
               Just?            01/01/70 00:00      
                  Incorrect            01/01/70 00:00      
                     Correct?            01/01/70 00:00      
                        Whooooopa... Sorry.            01/01/70 00:00      
                           Thanks            01/01/70 00:00      
                        I tried...            01/01/70 00:00      
                  optimum? table driven            01/01/70 00:00      
      Jan metod            01/01/70 00:00      
   Hardware?            01/01/70 00:00      
      CPLD?            01/01/70 00:00      
   SILabs f12x does it in hardware            01/01/70 00:00      
      Re: SiLabs F12x            01/01/70 00:00      
   Price            01/01/70 00:00      
      F12x price            01/01/70 00:00      
         F12x MAC            01/01/70 00:00      
            provided in the datasheet            01/01/70 00:00      
   Just out of interest            01/01/70 00:00      
      clarification            01/01/70 00:00      
      CPLD?            01/01/70 00:00      
         too expensive            01/01/70 00:00      
            Absolute rubbish Oleg            01/01/70 00:00      
               explain            01/01/70 00:00      
               your right            01/01/70 00:00      
            especially for those...            01/01/70 00:00      
               I need to say this....            01/01/70 00:00      
               By the way.....            01/01/70 00:00      
   just a demo            01/01/70 00:00      
      Hang on.            01/01/70 00:00      
   Oh bollocks            01/01/70 00:00      
   Well oleg            01/01/70 00:00      
      Please check my answer.            01/01/70 00:00      
         Here you go            01/01/70 00:00      
            You're having me on.            01/01/70 00:00      
               Pascal?            01/01/70 00:00      
               Pascal?            01/01/70 00:00      
            Why ?            01/01/70 00:00      
               It was changed because,,,            01/01/70 00:00      
               Its because            01/01/70 00:00      
   For Jez            01/01/70 00:00      
      For Michael            01/01/70 00:00      
   simulation            01/01/70 00:00      
   Re: Fast Square            01/01/70 00:00      
   Prahlad, waithing for a conclusion            01/01/70 00:00      
      just an exercise...            01/01/70 00:00      
      Tricky            01/01/70 00:00      
         Jez asked his cat, I asked my sheep            01/01/70 00:00      
      Conclusion.            01/01/70 00:00      
      SPI EEPROM            01/01/70 00:00      

Back to Subject List