Shop OBEX P1 Docs P2 Docs Learn Events
Which code executes where? — Parallax Forums

Which code executes where?

Guenther DaubachGuenther Daubach Posts: 1,321
edited 2006-03-14 00:05 in Propeller 1
In several other threads there are discussions about locations in the Propeller where program code is executed, read from, where variables usually ares stored, etc. So I think it might be helpful to concentrate the correct answers in one ne (this) thread. As I don't want to give mis-leading answers, I'll only place the questions here, and ask the Propeller Gurus to pleeeeze give us the right answers.

Spin Code

When a Cog is about to execte Spin code, the Spin interpreter is transferred from the Hub's ROM into the Cog's RAM (filling it up almost completely). The interpreter code is then executed by the Cog's processor with the interpreter's internal instructions fetched from the Cog's RAM, and the instructions (or instruction tokens) of the user-defined Spin program are read from the Hub's RAM - Right ???

Variables used in Spin code are located in the Hub's RAM - Right ???


Assembly Code

In order to launch assembly code, a minimum of Spin code is required. This would mean that a copy of the Spin interpreter code is first transferred from the Hub's ROM into the Cog's RAM. As above, the interpreter's internal instructions are fetched from the Cog's RAM, and the Spin instructions (tokens) which then performs the required actions to launch the assembly code are fetched from the Hub's RAM. Does this mean that the interpreter code in the Cog's RAM is replaced by the assembly instruction code which then is run from the Cog's RAM stand-alone, i.e. all assembly instructions are fetched from there ???

Assembly programs may define and access variables in the Cog's RAM as well as in the Hub's RAM - right ???

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,

G

Comments

  • cgraceycgracey Posts: 14,206
    edited 2006-03-13 21:29
    Guenther Daubach said...
    In several other threads there are discussions about locations in the Propeller where program code is executed, read from, where variables usually ares stored, etc. So I think it might be helpful to concentrate the correct answers in one ne (this) thread. As I don't want to give mis-leading answers, I'll only place the questions here, and ask the Propeller Gurus to pleeeeze give us the right answers.

    Spin Code

    When a Cog is about to execte Spin code, the Spin interpreter is transferred from the Hub's ROM into the Cog's RAM (filling it up almost completely). The interpreter code is then executed by the Cog's processor with the interpreter's internal instructions fetched from the Cog's RAM, and the instructions (or instruction tokens) of the user-defined Spin program are read from the Hub's RAM - Right ???

    RIGHT.

    Variables used in Spin code are located in the Hub's RAM - Right ???


    RIGHT.

    Assembly Code

    In order to launch assembly code, a minimum of Spin code is required. This would mean that a copy of the Spin interpreter code is first transferred from the Hub's ROM into the Cog's RAM. As above, the interpreter's internal instructions are fetched from the Cog's RAM, and the Spin instructions (tokens) which then performs the required actions to launch the assembly code are fetched from the Hub's RAM. Does this mean that the interpreter code in the Cog's RAM is replaced by the assembly instruction code which then is run from the Cog's RAM stand-alone, i.e. all assembly instructions are fetched from there ???

    On boot-up,·the Spin·interpreter gets launched into COG #0. You may have only a one-line Spin program which immediately (re)launches (COG0 or) another COG with some assembly language program. Thereafter, you could run assembly language only in all COGs. This is not a very practical thing to do, though, because you'd lose the benefit of Spin's easy connectability to objects and its interpreter launching. Once there is no more Spin code running, you cannot launch any more Spin programs, because your 'connector' is broken. (Okay, technically, it IS possible to relaunch an interpreter, but you'd be doing so outside of the compile-time setup and you'd have to figure out HOW. There should never be a reason to do this, unless you made your own interpreter.)

    Assembly programs may define and access variables in the Cog's RAM as well as in the Hub's RAM - right ???

    RIGHT.
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-03-14 00:05
    Folks -

    I'm not sure why this is happening, but there is a MAJOR problem with the email output presently being generated from this Propeller Forum. I've not seen it in other sections which I monitor, although it may be happening there as well. OMISSIONS from the email ouput are often difficult, if not impossible, to detect. The prior post (reply by Chip to Guenther) is an EXCELLENT example.

    Everything from Chip's last answer above, which begins with:

    "On boot-up, the Spin interpreter gets launched into COG #0." .....

    And ends with:

    ..... There should never be a reason to do this, unless you made your own interpreter.)"

    is ENTIRELY MISSING from the email output. The text in question seems to be formatted (as opposed to pure ASCII plain-text) in some manner, but I can't detect how, or with what. This is exclusive of the BLUE coloration. The other parts of the reply appear to be okay. Rather odd!

    [noparse][[/noparse]talking to myself] I'm now wondering if I should go back to the various messages from this forum which I didn't understand when I read them in email. I'll bet there was missing text there too <sigh>.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->

    Post Edited (Bruce Bates) : 3/14/2006 12:57:19 AM GMT
Sign In or Register to comment.