Shop OBEX P1 Docs P2 Docs Learn Events
Lookup table in cogmem (propgcc) — Parallax Forums

Lookup table in cogmem (propgcc)

Hello,

I want to use a lookup table, which is situated in the cog memory (to be as fast as possible).
I'm using propgcc and I am not able to declare an array as a _COGMEM.
Is this possible in propgcc? Is it possible at all (with assembler)?

Comments

  • Tracy AllenTracy Allen Posts: 6,656
    edited 2019-10-01 01:37
    A lot depends on what you want to do with the data, but in assembler (psam) it is certainly possible. I can't help with propgcc. The value to read comes from a mov instruction..
    rdval                   mov     value, 0-0
    
    where the 0-0 is a placeholder for the source address. That source address gets put there by a movs instruction somewhere else in the code...
    movs rdval, my9bitSourceAddress
    
    That is, self-modifying code. It might be part of a loop that steps through values of my9bitSourceAddress, or my9bitSourceAddress might come from a command of some sort. Here is a helpful snippet from JonnyMac.
  • Tracy Allen,
    thank you for the reply!
  • RaymanRayman Posts: 13,797
    Just FYI... One way to make it as fast as possible is to start your table at memory location #0 (I.e, the bottom of cog ram).
    It's a bit of a trick, but then you don't need to add in the offset to the table...
  • Rayman, great suggestion, thanks!

    Does anyone knows why we can't do this in propgcc?
  • RaymanRayman Posts: 13,797
    If I remember right, you can write the driver in Spin and then us Spin2GCC to create a binary file that you can load inside GCC...

    Tricks like the one above would probably require doing this...
Sign In or Register to comment.