Shop OBEX P1 Docs P2 Docs Learn Events
P2 PASM getqy timing — Parallax Forums

P2 PASM getqy timing

pic18f2550pic18f2550 Posts: 400
edited 2021-04-30 10:57 in Propeller 2

Hello,
the "getqy" is specified with 2..58 clock cycles.

  1. what must I consider, so that I come on 2 clock cyclen?

  2. what should I avoid to get close to the target?

Comments

  • evanhevanh Posts: 15,911
    edited 2021-03-30 10:19

    Hehe, that's why I showed you that snippet of Chip's Spiral Demo code.

    54 stage pipeline, plus some for the Cordic-op also being a Hub-op.

    You can't reduce the pipeline operation time but the Cog can do other things concurrently to the Cordic while you're waiting for the results. The final result pair, QX and QY, are held indefinitely, so the Cog can collect them much later if desired. Therefore, the 2-clock case is only true when the Cordic results are ready and waiting to be collected.

  • evanhevanh Posts: 15,911

    PS: It gets more complicated when filling the pipeline for higher throughput.

  • Is it possible to nest the individual tasks?

    E.g.

        qdiv outwd, #2
        qdiv outwd, #7
        .....
        getqx t1
        getqx t2
    
  • evanhevanh Posts: 15,911

    Staggered would be a better name. But yes, that's what that snippet is doing - https://forums.parallax.com/discussion/comment/1520964/#Comment_1520964

  • evanhevanh Posts: 15,911
    edited 2021-03-30 12:03

    There is complexity to it though. Per Cog, there is only one pair of result registers for QX and QY. So timing starts to become critically important, or you'll get corruption of results. Which can be very confusing when not aware.

  • Ok, I can see that the from-to clocking is a bit of a tricky issue when it comes to fast processing.
    With complex and variable values it is certainly much better.
    It would be nice if there was a flag indicating that data is ready for collection.
    After all, a lot of clocks come together.
    Maybe in the future there will be the possibility to assign all slots to a COG.
    (arithmetic farmworker)

  • cgraceycgracey Posts: 14,151

    When really packing the CORDIC pipeline, you need to be starting operations and getting results every 8 clocks, or 4 instructions.

  • If I understand correctly, the code should look like this.

        qdiv outwd, #24
        qdiv outwd, #7
        qdiv outwd, #22
        qdiv outwd, #73
        getqx t24
        getqx t7
        getqx t22
        getqx t73
    
  • cgraceycgracey Posts: 14,151

    @pic18f2550 said:
    If I understand correctly, the code should look like this.

        qdiv outwd, #24
        qdiv outwd, #7
        qdiv outwd, #22
        qdiv outwd, #73
        getqx t24
        getqx t7
        getqx t22
        getqx t73
    

    The beginning and end, yes, but in the middle you need to do both.

  • Do you mean that?

        qdiv outwd, #1
        qdiv outwd, #2
        qdiv outwd, #3
        qdiv outwd, #4
        qdiv outwd, #5
        qdiv outwd, #6
        qdiv outwd, #7
        qdiv outwd, #8
        getqx t1
        qdiv outwd, #9
        getqx t2
        qdiv outwd, #10
        getqx t3
        getqx t4
        getqx t5
        getqx t6
        getqx t7
        getqx t8
        getqx t9
        getqx t10
    
  • evanhevanh Posts: 15,911

    Yup.

  • That's nice.
    That opens up a lot of nice possibilities.

Sign In or Register to comment.