Shop OBEX P1 Docs P2 Docs Learn Events
Propeller II programing questions to Chip - Page 3 — Parallax Forums

Propeller II programing questions to Chip

13567

Comments

  • Bill HenningBill Henning Posts: 6,445
    edited 2012-12-28 09:25
    Sorry to hear that - I hope you get well quickly, and have a great Xmas next year (at home)!
    Sapieha wrote: »
    Re All.


    What new?.
    S.O:S ambulance screw up theirs work --- So my XMAS was in Hospital
  • potatoheadpotatohead Posts: 10,261
    edited 2012-12-28 09:42
    Yes, get well quickly. What an unfortunate thing to happen.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-28 09:56
    Hi potatohead.

    Life.
    Both S.O.S and hospital this time screw up things So I'm not so good it need be before them send me home

    And hospital non't fix what them need
    life --- If people don't talk to others -- Only make assumptions. And at least don't listen to me that them made problems instead of made me better



    potatohead wrote: »
    Yes, get well quickly. What an unfortunate thing to happen.
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-12-28 14:22
    Sorry to hear this Sapieha. Hope you get well soon.
    I know this is the worst time of year for you.
  • David BetzDavid Betz Posts: 14,516
    edited 2012-12-28 18:55
    I'm in the middle of adding P2 instructions to the GNU assembler and I've gotten to the handling of INDA and INDB and their addressing modes. Can I assume that the special INDA and INDB modes can be used in any instruction that has a SSSSSSSSS and/or DDDDDDDDD field and also has a CCCC field?
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-12-28 20:40
    David: That is my understanding. The CCCC field is then re-purposed to mean the various inc/dec modes.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-29 11:20
    Hi Chip.

    What happens on that part.

    As You can see from this link WE need it.

    http://forums.parallax.com/showthread.php?144384-p2load-A-Loader-for-the-Propeller-II&p=1153948&viewfull=1#post1153948



    cgracey wrote: »
    Yes, I will do this probably in the next week, or so. I want to make the compiler map go from $00E80 to $1FFFF, and then make a loader to transfer it all in. The
    assembler needs to be augmented so that hub addresses can be declared. This way, you could build the whole hub RAM image and load it.
  • David BetzDavid Betz Posts: 14,516
    edited 2012-12-29 11:45
    Sapieha wrote: »
    While it will be nice when PNut.exe can load all of hub memory, there is already a way to do that using p2load.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-29 11:52
    Hi David.

    I respect Yours work on p2load.

    But my question to Chip are on Building BIG objects files that PNut have ORGHUB to control of placement of binary parts in HUB.

    David Betz wrote: »
    While it will be nice when PNut.exe can load all of hub memory, there is already a way to do that using p2load.
  • David BetzDavid Betz Posts: 14,516
    edited 2012-12-29 12:05
    Sapieha wrote: »
    Hi David.

    I respect Yours work on p2load.

    But my question to Chip are on Building BIG objects files that PNut have ORGHUB to control of placement of binary parts in HUB.
    When I ported pfth to the P2 I handled the hub addressing using this hack:
    dat
                            byte    0[$0e80]
    

    This caused all of my code to be loaded starting at $0e80 rather than hub address zero. I then added a -s option to p2load to skip over the first $0e80 bytes before starting to load. This allows me to assemble code with the correct hub addresses up to 32k bytes on the DE0-Nano or the full 128k bytes on the DE2-115.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-29 12:12
    Hi David.

    I can all side ways.

    BUT why I need that --- If correct written --- PNut can handle that for me.

    Why I need use manually patches --- If Computers are so more usable to TRIM that with simple directives.

    David Betz wrote: »
    When I ported pfth to the P2 I handled the hub addressing using this hack:
    dat
                            byte    0[$0e80]
    

    This caused all of my code to be loaded starting at $0e80 rather than hub address zero. I then added a -s option to p2load to skip over the first $0e80 bytes before starting to load. This allows me to assemble code with the correct hub addresses up to 32k bytes on the DE0-Nano or the full 128k bytes on the DE2-115.
  • David BetzDavid Betz Posts: 14,516
    edited 2012-12-29 12:13
    Sapieha wrote: »
    Hi David.

    I can all side ways.

    BUT why I need that --- If correct written --- PNut can handle that for me.

    Why I need use manually patches --- If Computers are so more usable to TRIM that with simple directives.
    Just a suggestion to help you make progress while you wait for an update to PNut.exe. If I had waited for HUBORG I would have lost weeks of development time.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-29 12:26
    Hi David.

    Thanks.

    BUT think that I program in assembler on different CPU's from 1976 ---- Do You think I still don't ?



    David Betz wrote: »
    Just a suggestion to help you make progress while you wait for an update to PNut.exe. If I had waited for HUBORG I would have lost weeks of development time.
  • David BetzDavid Betz Posts: 14,516
    edited 2012-12-29 12:40
    Sapieha wrote: »
    Hi David.

    Thanks.

    BUT think that I program in assembler on different CPU's from 1976 ---- Do You think I still don't ?
    I'm sorry I tried to help. I'm actually very tired of your critical comments to people (maybe just me) who try to offer you help.
  • jmgjmg Posts: 15,173
    edited 2012-12-29 12:56
    David Betz wrote: »
    I'm sorry I tried to help. I'm actually very tired of your critical comments to people (maybe just me) who try to offer you help.

    Do not forget the language boundary that is crossed here... that can make comments seem more terse than meant.
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-12-29 13:05
    pnut.exe is only a temporary program until a fully open P2 compiler is complete. Therefore we have to work around some deficencies. Otherwise we will have all the tools and no P2 to run them on.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-29 13:19
    Hi Cluso.

    You are correct.

    But with PNut we made standards -- We need live with after that.
    For me PNut can be only compiler that we have If it can compile to usable OBJECT files.
    What type of Tools Parallax made for P2 -- It still need some functions to simplify programming.
    Else it will be that we have now on P1 --- No any possibility to control in Tools. For advanced programming I need compile every BLOB separate and then make my own object file.

    I think it is not correct way ---- Not acceptable for Industry to.

    Cluso99 wrote: »
    pnut.exe is only a temporary program until a fully open P2 compiler is complete. Therefore we have to work around some deficencies. Otherwise we will have all the tools and no P2 to run them on.
  • David BetzDavid Betz Posts: 14,516
    edited 2012-12-29 13:26
    I'm still uncertain as to how the REPD instruction is handled in the assembler. I know Chip said that a repeat count of 7 will do the loop 8 times. At one point PNut.exe would subtract one from immediate values before encoding them into the instruction so that #8 would repeat 8 times not 9. Is that still the case? I think it would be better if #7 actually encoded 7 into the instruction so that the behavior of immediates matches that of register arguments where no automatic "subtract one" is possible. Was this changed or does PNut.exe still encode 7 for an argument of #8?
  • jmgjmg Posts: 15,173
    edited 2012-12-29 14:50
    David Betz wrote: »
    I'm still uncertain as to how the REPD instruction is handled in the assembler. I know Chip said that a repeat count of 7 will do the loop 8 times. At one point PNut.exe would subtract one from immediate values before encoding them into the instruction so that #8 would repeat 8 times not 9. Is that still the case? I think it would be better if #7 actually encoded 7 into the instruction so that the behavior of immediates matches that of register arguments where no automatic "subtract one" is possible. Was this changed or does PNut.exe still encode 7 for an argument of #8?

    Clarity of source code should always win, so a line that reads #8 but actually did 9 loops in HW, is not a good idea.

    If the opcode has different modes, then it is better to split to two opcodes, to keep clarity.
    The binary output is the same in all cases.

    eg REPDi #N ; Immediate param Tells silicon to repeat N times. ie What you wrote is exactly what happens

    and
    REPDvRp1 RegName ; Silicon repeats (Value in Register)+1 times - hence the vRp1 opcode name and hint.
  • David BetzDavid Betz Posts: 14,516
    edited 2012-12-29 15:08
    jmg wrote: »
    Clarity of source code should always win, so a line that reads #8 but actually did 9 loops in HW, is not a good idea.
    I think the idea is that the REPD instruction takes effect at the end of the loop to decide if the loop should be repeated. So, REPD #1 would repeat the loop once after executing it the first time and REPD #0 would not repeat it at all but would still execute it the first time. It's a little obscure though I admit.
  • jmgjmg Posts: 15,173
    edited 2012-12-29 16:40
    This looks like a good place where some ASM smarts are needed.
    Users should not have to opcode count.in 2012+
            REPSb #20_000     ' execute block of (here 4) instructions 20,000 times
    '          NOP '1 spacer instruction needed - REPSb / REPDb auto-inserts spacer(s)  as needed, if not included
    :_RepeatStart        
            NOTP #0 'toggle P0
            NOTP #1 'toggle P1
            NOTP #2 'toggle P2
            NOTP #3 'toggle P3, block repeats every 4 clocks
    :_RepeatEnd
    

    Here the REPSb opcode, is just a little smarter, it does the following housekeeping

    * checks :_RepeatStart is == +1 spacer, and if not, adds one NOP, warns if > 1 (use 3 for REPDb)
    * uses reserved forward local labels :_RepeatStart :_RepeatEnd to define the block size
    I think REPx cannot be nested, so labels have a simple lifetime until next REPx

    A macro assembler could probably manage via this ?
    REPSb #20_000,_RepeatStart,_RepeatEnd
  • potatoheadpotatohead Posts: 10,261
    edited 2012-12-29 17:19
    Honestly the instruction makes perfect sense to me. Repeat means it has happened once, or it would not be repeated. Executing x number of times is a different thing.
  • David BetzDavid Betz Posts: 14,516
    edited 2012-12-29 17:28
    potatohead wrote: »
    Honestly the instruction makes perfect sense to me. Repeat means it has happened once, or it would not be repeated. Executing x number of times is a different thing.
    Either interpretation of the count is okay with me. I just don't like that the register form would work differently than the immediate form.
  • AribaAriba Posts: 2,690
    edited 2012-12-29 17:36
    David Betz wrote: »
    I'm still uncertain as to how the REPD instruction is handled in the assembler. I know Chip said that a repeat count of 7 will do the loop 8 times. At one point PNut.exe would subtract one from immediate values before encoding them into the instruction so that #8 would repeat 8 times not 9. Is that still the case? I think it would be better if #7 actually encoded 7 into the instruction so that the behavior of immediates matches that of register arguments where no automatic "subtract one" is possible. Was this changed or does PNut.exe still encode 7 for an argument of #8?

    Yes this is still the case. I've tested both instructions:
    REPS #3,#n executes the repeat block 3 times, while
    REPD tmp,#n executes the block 4 times if tmp initialized with 3.

    REPS and REPD are just different instructions witth a different behavior. It's more important to make REPS easy to use than to make it similar to REPD.

    @jmg

    You already can do this:
    REPS #16_000,@:end     ' execute block from here+2 to :end  16,000 times
            NOP
             NOTP #0 'toggle P0
             NOTP #1 'toggle P1
             NOTP #2 'toggle P2
    :end     NOTP #3 'toggle P3, block repeats every 4 clocks
    

    Andy
  • David BetzDavid Betz Posts: 14,516
    edited 2012-12-29 17:51
    Ariba wrote: »
    Yes this is still the case. I've tested both instructions:
    REPS #3,#n executes the repeat block 3 times, while
    REPD tmp,#n executes the block 4 times if tmp initialized with 3.

    REPS and REPD are just different instructions witth a different behavior. It's more important to make REPS easy to use than to make it similar to REPD.

    @jmg

    You already can do this:
    REPS #16_000,@:end     ' execute block from here+2 to :end  16,000 times
            NOP
             NOTP #0 'toggle P0
             NOTP #1 'toggle P1
             NOTP #2 'toggle P2
    :end     NOTP #3 'toggle P3, block repeats every 4 clocks
    

    Andy
    Yes but REPD also has an immediate form and I think it probably works the same as REPS where #8 means to execute the code 8 times. That means the following two sequences do different things.
      REPD #8, ...
    
    and
    
      MOV r1, #8
      REPD r1, ...
    
    It seems to me that these two forms should behave the same way.
  • AribaAriba Posts: 2,690
    edited 2012-12-29 18:03
    Yes you are right, I was not aware of the immediate form of REPD.
    But why use REPD for an immediate number of repeats, it has only disadvantages: More slots between the REP and the code, only 512 repeats possible.

    I see it so: With an immediate value the Assembler can help to calculate the right value. With a register for the repeat count the Assembler has no chance and it's up to the programmer to do it right.

    Andy
  • jmgjmg Posts: 15,173
    edited 2012-12-29 18:08
    Ariba wrote: »
    @jmg

    You already can do this:
    REPS #16_000,@:end     ' execute block from here+2 to :end  16,000 times
            NOP
             NOTP #0 'toggle P0
             NOTP #1 'toggle P1
             NOTP #2 'toggle P2
    :end     NOTP #3 'toggle P3, block repeats every 4 clocks
    

    That is close, but if you forget NOP, or have too many, does it warn or simply swallow ?
  • David BetzDavid Betz Posts: 14,516
    edited 2012-12-29 18:09
    Ariba wrote: »
    Yes you are right, I was not aware of the immediate form of REPD.
    But why use REPD for an immediate number of repeats, it has only disadvantages: More slots between the REP and the code, only 512 repeats possible.

    I see it so: With an immediate value the Assembler can help to calculate the right value. With a register for the repeat count the Assembler has no chance and it's up to the programmer to do it right.

    Andy
    I guess you can make that argument but it means that this instruction will work differently than every other instruction with a choice between an immediate value and a register value. I think the main way to make an instruction set easy to learn is to have it behave consistently in all cases, not have special cases where they are not necessary. Anyway, I guess it's up to Chip and it seems he's already made the decision to subtract one from the immediate values before encoding them.
  • AribaAriba Posts: 2,690
    edited 2012-12-29 18:30
    David Betz wrote: »
    I... Anyway, I guess it's up to Chip and it seems he's already made the decision to subtract one from the immediate values before encoding them.

    Yes, but for GAS it's your decision.
  • David BetzDavid Betz Posts: 14,516
    edited 2012-12-29 18:33
    Ariba wrote: »
    Yes, but for GAS it's your decision.
    Not really. GAS needs to be as compatible with PASM as possible. I'll do whatever Chip does.
Sign In or Register to comment.