Shop OBEX P1 Docs P2 Docs Learn Events
Efficiently processing continuous signals? - Page 2 — Parallax Forums

Efficiently processing continuous signals?

2»

Comments

  • evanhevanh Posts: 17,060
    edited 2026-02-05 09:07

    @"Christof Eb." said:
    Hi,
    perhaps this is again my not-knowing...
    As far as I know, you can only use the streamer for data movement, if your code is executing from cog or lut memory. I don't think, that inline asm is loaded into cog memory?

    Streamer and Fifo aren't entirely the same thing. The RDFAST instruction starts up the Fifo independent of the Streamer. It allows other Cog instructions like RFLONG access to the Fifo's FIFO.

    Inline assembly is by default loaded into cogRAM just before it is executed. So not entirely inline as such. This is quite important when wanting to use the Fifo within the "inline" Pasm2 code. The Spin2 interpreter uses the Fifo itself. And Flexspin executes natively as hubexec which also requires the Fifo.

  • bob_g4bbybob_g4bby Posts: 534
    edited 2026-02-05 10:44

    The "counter := @BHwindow" worked, @evanh , thank you. Attached is a test program to be run in debug mode for the scope displays - a blackman harris window is applied to a sine wave. The window is applied to a polar signal, as being easier to do when preloading the cordic engine. My attempt to do it on a cartesian signal didn't produce the correct result - I was not getting all the correct values out of the cordic, due to twice the number of multiplies, the 8 cycle pattern was broken. I may return to that - I expect it needs pacing to 16 cycles.

    @"Christof Eb." , my inline assembly methods use the "org ... end" form which means the code will be loaded into cog ram before execution. Had I used " orgh ... end", then the code would execute from hub ram. (See "In-line PASM Code" section of the Spin2 manual) In the changes section it also states:-

    PUB/PRI methods now support ORGH (hub) inline PASM code, in addition to ORG (cog) inline PASM code.
    ○ Like ORG, ORGH loads the first 16 local long variables from hub RAM into cog registers, executes
    the inline code, and then updates the registers back to hub RAM.
    ○ Unlike ORG inline code, ORGH inline code does not load code into cog registers $000..$11F, but can
    be up to $FFFF instructions long, since it stays and executes in hub RAM.
    ○ ORGH allows inline PASM code without interfering with the $000..$11F cog register space, So, those
    cog registers can be used entirely for stay-resident code, like interrupt service routines or frequentlycalled fast PASM routines.

    As you can see in the window demo here, both the "sine" and the "polwin" method in the dsp library use the FIFO successfully

  • evanhevanh Posts: 17,060
    edited 2026-02-05 11:07

    @bob_g4bby said:
    The "counter := @BHwindow" worked, @evanh , thank you.

    LOL, I failed Spin's := syntax too. I get that wrong every time I start a new Spin project. First compile has me fixing them.

  • @evanh said:

    Streamer and Fifo aren't entirely the same thing. The RDFAST instruction starts up the Fifo independent of the Streamer. It allows other Cog instructions like RFLONG access to the Fifo's FIFO.

    Does this mean, that when DDS from LUT to DAC is used, the STREAMER is used but not the FIFO and therefore code can in parallel be executed from HUB?

    Inline assembly is by default loaded into cogRAM just before it is executed. So not entirely inline as such. This is quite important when wanting to use the Fifo within the "inline" Pasm2 code. The Spin2 interpreter uses the Fifo itself. And Flexspin executes natively as hubexec which also requires the Fifo.

    OK, sorry, I was not aware, that SPIN2 loads inline asm into cog ram.

  • evanhevanh Posts: 17,060

    @"Christof Eb." said:
    Does this mean, that when DDS from LUT to DAC is used, the STREAMER is used but not the FIFO and therefore code can in parallel be executed from HUB?

    Yep.

Sign In or Register to comment.