Shop OBEX P1 Docs P2 Docs Learn Events
An Issue with REP blocks, Single step interrupts and HUB execution - Page 2 — Parallax Forums

An Issue with REP blocks, Single step interrupts and HUB execution

2

Comments

  • ozpropdevozpropdev Posts: 2,792
    edited 2017-01-24 10:36
    P2 debugger 1.2 Beta

    Basic steps to get started
    F11 code into P123 board from Pnut
    Start PST @ 1M baud
    Wait for prompt ">"
    Type STK+
    Type SWL+

    Repeated pressing of "*" will step through the code and show flags, stack and register values.
    Pressing "?" will show a basic help screen.

    I'm still generating docs for this work in progress.
    Hope it helps. :)

  • Oops!
    Try Version 1.2a instead, I was little hasty posting the code.
    Propeller 2 Interactive Debugger
    Version 1.2a - Ozpropdev Jan 2017
    
    -----------------------------------------------------------------------------------------(P2 Debugger)
    00003: F6042400              MOV     $012,#$000
    Flags (CZ) = _Z
    >STK+
    -----------------------------------------------------------------------------------------(P2 Debugger)
    STACK : --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000
    00003: F6042400              MOV     $012,#$000
    Flags (CZ) = _Z
    >SWL+
    -----------------------------------------------------------------------------------------(P2 Debugger)
    STACK : --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000
    COG | $00010: "Bravo"       $FFFFFEBF %11111111_11111111_11111110_10111111 #4294966975 #-321
    COG | $00011: "Charlie"     $00C0FFEE %00000000_11000000_11111111_11101110 #12648430
    COG | $0000F: "Alpha"       $00002694 %00000000_00000000_00100110_10010100 #9876
    COG | $00012: "Delta"       $FFFFFFFF %11111111_11111111_11111111_11111111 #4294967295 #-1
    00003: F6042400              MOV     $012,#$000
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    STACK : --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000
    COG | $00010: "Bravo"       $FFFFFEBF %11111111_11111111_11111110_10111111 #4294966975 #-321
    COG | $00011: "Charlie"     $00C0FFEE %00000000_11000000_11111111_11101110 #12648430
    COG | $0000F: "Alpha"       $00002694 %00000000_00000000_00100110_10010100 #9876
    COG | $00012: "Delta"       $00000000 %00000000_00000000_00000000_00000000 #0
    00004: FCDC0401              REP     #$002,#$001
    00005: F1041E01              ADD     $00F,#$001
    00006: F1842002              SUB     $010,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    STACK : --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000
    COG | $00010: "Bravo"       $FFFFFEBD %11111111_11111111_11111110_10111101 #4294966973 #-323
    COG | $00011: "Charlie"     $0001FFDC %00000000_00000001_11111111_11011100 #131036
    COG | $0000F: "Alpha"       $00002695 %00000000_00000000_00100110_10010101 #9877
    COG | $00012: "Delta"       $00000000 %00000000_00000000_00000000_00000000 #0
    00008: FCDC0401              REP     #$002,#$001
    00009: F1041E01              ADD     $00F,#$001
    0000A: F1842002              SUB     $010,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    STACK : --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000
    COG | $00010: "Bravo"       $FFFFFEBB %11111111_11111111_11111110_10111011 #4294966971 #-325
    COG | $00011: "Charlie"     $0001FFB8 %00000000_00000001_11111111_10111000 #131000
    COG | $0000F: "Alpha"       $00002696 %00000000_00000000_00100110_10010110 #9878
    COG | $00012: "Delta"       $00000000 %00000000_00000000_00000000_00000000 #0
    0000C: F99C2413              BMASK   $012,#$013
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    STACK : --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000
    COG | $00010: "Bravo"       $FFFFFEBB %11111111_11111111_11111110_10111011 #4294966971 #-325
    COG | $00011: "Charlie"     $0001FFB8 %00000000_00000001_11111111_10111000 #131000
    COG | $0000F: "Alpha"       $00002696 %00000000_00000000_00100110_10010110 #9878
    COG | $00012: "Delta"       $000FFFFF %00000000_00001111_11111111_11111111 #1048575
    0000D: FDA07000              CALL    #$7000
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    STACK : -Z_0000E --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000
    COG | $00010: "Bravo"       $FFFFFEBB %11111111_11111111_11111110_10111011 #4294966971 #-325
    COG | $00011: "Charlie"     $0001FFB8 %00000000_00000001_11111111_10111000 #131000
    COG | $0000F: "Alpha"       $00002696 %00000000_00000000_00100110_10010110 #9878
    COG | $00012: "Delta"       $000FFFFF %00000000_00001111_11111111_11111111 #1048575
    07000: F6042400              MOV     $012,#$000
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    STACK : -Z_0000E --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000
    COG | $00010: "Bravo"       $FFFFFEBB %11111111_11111111_11111110_10111011 #4294966971 #-325
    COG | $00011: "Charlie"     $0001FFB8 %00000000_00000001_11111111_10111000 #131000
    COG | $0000F: "Alpha"       $00002696 %00000000_00000000_00100110_10010110 #9878
    COG | $00012: "Delta"       $00000000 %00000000_00000000_00000000_00000000 #0
    07004: FCDC0401              REP     #$002,#$001
    07008: F1041E01              ADD     $00F,#$001
    0700C: F1842002              SUB     $010,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    STACK : -Z_0000E --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000
    COG | $00010: "Bravo"       $FFFFFEB9 %11111111_11111111_11111110_10111001 #4294966969 #-327
    COG | $00011: "Charlie"     $0001FF70 %00000000_00000001_11111111_01110000 #130928
    COG | $0000F: "Alpha"       $00002697 %00000000_00000000_00100110_10010111 #9879
    COG | $00012: "Delta"       $000FFFFF %00000000_00001111_11111111_11111111 #1048575
    07018: FD600031              RET
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    STACK : --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000
    COG | $00010: "Bravo"       $FFFFFEB9 %11111111_11111111_11111110_10111001 #4294966969 #-327
    COG | $00011: "Charlie"     $0001FF70 %00000000_00000001_11111111_01110000 #130928
    COG | $0000F: "Alpha"       $00002697 %00000000_00000000_00100110_10010111 #9879
    COG | $00012: "Delta"       $000FFFFF %00000000_00001111_11111111_11111111 #1048575
    0000E: FD9FFFFC              JMP     #$FFFFC
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    STACK : --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000 --_00000
    COG | $00010: "Bravo"       $FFFFFEB9 %11111111_11111111_11111110_10111001 #4294966969 #-327
    COG | $00011: "Charlie"     $0001FF70 %00000000_00000001_11111111_01110000 #130928
    COG | $0000F: "Alpha"       $00002697 %00000000_00000000_00100110_10010111 #9879
    COG | $00012: "Delta"       $000FFFFF %00000000_00001111_11111111_11111111 #1048575
    0000E: FD9FFFFC              JMP     #$FFFFC
    Flags (CZ) = _Z
    >
    
  • cgraceycgracey Posts: 14,152
    Looks good, Ozpropdev.

    I'm going to bed now, but I'll use this tomorrow to test the single-step after hub-exec REP. I think I've figured out the trouble now. I need to raise 'repa' one instruction early in hub-exec.
  • No worries :)
  • Chip - have you considered taking a little time and setting up a Modelsim simulation environment? It doesn't seem like it should be that hard, and for cases like this it sounds like it would save you time. I don't know if there's someone trusted who could help you out - e.g. if they had access to your source code, then they could work on it for you. The simulation could just load a custom ROM with a simple test case, so you wouldn't need to go through the lengthy boot process.
  • Chip
    I fixed a bug in the debugger! :lol:
    Here's the updated version 1.2b
  • cgraceycgracey Posts: 14,152
    edited 2017-01-25 06:46
    Today was spent recoding a big mux that selects the next PC value. It's much cleaner now and the compiler has more freedom to optimize it. This was all done in preparation of solving the single-step problem that Ozpropdev discovered. Tomorrow I'll be back on the single-step issue.
  • cgraceycgracey Posts: 14,152
    edited 2017-01-25 06:50
    KeithE wrote: »
    Chip - have you considered taking a little time and setting up a Modelsim simulation environment? It doesn't seem like it should be that hard, and for cases like this it sounds like it would save you time. I don't know if there's someone trusted who could help you out - e.g. if they had access to your source code, then they could work on it for you. The simulation could just load a custom ROM with a simple test case, so you wouldn't need to go through the lengthy boot process.

    I don't know anything about Modelsim. It's my feeling that the setup I have is quite decent. I just need to set up test cases, occasionally, that sometimes require shifting into granny gear. Shifting gears is the hard part.
  • IIRC Modelsim has a line limitation of 10,000? lines that requires a $2K subscription fee to unlock. :(
  • evanhevanh Posts: 15,915
    cgracey wrote: »
    Today was spent recoding a big mux that selects the next PC value. It's much cleaner now and the compiler has more freedom to optimize it. This was all done in preparation of solving the single-step problem that Ozpropdev discovered. Tomorrow I'll be back on the single-step issue.

    That sounds a nice clean up. Probably the sort of thing that only gets done on major optimisation drives in bigger teams.

    Cheers to Oz too, for doing the work to find the bug. Presumably it affects all interrupt sources and I wonder if more than just REP instruction might be caught up in it too. At the very least, the bug adds more jitter to interrupt timings.
  • RaymanRayman Posts: 14,641
    Worst case, one could just insert a NOP after all hubexec REP blocks, right?

    If you really wanted to single step, that is.
    Single step sounds great for seeing that the instructions really do.
    But, once we have good docs, don't think it's the most important feature so doesn't have to be perfect in all cases...
  • evanhevanh Posts: 15,915
    I'm pretty certain this is not just a debug concern, that's just where the bug has made itself obvious. Besides, we're getting a probable tiny improvement in active power draw from Chip's re-engineering effort. Each one of these tweaks adds up. :)
  • cgraceycgracey Posts: 14,152
    Okay! I think I solved the problem. Here is a new set of files for the Prop123-A9 board. This FPGA image has just two cogs and no CORDIC, but it will be fine for determining if the bug is gone:

    https://drive.google.com/a/parallax.com/file/d/0B9NbgkdrupkHbnVRb0hqTWVqOTg/view?usp=sharing

    Ozpropdev, I just got to the point where things check out on the logic analyzer. I haven't tested it with your debugger, yet. I think it will work fine, though. I'll try the debugger out in the morning. Thanks!
  • cgraceycgracey Posts: 14,152
    edited 2017-01-26 12:28
    An important note about changes to the 'REP D/#,S/#' instruction:

    I changed the D/# value to be the actual number of instructions to repeat (not # minus 1). If 0 is used for D/#, nothing will be repeated, regardless of the S/# value. PNut.exe has been updated to properly compute #D when @label is used.

    The S/# value conveys the number of iterations. An S/# value of 1 will execute the subsequent block once, while 2 will execute it twice. If S/# is 0, the block will be repeated indefinitely.

    If a branch occurs in the block of instructions that is being repeated, the REP will be canceled.
  • Thanks Chip!
    I will try it out.
  • Checks out OK Chip! :)
    Looks good.
    Propeller 2 Interactive Debugger
    Version 1.3 - Ozpropdev 27th Jan 2017
    
    -----------------------------------------------------------------------------------------(P2 Debugger)
    00003: F6042400              MOV     $012,#$000
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    00004: FCDC0601              REP     #$003,#$001
    00005: F1041E01              ADD     $00F,#$001
    00006: F1842002              SUB     $010,#$002
    00007: FA042202              MUL     $011,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    00008: FCDC0601              REP     #$003,#$001
    00009: F1041E01              ADD     $00F,#$001
    0000A: F1842002              SUB     $010,#$002
    0000B: FA042202              MUL     $011,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    0000C: F99C2413              BMASK   $012,#$013
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    0000D: FDA07000              CALL    #$7000
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    07000: F6042400              MOV     $012,#$000
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    07004: FCDC0602              REP     #$003,#$002
    07008: F1041E01              ADD     $00F,#$001
    0700C: F1842002              SUB     $010,#$002
    07010: FA042202              MUL     $011,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    07014: F99C2413              BMASK   $012,#$013
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    07018: FD600031              RET
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    0000E: FD9FFFFC              JMP     #$FFFFC
    Flags (CZ) = _Z
    >
    
  • cgraceycgracey Posts: 14,152
    edited 2017-01-26 13:22
    ozpropdev wrote: »
    Checks out OK Chip! :)
    Looks good.
    Propeller 2 Interactive Debugger
    Version 1.3 - Ozpropdev 27th Jan 2017
    
    -----------------------------------------------------------------------------------------(P2 Debugger)
    00003: F6042400              MOV     $012,#$000
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    00004: FCDC0601              REP     #$003,#$001
    00005: F1041E01              ADD     $00F,#$001
    00006: F1842002              SUB     $010,#$002
    00007: FA042202              MUL     $011,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    00008: FCDC0601              REP     #$003,#$001
    00009: F1041E01              ADD     $00F,#$001
    0000A: F1842002              SUB     $010,#$002
    0000B: FA042202              MUL     $011,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    0000C: F99C2413              BMASK   $012,#$013
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    0000D: FDA07000              CALL    #$7000
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    07000: F6042400              MOV     $012,#$000
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    07004: FCDC0602              REP     #$003,#$002
    07008: F1041E01              ADD     $00F,#$001
    0700C: F1842002              SUB     $010,#$002
    07010: FA042202              MUL     $011,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    07014: F99C2413              BMASK   $012,#$013
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    07018: FD600031              RET
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    0000E: FD9FFFFC              JMP     #$FFFFC
    Flags (CZ) = _Z
    >
    

    Super! Thanks, Ozpropdev.

    The corner cases for REP are:

    D=0 and S=0
    D=0 and S=1
    D=0 and S>1

    D=1 and S=0
    D=1 and S=1
    D=1 and S>1

    D>1 and S=0
    D>1 and S=1
    D>1 and S>1

    Also, how does it return to single-step after a branch within the repeat block?

    These are all things that need testing.
  • cgraceycgracey Posts: 14,152
    Those cases all need to be checked in cog-, lut-, and hub-exec. If you're up for this, Ozpropdev, I'd sure be grateful.
  • ozpropdevozpropdev Posts: 2,792
    edited 2017-01-26 21:53
    Chip
    Here's the first test for
    D=0 and S=0
    D=0 and S=1
    D=0 and S>1
    			rep	#0,#0
    			add	alpha,#1
    			sub	bravo,#2
    
    			rep	#0,#1
    			add	alpha,#1
    			sub	bravo,#2
    
    			rep	#0,#2
    			add	alpha,#1
    			sub	bravo,#2
    
    
    and here's the result
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001F: "Alpha"       $00002694 %00000000_00000000_00100110_10010100 #9876
    00003: F6043E00              MOV     $01F,#$000
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001F: "Alpha"       $00000000 %00000000_00000000_00000000_00000000 #0
    00004: FCDC0000              REP     #$000,#$000
    ****** !! WARNING !! Infinite REP loop! Debug control will be lost. ******
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001F: "Alpha"       $00000001 %00000000_00000000_00000000_00000001 #1
    00006: F1844002              SUB     $020,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001F: "Alpha"       $00000001 %00000000_00000000_00000000_00000001 #1
    00007: FCDC0001              REP     #$000,#$001
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001F: "Alpha"       $00000002 %00000000_00000000_00000000_00000010 #2
    00009: F1844002              SUB     $020,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001F: "Alpha"       $00000002 %00000000_00000000_00000000_00000010 #2
    0000A: FCDC0002              REP     #$000,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001F: "Alpha"       $00000003 %00000000_00000000_00000000_00000011 #3
    0000C: F1844002              SUB     $020,#$002
    Flags (CZ) = _Z
    >
    

    Note in all three cases the ADD instruction is skipped.
    Works OK, debugger needs modification to allow for zero length blocks.
  • Tests for
    D=1 and S=0 'nevers returns to debugger because infinite repeat block as expected
    D=1 and S=1
    D=1 and S>1
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001C: "Alpha"       $00000000 %00000000_00000000_00000000_00000000 #0
    00004: FCDC0201              REP     #$001,#$001
    00005: F1043801              ADD     $01C,#$001
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001C: "Alpha"       $00000001 %00000000_00000000_00000000_00000001 #1
    00006: F1843A02              SUB     $01D,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001C: "Alpha"       $00000001 %00000000_00000000_00000000_00000001 #1
    00007: FCDC0202              REP     #$001,#$002
    00008: F1043801              ADD     $01C,#$001
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001C: "Alpha"       $00000003 %00000000_00000000_00000000_00000011 #3
    00009: F1843A02              SUB     $01D,#$002
    Flags (CZ) = _Z
    >
    

    These test OK

  • ozpropdevozpropdev Posts: 2,792
    edited 2017-01-26 21:15
    D>1 and S=0 'same as above infinite loop as expected
    D>1 and S=1
    D>1 and S>1
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001C: "Alpha"       $00000000 %00000000_00000000_00000000_00000000 #0
    00004: FCDC0401              REP     #$002,#$001
    00005: F1043801              ADD     $01C,#$001
    00006: F1843A02              SUB     $01D,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001C: "Alpha"       $00000001 %00000000_00000000_00000000_00000001 #1
    00007: FCDC0402              REP     #$002,#$002
    00008: F1043801              ADD     $01C,#$001
    00009: F1843A02              SUB     $01D,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001C: "Alpha"       $00000003 %00000000_00000000_00000000_00000011 #3
    0000A: F6043E00              MOV     $01F,#$000
    Flags (CZ) = _Z
    >
    

    Test OK

    All these test were CogExec only.
    Only the first test cases of S=0 failed. S-0 OK, debugger needs modification for 0 length REP blockks
    I will test LutExec and HubExec tomorrow. :)

  • RaymanRayman Posts: 14,641
    edited 2017-01-26 16:04
    Sounds great.
    To clarify, when S==0 the block is skipped over?
    Never mind, I see S==0 means infinite loop...

    Is allowing a branch inside REP new?

    REP with D==0 is just like NOP then?
  • cgraceycgracey Posts: 14,152
    ozpropdev wrote: »
    D>1 and S=0 'same as above infinite loop as expected
    D>1 and S=1
    D>1 and S>1
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001C: "Alpha"       $00000000 %00000000_00000000_00000000_00000000 #0
    00004: FCDC0401              REP     #$002,#$001
    00005: F1043801              ADD     $01C,#$001
    00006: F1843A02              SUB     $01D,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001C: "Alpha"       $00000001 %00000000_00000000_00000000_00000001 #1
    00007: FCDC0402              REP     #$002,#$002
    00008: F1043801              ADD     $01C,#$001
    00009: F1843A02              SUB     $01D,#$002
    Flags (CZ) = _Z
    >*
    -----------------------------------------------------------------------------------------(P2 Debugger)
    COG | $0001C: "Alpha"       $00000003 %00000000_00000000_00000000_00000011 #3
    0000A: F6043E00              MOV     $01F,#$000
    Flags (CZ) = _Z
    >
    

    Test OK

    All these test were CogExec only.
    Only the first test cases of S=0 failed.
    I will test LutExec and HubExec tomorrow. :)

    Ozpropdev, thanks for testing.

    I can fix the problem of skipping one instruction when REP executes with D=0.
  • cgraceycgracey Posts: 14,152
    edited 2017-01-26 21:17
    Rayman wrote: »
    Sounds great.
    To clarify, when S==0 the block is skipped over?
    Never mind, I see S==0 means infinite loop...

    Is allowing a branch inside REP new?

    REP with D==0 is just like NOP then?

    Cancelling a REP via a branch is new (and necessary). Prop2-Hot did that.

    Yes, I will make REP with D=0 into a NOP.
  • Cancelling with a JMP works as expected in CogExec and single step shpws the instruction at the destination address as the next instruction.
    I'm running all the tests again now with a tweaked debugger,
    I will make a complete result output soon.
    :)
  • ozpropdevozpropdev Posts: 2,792
    edited 2017-01-27 04:50
    Today I tested in Cog,Lut and Hub exec for all test cases above.

    All work correctly except for the case of D=1 and a JMP instruction (Cancel).
    Cog and lut exec jumps to cog or lut addresses a short by 1 address.
    JMP's to hub addresses are OK.

    Probably not a big deal as a REP block with a length of 1 and a JMP is illogical anyway.

    So looking good Chip! ;)
  • Does it work for D>1 and the last instruction in the REP block is a JMP? (I can't look at your test code at the moment.)
  • cgraceycgracey Posts: 14,152
    edited 2017-01-27 05:41
    ozpropdev wrote: »
    Today I tested in Cog,Lut and Hub exec for all test cases above.

    All work correctly except for the case of D=1 and a JMP instruction (Cancel).
    Cog and lut exec jumps to cog or lut addresses a short by 1 address.
    JMP's to hub addresses are OK.

    Probably not a big deal as a REP block with a length of 1 and a JMP is illogical anyway.

    So looking good Chip! ;)

    Boy, that case of D=1 and JMP in cog/lut-exec is weird. I half-way know why that's happening: a repeat is occurring, already, on the JMP instruction, as REP executes. The PC is not in a natural state at that time and the JMP is relative.

    Getting back into that REP instruction has been a chore.

    I made a new version today which turns REP into a NOP if D [8:0] is zero. This means the next instruction can be single-stepped, as you'd expect.

  • Seairth wrote: »
    Does it work for D>1 and the last instruction in the REP block is a JMP? (I can't look at your test code at the moment.)
    I had tested for D>1 which worked OK, but in all my tests I hadn't tried JMP as the last instruction in the block.
    Your onto something there Seairth, it seems that if the last instruction is a JMP the issue raises it's head again.
    I'll keep digging....

Sign In or Register to comment.