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


Groups > sci.electronics.design > #389974

Re: ARM Cortex M4 filter calculations

From rickman <gnuarm@gmail.com>
Newsgroups sci.electronics.design
Subject Re: ARM Cortex M4 filter calculations
Date 2015-12-17 22:09 -0500
Organization A noiseless patient Spider
Message-ID <n4vt88$j6e$1@dont-email.me> (permalink)
References (2 earlier) <mIqdndKDK_ZvSezLnZ2dnUU7-YXOydjZ@giganews.com> <n4srl7$14l$1@dont-email.me> <8Y6dnQuxLc1Ple7LnZ2dnUVZ5v6dnZ2d@giganews.com> <n4vmvh$lp2$1@dont-email.me> <_o2dnRk6MJoR6e7LnZ2dnUVZ5radnZ2d@giganews.com>

Show all headers | View raw


On 12/17/2015 9:50 PM, Tim Wescott wrote:
> On Thu, 17 Dec 2015 20:22:16 -0500, rickman wrote:
>
>> On 12/17/2015 2:11 PM, Tim Wescott wrote:
>>> On Wed, 16 Dec 2015 18:23:40 -0500, rickman wrote:
>>>
>>>> On 12/16/2015 4:17 PM, Tim Wescott wrote:
>>>>> On Wed, 16 Dec 2015 14:08:46 -0500, rickman wrote:
>>>>>
>>>>>> On 12/16/2015 1:30 PM, Spehro Pefhany wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> Any idea roughly what clock frequency I would be looking at in
>>>>>>> order to have an ARM Cortex M4 do IIR filter calculations? I need
>>>>>>> maybe 3E6 multiple/accumulates per second, so maybe capable of 10E6
>>>>>>> per second with 100% usage.
>>>>>>>
>>>>>>> The M4 core offers a 32 bit multiply/64 bit accumulate in 1
>>>>>>> cycle...
>>>>>>>
>>>>>>> This is to run four decimation filters in parallel. I don't want to
>>>>>>> use an FPGA.
>>>>>>
>>>>> < snip >
>>>>>>
>>>>>> Other than coding up a filter and running it, I can't think of a way
>>>>>> to estimate performance beyond this.
>>>>>
>>>>> That's what I'd do.
>>>>>
>>>>> I recently asked an optimization question on comp.arch.embedded and
>>>>> someone mentioned in passing that to get full performance from the M4
>>>>> hardware you need to use lots of registers, because of pipelining.
>>>>> That was for plain old MAC-ing, not for IIR filters that are going to
>>>>> challenge the optimizer by needing the filter states from step n-1 to
>>>>> calculate the filter states for step n.
>>>>
>>>> I remember that conversation and the guy saying you needed to use CPU
>>>> registers to do pipelining was full of s***.  Pipelining would be
>>>> handled internally to the CPU if needed.  I seem to recall the guy
>>>> refused to look at a TRM for the ARM.
>>>>
>>>>
>>>>> Particularly if your filter is of low order you may find the most joy
>>>>> with (a) hand coding the thing, (b) doing batches of input samples if
>>>>> you can (to avoid lots of context switching), and (c) running more
>>>>> than one filter in parallel (to take advantage of the pipeline).  If
>>>>> you're really lucky the compiler will understand the MAC process and
>>>>> do the optimization for you.
>>>>>
>>>>> I've got several M4 boards laying around, email me if you want me to
>>>>> do some prototyping and measuring for you.
>>>>
>>>> The link I posted listed some good info on the whole thing including
>>>> straight C code, "optimized" C code and hand coded assembly language.
>>>> I believe the IIR filter didn't gain a lot by assembly while the IIR
>>>> filter did, but don't take my word for it.  My memory sucks these
>>>> days.
>>>
>>> I think the first thing I'd do is just code the damned thing up in C
>>> with a gnu compiler, set it up to load into fast RAM (the ST parts, at
>>> least, have a section of RAM that has fast instruction-bus access), and
>>> benchmark.
>>>
>>> Then I'd go from there.
>>
>> Why reinvent the wheel if you can start with the work of others?
>
> IIR filter code seems to benefit greatly from being written for the
> purpose.  And I generally don't trust code that comes from processor
> company apps engineers, having been burned by it before.

Reuse of code is not uncommon.  I have had a lot of practice working 
with other's code.  If you understand what it is doing I am comfortable 
with working with code supplied by a vendor... well, as I said, if I 
understand it.  I remember trying to read Microsoft's idea of a serial 
port interface for Windows 3.1, iirc.  It seemed to be a rather bizarre 
arrangement of back and forth for no apparent reason.  I never tried to 
change any of it.  I think we needed to control the enable for an RS-485 
driver.

But for IIR code, it is simple enough to read and understand, at least 
as a starting point.

-- 

Rick

Back to sci.electronics.design | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

ARM Cortex M4 filter calculations Spehro Pefhany <speffSNIP@interlogDOTyou.knowwhat> - 2015-12-16 13:30 -0500
  Re: ARM Cortex M4 filter calculations Lasse Langwadt Christensen <langwadt@fonz.dk> - 2015-12-16 10:43 -0800
  Re: ARM Cortex M4 filter calculations rickman <gnuarm@gmail.com> - 2015-12-16 14:08 -0500
    Re: ARM Cortex M4 filter calculations Tim Wescott <seemywebsite@myfooter.really> - 2015-12-16 15:17 -0600
      Re: ARM Cortex M4 filter calculations rickman <gnuarm@gmail.com> - 2015-12-16 18:23 -0500
        Re: ARM Cortex M4 filter calculations Tim Wescott <seemywebsite@myfooter.really> - 2015-12-17 13:11 -0600
          Re: ARM Cortex M4 filter calculations rickman <gnuarm@gmail.com> - 2015-12-17 20:22 -0500
            Re: ARM Cortex M4 filter calculations Tim Wescott <tim@seemywebsite.com> - 2015-12-17 20:50 -0600
              Re: ARM Cortex M4 filter calculations rickman <gnuarm@gmail.com> - 2015-12-17 22:09 -0500
  Re: ARM Cortex M4 filter calculations rickman <gnuarm@gmail.com> - 2015-12-16 14:10 -0500
  Re: ARM Cortex M4 filter calculations Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2015-12-16 21:29 +0200
  Re: ARM Cortex M4 filter calculations rickman <gnuarm@gmail.com> - 2015-12-16 14:49 -0500
  Re: ARM Cortex M4 filter calculations krw <krw@nowhere.com> - 2015-12-16 22:06 -0500
    Re: ARM Cortex M4 filter calculations David Brown <david.brown@hesbynett.no> - 2015-12-17 14:07 +0100
      Re: ARM Cortex M4 filter calculations DecadentLinuxUserNumeroUno <DLU1@DecadentLinuxUser.org> - 2015-12-17 08:32 -0500
        Re: ARM Cortex M4 filter calculations DecadentLinuxUserNumeroUno <DLU1@DecadentLinuxUser.org> - 2015-12-17 08:36 -0500
          Re: ARM Cortex M4 filter calculations Lasse Langwadt Christensen <langwadt@fonz.dk> - 2015-12-17 10:08 -0800
      Re: ARM Cortex M4 filter calculations krw <krw@nowhere.com> - 2015-12-17 12:53 -0500
        Re: ARM Cortex M4 filter calculations Spehro Pefhany <speffSNIP@interlogDOTyou.knowwhat> - 2015-12-17 14:15 -0500
  Re: ARM Cortex M4 filter calculations rickman <gnuarm@gmail.com> - 2015-12-17 01:16 -0500

csiph-web