Shop OBEX P1 Docs P2 Docs Learn Events
How program memory is loaded? — Parallax Forums

How program memory is loaded?

inakiinaki Posts: 262
edited 2006-02-26 16:35 in Propeller 1
I am somewhat confused after reading the Early Propeller Chip Documentation.

I understand from the documentation that at a given time a COG can access 512·entries of program memory. Is that right ?
The manual says that when a COG is rebooted it loads its memory registers from the main memory and then starts to run at $000.
The PC is 9 bits register so it is clear that it cannot be anything bigger than 512.

So, I wonder what happens when one wants to execute more than 512 instructions in sequence. Does the COG continue to load more instructions from main RAM ? The contents must be loaded by hand ? What happens to the old contents of program memory?

On the other hand, is it possible to jump or call between addresses that are more than 512 instructions appart ?






▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Comments

  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-02-24 14:19
    You have to remember that when talking about Spin, the program resides in the shared RAM (32K). The cog (512) only holds the spin intepreter. If ASM is used, the interpeter is not loaded or dumped and the machine code is placed directly into a cog.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel

    Disclaimer: ANY Propeller statements made by me are subject to my inaccurate understanding of my limited time with it!
    Southern Illinois University Carbondale -Electronic Systems Technologies
    Personal Links with plenty of BASIC Stamp info
    and SelmaWare Solutions - StampPlot - Graphical Data Acquisition and Control
  • danieldaniel Posts: 231
    edited 2006-02-24 14:31
    inaki said...

    So, I wonder what happens when one wants to execute more than 512 instructions in sequence. Does the COG continue to load more instructions from main RAM ? The contents must be loaded by hand ? What happens to the old contents of program memory?

    On the other hand, is it possible to jump or call between addresses that are more than 512 instructions appart ?
    As I read the prelim doc, it would seem possible, but danger fraught, to do so.

    a. The COG is stated to have all 512 instructions transferred into its memory space whein it is initialized.· Once this initial transfer happens, the prelim docs imply that no further "automatic" transfer takes place.

    b. Specific SharedRAM Content·can be loaded into the COG, one byte/word/longword at a time via HUB instructions.

    c. The destination of that transfer in the COG is overwritten by the new content.

    d. And here is the adventurous part.· The COG could be written to, while it is executing some portion of its already loaded code, could have interleaved HUB instructions to preload the next part of the execution path.· Intended jumps into this not-yet-loaded portion of the routine (and thus, in a global sense·possibly greater than 512 instructions away, but always within the 512 instructions of the COG in a local sense) would have to be "delayed" until it was "loaded".

    I think I'd try real hard to stay within 512 instructions native to the COG.

    Daniel

    ·
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-02-26 16:35
    Daniel,
    Regarding part d.
    -- Are you thinking that you can possibly have half a program in one COG and the other half in a second COG? Then, you try to say ahead of the busy COG by changing in phases.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "When all think alike, no one is thinking very much.' - Walter Lippmann (1889-1974)

    ······································································ Warm regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
Sign In or Register to comment.