Shop OBEX P1 Docs P2 Docs Learn Events
Question about hubexec code alignment — Parallax Forums

Question about hubexec code alignment

Christof Eb.Christof Eb. Posts: 1,103
edited 2022-12-17 07:40 in Propeller 2

Hi,
sorry that I am asking once again. I could not find an explicit answer. It is said that all hub accesses are byte orientated.

Is it true, that it is not necessary to have code long-alinged for hubexec? Codes can start at any byte?

(((The background is, that Peter in TAQOZ used CALLD PTRA,#address to switch back from assembler code to 16bit wordcode, which is then fetched by rdword x,PTRA++ . For some reason this only works sometimes. Edit: and clearing Z and C does not help.)))

Thank you!
Christof

Comments

  • RossHRossH Posts: 5,345

    @"Christof Eb." said:

    Is it true, that it is not necessary to have code long-alinged for hubexec? Codes can start at any byte?

    This is true. But the timing is affected.

  • Christof Eb.Christof Eb. Posts: 1,103
    edited 2022-12-17 11:55

    Thank you very much!

  • @RossH said:

    @"Christof Eb." said:

    Is it true, that it is not necessary to have code long-alinged for hubexec? Codes can start at any byte?

    This is true. But the timing is affected.

    Misalignment has small effect on timing, minimal really. FIFO reloading and hub word or long accesses take one more cycle but instructions take same time as cog / LUT exec if they don't involve hub RAM.

  • evanhevanh Posts: 15,187

    CALLD is one instruction to be very careful with how it gets used. It relies on those registers for remembering the return address at a later place in time and code. They can be used in neat ways, eg: the interrupt ISRs are called via a wired version of that instruction.

    But write that register in the interim and you've got an imminent crash on your hands. The "switch back from assembler code" will rely on a prior setup of PTRA which cannot be altered by the remainder of the assembly code itself.

  • RaymanRayman Posts: 13,860

    @TonyB_ said:

    Misalignment has small effect on timing, minimal really. FIFO reloading and hub word or long accesses take one more cycle but instructions take same time as cog / LUT exec if they don't involve hub RAM.

    I must have forgotten about that…
    Guess that means FlexProp hubexec code could be slightly slower for loops and jumps if not long aligned. It probably is long aligned though, I’m assuming…

Sign In or Register to comment.