Shop Learn
SETQ2 with LUT RAM — Parallax Forums

SETQ2 with LUT RAM

I need a quick sanity check. SETQ2 would be used with RDLONG and WRLUT correct? Something like....

     mov       t2, #$200  ' Set the LUT address in t2
     setq2     #10-1      ' get 10 longs from hub to LUT
     rdlong    t1, ptra   ' populate intermediate register with HUB data @ptra
     wrlut     t1, t2     ' write intermediate register data into LUT @t2

Would it increment the intermediate cog register (t2) that is used to shuffle data from HUBram into the LUT?

Am I even close to getting this right?

As always, thanks in advance.

--Terry

Comments

  • evanhevanh Posts: 13,110
    edited 2022-02-15 07:19

    Just the SETQ2+RDLONG is all you need. The SETQ2 completely changes how RDLONG operates.

    What you've got there copies ten longwords from hubRAM (beginning at address ptra) to lutRAM (beginning at address t1). The WRLUT then subsequently places the singular value from t1 into lutRAM at address #200.

  • evanhevanh Posts: 13,110

    There's four types of modal instructions like SETQ. They all have one thing in common - they put a temporary hold on interrupts.

    In no particular order:

    • Firstly, those that that flat modify the next instruction no matter what it is - these are known as prefixing instructions. Eleven of these, all the ALTx's.
    • Secondly, those that fold result data back as operand data for the next instruction. Four of these: XORO32, SCA, SCAS, and GETXACC.
    • Thirdly, those that set a hidden mode bit and/or fill out a special register. These will only have an effect on certain instructions that are built for those conditions. Importantly the mode bit self-resets on the next instruction. Four of these: SETQ, SETQ2, GETCT WC, CRCNIB.
    • And finally, those that retain an operation - only completing on criteria. They have dedicated hidden bits and registers. Three of these: REP and AUGD and AUGS.
  • ke4pjwke4pjw Posts: 648
    edited 2022-02-15 17:23

    @evanh so this should work?

         mov       t1, #$200  ' Set the LUT address in t2
         setq2     #10-1      ' get 10 longs from hub to LUT
         rdlong   ptra, t1   ' populate LUT with HUB data @ptra
    
  • No, you need

         setq2     #10-1
         rdlong   ($200-$200), ptra
    
  • evanhevanh Posts: 13,110
    edited 2022-02-16 03:25

    Yeah, the answer looks odd because the RDLONG assembly syntax is ill-fitting for this. Both operands are addresses but D is immediate direct mode while S is direct indirect mode. You get that when it's a repurposed instruction. ... And then, just to add fun, there's the memory map differences between data space and program space.

  • Uh, now I am really confused. What is the ($200-$200) syntax? Isn't that $00 ? I thought LUT memory started at $0200

    Sorry for being so thick.

  • evanhevanh Posts: 13,110
    edited 2022-02-16 03:25

    Yeah, understandable. Data addressing of lutRAM starts at zero. Only the instruction fetching for program execution maps lutRAM to $200 to $3ff. It's maybe something Chip should've aligned but it wasn't thought much about at the time. EDIT: Acutally, there is a good reason: Direct address values (encoded in the instruction itself) are limited to 9 bits. By keeping the addresses in the 0 to $1ff range the program is more compact and faster running.

  • Got it. One last, and very dumb question. Can LUTs be reserved for symbols? If so, how is it done?

  • evanhevanh Posts: 13,110
    edited 2022-02-16 04:00

    Yes, as program labels. But that means if you use them for a data access (RDLUT/WRLUT) then it's up to you to subtract the $200 appropriately.

  • How would that look? I mean, how would it make it's way into the LUT address space?

  • evanhevanh Posts: 13,110
    edited 2022-02-16 05:15

    Here's a list of addressing modes:

    • Immediate Data - instruction has data value encoded in it.
    • Register Direct - instruction has register number (cogRAM address) that contains the data.
    • Memory Direct - instruction has memory address (hubRAM or lutRAM) of data. Generally not use for HubRAM addressing.
    • Register Indirect Register - instruction has register number which itself contains a register number, ie: The ALTx prefixing instructions. Possibly unique to Propeller architecture.
    • Register Indirect Memory - instruction has register number which contains a memory address (hubRAM or lutRAM). Most hubRAM accesses use this.
  • Wait, I can use a constant to point to a specific LUT address if I wanted to, right?

  • evanhevanh Posts: 13,110
    edited 2022-02-16 04:59

    @ke4pjw said:
    Wait, I can use a constant to point to a specific LUT address if I wanted to, right?

    Yep. When it's S operand it has a preceding #. When it's the special case block copy then no #.

Sign In or Register to comment.