Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #54820

Re: embedded forth

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From rickman <gnuarm@gmail.com>
Newsgroups comp.lang.forth
Subject Re: embedded forth
Date Sun, 12 Feb 2017 19:37:12 -0500
Organization A noiseless patient Spider
Lines 88
Message-ID <o7qv0f$oo0$1@dont-email.me> (permalink)
References <49b3566a-3842-4f9f-a47f-a66590625fef@googlegroups.com> <92d07db1-18b7-410e-a77c-d7ab4f6606d8@googlegroups.com> <87lgtu20wb.fsf@nightsong.com> <6415800d-9ed0-4eef-afcf-6291de9a1ef3@googlegroups.com> <o6lcft$em9$1@cherry.spenarnc.xs4all.nl> <e90a34e0-376e-4910-bd6a-96d8f16bf0bf@googlegroups.com> <o6mla6$f0l$1@dont-email.me> <e8b3a38a-d6b7-41b3-a760-fe07881bdf17@googlegroups.com> <o7ovau$66h$1@dont-email.me> <78a6cb97-3479-42ea-ade2-03c22b4d69d4@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
Injection-Date Mon, 13 Feb 2017 00:35:27 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="aa8b9ac927b6be8ad54db2c77eabed3e"; logging-data="25344"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+0+3xbTJ7oL5WvKgazTn6F"
User-Agent Mozilla/5.0 (Windows NT 6.2; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1
In-Reply-To <78a6cb97-3479-42ea-ade2-03c22b4d69d4@googlegroups.com>
Cancel-Lock sha1:zJxLII6CbFynbTVU0ldwX5P5zzI=
Xref csiph.com comp.lang.forth:54820

Show key headers only | View raw


On 2/12/2017 1:21 PM, Ilya Tarasov wrote:
>> I did a little digging and found why there seemed to be something
>> about CORDIC that didn't quite sit.  The algorithm for CORDIC
>> iterates calculations on the sine and cosine of an angle by
>> rotating the vector, adding and subtracting from the angle until
>> the angle is zero... or approximately zero.  The way the math
>> works, the sine and cosine will always be *exact*, that is true.
>> But it will just be for the wrong angle!
>
> I don't think 'wrong' is applicable here. Every kind of iterative
> approaching algorithms has a built-in error, which decreased by every
> iteration. The real power of iterarive approach is an ability to
> decrease this error.

The point is that the answer is not an exact answer to the question 
because while the calculation of the answer *is* exact, it is answering 
the wrong question even if only by a small amount.

So in the end the CORDIC is no more exact than other methods and is ill 
suited in most cases because of the large resource usage.


>> Yep, the angle is adjusted by adding and subtracting table values
>> until it is close to zero.  But each table value has a built in
>> error of up to ±0.5 lsbs.  For a 32 bit value there will be at
>> least 32 iterations which means the errors can combine to as much
>> as ±16 counts in the lsb of the phase angle.  This is on top of the
>> potential ±1 lsb due to the angle not resolving fully.  This has a
>> quirk where in the next to last iteration the angle can have
>> resolved perfectly and the final step throws it off by 1.
>>
>> Of course the rounding errors are likely uncorrelated so the
>> typical error will be 0.5*sqrt(32) or around 2.8 plus the
>> resolution error.  The analysis I've done with the trig approach
>> indicates maximum errors in the range of ±1.5 lsbs and a lower
>> typical and average.
>>
>> Is this wrong?
>
> This number looks real anough. Of course, performing math operations
> with numbers with errors will lead to error propagation, and more
> iterations means more error. Every approach has its own range of
> optimal characteristics by time, area, memory size etc. If you reach
> 1.5 LSBS tolerance, but need more, you can add two iterations and
> that 1.5 LSBS will related to 34 bits, not 32.

Of course, any method can be done in extended precision and the result 
rounded.


>> BTW, the small b "approximation" is not a source of significant
>> error. This simply determines where you divide the angle into the
>> (a) bits and (b) bits.  Choose (a) to be large enough and cos(b) is
>> as close to 1 as you like.
>
> In average, approaches sequence usually looks like 'tables ->
> approximation/series -> iterations'. Table size typically growing by
> 2^N law (with some tricks maybe), approximation typically has a kind
> of saturation (can you provide 64 bits?).

I don't need 64 bits <grin>.  I still haven't heard the use case for 32 
bits.  Why do you need 32 bits of accuracy?  BTW, a 32 bit address 
lookup table is not really a bit issue.  That is just 4 giga-entries. 
Or it can be broken down to a pair of tables using the same trig 
algorithm but this time with a full two multiplies as the cos(b)=b 
identity won't be true.  Still, that's a total of three multiplies which 
is the same complexity as the CORDIC.  The difference is it doesn't 
implement it all using FPGA fabric.

Don't think that CORDIC doesn't have issues with word size.  It is order 
N^2 complexity.  So a 64 bit calculation would be rather huge in an FPGA 
using some 14,000 LUTs if I recall your earlier numbers correctly. 
That's actually more than four times larger than the FPGA I am 
generating sines from to do testing on interface boards.


> More important another question you still didn't answer. For 32-bit
> angle and 32-bit datawidth, what is more important to keep at their
> level? Here we have time and (typically) voltage from ADC - that
> value has better precision?

Sorry, I don't understand the question.  "Their level" and "that value 
has better precision" don't make sense to me.  Who is "they" and what is 
"that"?

-- 

Rick C

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

embedded forth Dale Scott <dalescottnet@gmail.com> - 2017-01-21 11:27 -0800
  Re: embedded forth Paul Rubin <no.email@nospam.invalid> - 2017-01-21 11:31 -0800
  Re: embedded forth stephen@mpeforth.com - 2017-01-22 00:52 -0800
  Re: embedded forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-22 17:09 +0000
    Re: embedded Forth Dale Scott <dalescottnet@gmail.com> - 2017-01-22 09:43 -0800
      Re: embedded Forth stephen@mpeforth.com - 2017-01-22 12:19 -0800
      Re: embedded Forth albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-22 21:25 +0100
      Re: embedded Forth john <anon@example.com> - 2017-01-22 21:04 +0000
        Re: embedded Forth "Elizabeth D. Rather" <erather@forth.com> - 2017-01-22 12:30 -1000
        Re: embedded Forth hughaguilar96@gmail.com - 2017-01-22 20:45 -0800
      Re: embedded Forth stephen@mpeforth.com - 2017-01-22 14:08 -0800
        Re: embedded Forth Paul Rubin <no.email@nospam.invalid> - 2017-01-22 14:55 -0800
          Re: embedded Forth Dale Scott <dalescottnet@gmail.com> - 2017-01-22 20:41 -0800
            Re: embedded Forth Paul Rubin <no.email@nospam.invalid> - 2017-01-22 21:19 -0800
      Re: embedded Forth hughaguilar96@gmail.com - 2017-01-22 21:36 -0800
        Re: embedded Forth Dale Scott <dalescottnet@gmail.com> - 2017-01-22 22:09 -0800
          Re: embedded Forth rickman <gnuarm@gmail.com> - 2017-01-23 04:15 -0500
            Re: embedded Forth Dale Scott <dalescottnet@gmail.com> - 2017-01-23 08:41 -0800
              Re: embedded Forth rickman <gnuarm@gmail.com> - 2017-01-23 14:32 -0500
                Re: embedded Forth Dale Scott <dalescottnet@gmail.com> - 2017-01-23 11:53 -0800
                Re: embedded Forth rickman <gnuarm@gmail.com> - 2017-01-23 15:10 -0500
              Re: embedded Forth Paul Rubin <no.email@nospam.invalid> - 2017-01-23 14:34 -0800
                Re: embedded Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-24 03:14 -0600
        Re: embedded Forth rickman <gnuarm@gmail.com> - 2017-01-23 03:43 -0500
          Re: embedded Forth john <anon@example.com> - 2017-01-23 10:32 +0000
          keep secrets (was Re: embedded Forth) "Wolfgang Allinger" <all2001@spambog.com> - 2017-01-23 08:58 -0300
            Re: keep secrets (was Re: embedded Forth) Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2017-01-23 07:47 -0500
              Re: keep secrets (was Re: embedded Forth) "Wolfgang Allinger" <all2001@spambog.com> - 2017-01-23 18:18 -0300
                Re: keep secrets (was Re: embedded Forth) rickman <gnuarm@gmail.com> - 2017-01-23 19:15 -0500
            Re: keep secrets (was Re: embedded Forth) rickman <gnuarm@gmail.com> - 2017-01-23 14:38 -0500
              Re: keep secrets (was Re: embedded Forth) "Wolfgang Allinger" <all2001@spambog.com> - 2017-01-23 18:43 -0300
                Re: keep secrets (was Re: embedded Forth) rickman <gnuarm@gmail.com> - 2017-01-23 19:48 -0500
                Re: keep secrets (was Re: embedded Forth) "Elizabeth D. Rather" <erather@forth.com> - 2017-01-23 16:30 -1000
                Re: keep secrets (was Re: embedded Forth) rickman <gnuarm@gmail.com> - 2017-01-23 22:23 -0500
  Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-22 13:44 -0500
    Re: embedded forth Paul Rubin <no.email@nospam.invalid> - 2017-01-22 13:38 -0800
      Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-23 00:45 -0500
        Re: embedded forth Dale Scott <dalescottnet@gmail.com> - 2017-01-22 22:44 -0800
          Re: embedded forth Paul Rubin <no.email@nospam.invalid> - 2017-01-23 00:48 -0800
          Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-23 03:51 -0500
      Re: embedded forth john <anon@example.com> - 2017-01-23 10:02 +0000
    Re: embedded forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-23 09:01 +0000
      Re: embedded forth albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-23 13:05 +0100
        Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-23 14:40 -0500
          Re: embedded forth Mark Wills <markwills1970@gmail.com> - 2017-01-24 01:12 -0800
          Re: embedded forth albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-24 14:38 +0100
            Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-24 19:51 -0500
              Re: embedded forth albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-25 11:34 +0100
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-25 22:13 -0500
                Re: embedded forth albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-26 11:36 +0100
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-26 14:07 -0500
              Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-01-26 00:19 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-26 14:15 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-01-27 13:08 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-27 17:54 -0500
                Re: embedded forth Paul Rubin <no.email@nospam.invalid> - 2017-01-27 15:29 -0800
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-01-27 16:28 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-27 23:58 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-01-28 11:58 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-28 15:36 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-01-28 15:05 -0800
                Re: embedded forth Paul Rubin <no.email@nospam.invalid> - 2017-01-28 15:57 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-28 21:51 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-01-29 09:53 -0800
                Re: embedded forth albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-29 19:32 +0100
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-01-29 11:53 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-30 01:10 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-01-29 23:11 -0800
                Re: embedded forth Paul Rubin <no.email@nospam.invalid> - 2017-01-29 23:34 -0800
                Re: embedded forth albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-30 12:42 +0100
                Re: embedded forth albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-30 12:36 +0100
                Re: embedded forth ctmalan@gmail.com - 2017-01-30 11:02 -0800
                Re: embedded forth Paul Rubin <no.email@nospam.invalid> - 2017-01-30 11:04 -0800
                Re: embedded forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-31 04:34 -0600
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-01-30 12:15 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-30 10:15 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-01-30 12:20 -0800
                Re: embedded forth Paul Rubin <no.email@nospam.invalid> - 2017-01-30 14:09 -0800
                Re: embedded forth albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-31 03:04 +0100
                Re: embedded forth Paul Rubin <no.email@nospam.invalid> - 2017-01-30 20:19 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-30 17:10 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-01-30 14:38 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-30 23:09 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-01-31 09:32 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-02-08 18:22 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-02-09 01:46 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-02-09 05:11 -0500
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-02-12 01:30 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-02-12 10:21 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-02-12 19:37 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-02-14 13:26 -0800
                Re: embedded forth Gary Bergstrom <forthprgrmr@gmail.com> - 2017-02-14 11:36 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-02-14 18:13 -0500
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-28 21:51 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-01-29 10:20 -0800
                Re: embedded forth Cecil Bayona <cbayona@cbayona.com> - 2017-01-29 12:38 -0600
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-01-29 11:49 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-02-04 04:22 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-02-04 17:54 -0800
                Re: embedded forth hughaguilar96@gmail.com - 2017-02-04 20:26 -0800
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-02-05 07:53 -0800
                Re: embedded forth hughaguilar96@gmail.com - 2017-02-05 11:08 -0800
                Re: embedded forth hughaguilar96@gmail.com - 2017-02-05 11:39 -0800
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-02-08 06:46 -0800
                Re: embedded forth luser droog <mijoryx@yahoo.com> - 2017-02-13 19:17 -0800
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-02-15 06:23 -0800
                Re: embedded forth hughaguilar96@gmail.com - 2017-02-15 11:09 -0800
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-02-15 15:24 -0800
                Re: embedded forth jkn_gg@nicorp.f9.co.uk - 2017-02-16 09:49 -0800
                Re: embedded forth hughaguilar96@gmail.com - 2017-02-17 09:12 -0800
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-02-17 12:47 -0800
                Re: embedded forth hughaguilar96@gmail.com - 2017-02-17 16:18 -0800
                Re: embedded forth luser droog <mijoryx@yahoo.com> - 2017-02-16 08:43 -0800
                Re: embedded forth Alex <alex@rivadpm.com> - 2017-02-05 20:47 +0000
                Re: embedded forth hughaguilar96@gmail.com - 2017-02-05 13:36 -0800
                Re: embedded forth Alex <alex@rivadpm.com> - 2017-02-05 23:18 +0000
                Re: embedded forth hughaguilar96@gmail.com - 2017-02-05 21:10 -0800
                Re: embedded forth Alex <alex@rivadpm.com> - 2017-02-06 11:12 +0000
                Re: embedded forth hughaguilar96@gmail.com - 2017-02-05 21:15 -0800
                Re: embedded forth hughaguilar96@gmail.com - 2017-02-05 22:45 -0800
                Re: embedded forth albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-02-06 12:04 +0100
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-02-08 03:08 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-02-08 06:39 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-02-08 07:15 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-02-08 15:49 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-02-09 01:14 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-02-09 05:19 -0500
                Re: embedded forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-02-09 03:48 -0800
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-02-05 16:08 -0500
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-02-07 21:59 -0500
                Re: embedded forth albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-28 11:10 +0100
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-28 06:15 -0500
                Re: embedded forth albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-28 19:48 +0100
                Re: embedded forth rickman <gnuarm@gmail.com> - 2017-01-28 14:37 -0500
                Re: embedded forth mhx@iae.nl - 2017-01-28 07:48 -0800
                Re: embedded forth albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-28 19:53 +0100
                Re: embedded forth mhx@iae.nl - 2017-01-28 15:49 -0800
        Re: embedded forth "Wolfgang Allinger" <all2001@spambog.com> - 2017-01-23 18:46 -0300

csiph-web