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

Propeller II programing questions to Chip

12346

Comments

  • potatoheadpotatohead Posts: 10,261
    edited 2013-03-26 20:03
    Coupla questions:

    1. We know video DAC output is only on COG 0. I assumed that was due to the large number of resources required. Is the pixel engine (PIX) available on other COGS? It executes, but I've not yet collected output. Just wondering what the limits are.

    2. How do we get 16 bit output from PIX, or can we quickly transform output from 32 bit color?

    3. Maybe PIX works in ways appropriate for the WAITVID mode in use. Is this true?
  • potatoheadpotatohead Posts: 10,261
    edited 2013-03-26 20:15
    @Cluso, the loader part of Pnut won't load past a given point, but it compiles it all. Use CTRL-L to get the object listing.

    Here's your program with a 5000 element test array at the end: (attached)

    You could format this for input through a terminal. I've done this a few times, and the format is in my monitor document. Basically, you need a starting hex address, followed by all the data, one colon per line to keep specifying addresses.

    2000: FF AA FF (16 bytes per line)
    : AA BB CC (16 bytes more, for as many as you want)
    OBJ bytes:  6,964
    
    _CLKMODE: 22
    _CLKFREQ: 03938700
    
    0E80: 0D 9C FC 0C 50 9C BC 80 00 9C BC FC 49 00 7C 1C  
    : 0D BE FC A0 59 BC FC 1F 37 BE FC A0 59 BC FC 1F   
    : 38 BE FC A0 59 BC FC 1F 39 BE FC A0 59 BC FC 1F   
    : 0D BE FC A0 59 BC FC 1F 52 BE BC A0 59 BC FC 1F   
    
    (lots of code, and optionally start addresses)
    
    
    : 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33   
    : 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33   
    : 33 33 33 33
    
    

    Edit: It would be great if Pnut.exe output a monitor compatible object code listing. :)
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-03-26 21:02
    potatohead wrote: »
    @Cluso, the loader part of Pnut won't load past a given point, but it compiles it all. Use CTRL-L to get the object listing.
    .....
    Edit: It would be great if Pnut.exe output a monitor compatible object code listing. :)

    Thanks potatohead. Thought I was going nuts for a while.

    Do you know if the p2loader will load the pnut binary? (I will go looking for it to see)
  • Roy ElthamRoy Eltham Posts: 3,000
    edited 2013-03-26 21:14
    potatohead wrote: »
    Coupla questions:

    1. We know video DAC output is only on COG 0. I assumed that was due to the large number of resources required. Is the pixel engine (PIX) available on other COGS? It executes, but I've not yet collected output. Just wondering what the limits are.

    2. How do we get 16 bit output from PIX, or can we quickly transform output from 32 bit color?

    3. Maybe PIX works in ways appropriate for the WAITVID mode in use. Is this true?

    Um.. Video DAC output is only on COG0? It's only that way on the FPGA boards because it's simulating the DACs with a bunch of FPGA output pins, also the daughter board for the DE2-115 only has the external Smile for 4 DACs (DE0 only has 1 cog). The real Prop2 will be able to drive 4 DACs per cog (at full speed, more at lower speeds), and the VID and PIX stuff will be in all cogs.

    Also, pretty sure the GETPIX output is a 32bit color, you'll have to either convert it to the pixel format you want.
  • potatoheadpotatohead Posts: 10,261
    edited 2013-03-26 21:34
    Yes, I know that the emulation is limited. The real deal will route the DACS to any pins. :)

    Was just wondering how PIX worked and what options there were.
  • BaggersBaggers Posts: 3,019
    edited 2013-03-27 10:55
    potatohead, looks like I was right, it's gonna have to be either downsized to 16bit or less, for each pixel, or screen buffers will have to be 32bit.
  • cgraceycgracey Posts: 14,151
    edited 2013-03-27 15:33
    Baggers wrote: »
    potatohead, looks like I was right, it's gonna have to be either downsized to 16bit or less, for each pixel, or screen buffers will have to be 32bit.

    I guess I should have made GETPIX handle 5:5:5 RGB data, not just 8:8:8. If we wind up making any necessary RTL changes in the future, I'll add that in.

    For now, you are stuck with only highest-quality 8:8:8 pixels when using the texture mapper. This, of course, results in lower-resolution displays which use a whole long per pixel.
  • BaggersBaggers Posts: 3,019
    edited 2013-03-27 17:32
    Thanks Chip :)
    I have however managed to come up with a quick solution for GETPIX to handle 5:5:5, tested and working, I will post demo tomorrow.
    But yeah, if you get to allow it to handle 5:5:5 that would be awesome :D, but I don't want it to come back with anything needing changing.
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-28 13:37
    Hi Chip.

    Don't think on this.
    I was not thiniking that P29-Pxx need be converted to HEX



    Now I reprogrammed my DE2-115. BUT it don't function that pinout.txt describe.

    P29 no connection on DE0-Nano, LED15/KEY1 on DE2-115
    pin command - 29 H --- Starts LEDR9
    P30 no connection on DE0-Nano, LED16/KEY2 on DE2-115
    pin command - xx H don't change any led
    P31 no connection on DE0-Nano, LED17/KEY3 on DE2-115
    pin command - xx H don't change any led

    Port B
    P32 no connection on DE0-Nano, LED0/SW0 on DE2-115
    pin command - 32 H --- Starts LEDG0, LEDG1, LEDG2 --- 32 L -- don't place LED's in off state
    P33 no connection on DE0-Nano, LED1/SW1 on DE2-115
    pin command - xx H don't change any led
    P34 no connection on DE0-Nano, LED2/SW2 on DE2-115
    pin command - xx H don't change any led
    P35 no connection on DE0-Nano, LED3/SW3 on DE2-115
    pin command - xx H don't change any led
    P36 no connection on DE0-Nano, LED4/SW4 on DE2-115
    pin command - xx H don't change any led
    P37 no connection on DE0-Nano, LED5/SW5 on DE2-115
    pin command - xx H don't change any led
    P38 no connection on DE0-Nano, LED6/SW6 on DE2-115
    pin command - xx H don't change any led
    P39 no connection on DE0-Nano, LED7/SW7 on DE2-115
    pin command - xx H don't change any led
    P40 no connection on DE0-Nano, LED8/SW8 on DE2-115
    pin command - xx H don't change any led
    P41 no connection on DE0-Nano, LED9/SW9 on DE2-115
    pin command - xx H don't change any led
    P42 no connection on DE0-Nano, LED10/SW10 on DE2-115
    pin command - xx H don't change any led
    P43 no connection on DE0-Nano, LED11/SW11 on DE2-115
    pin command - xx H don't change any led
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-28 16:38
    Hi All.

    If You will have Flash installed -- But start in Monitor mode.
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-03-28 16:44
    Sapieha,
    Wouldn't you just write a new program and store in flash like this???
    DAT
      org 0
    ''=======[ Return to the ROM Monitor ]=========================================
    '------------------------------------------------------------------------------
    Run_monitor     setcog  #0                              ' not required if still cog 0
                    coginit monitor_pgm,monitor_ptr         ' init cog0 with monitor
    monitor_pgm     long    $70C                            ' monitor program address
    monitor_ptr     long    90<<9 + 91                      ' monitor parameters
    
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-28 16:52
    Hi Cluso

    It is not problem write that - But not necessary.

    If You run program in PNut I posted in previous post with Flash installed - Emulator will start with Monitor and see Flash as not programmed.

    .
    Cluso99 wrote: »
    Sapieha,
    Wouldn't you just write a new program and store in flash like this???
    DAT
      org 0
    ''=======[ Return to the ROM Monitor ]=========================================
    '------------------------------------------------------------------------------
    Run_monitor     setcog  #0                              ' not required if still cog 0
                    coginit monitor_pgm,monitor_ptr         ' init cog0 with monitor
    monitor_pgm     long    $70C                            ' monitor program address
    monitor_ptr     long    90<<9 + 91                      ' monitor parameters
    
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-29 17:13
    I'm trying to restart the current COG using COGINIT and am having trouble. Shouldn't this sequence of instructions work?
                            cogid   t1
                            setcog  t1
                            coginit cmd1, cmd2           'relaunch cog0 with loaded program
    

    For some reason, my program hangs if I try this. On the other hand, this sequence works:
                            mov     t1, #0
                            setcog  t1
                            coginit cmd1, cmd2           'relaunch cog0 with loaded program
    
    Am I using COGID wrong?
  • potatoheadpotatohead Posts: 10,261
    edited 2013-03-29 23:21
    I don't think so. Just tried this on the DE2:
                    cogid    t1
                    setcog  t1
                    coginit monitor_pgm, monitor_ptr
    

    I added this to the current program I was working on. Figured it would launch, kill itself off and spawn the monitor in COG 0, which it did.
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-03-29 23:41
    Looks fine to me David.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-30 04:32
    Cluso99 wrote: »
    Looks fine to me David.
    Thanks for confirming that. Unfortunately, it doesn't work. I even verified that the bit encoding of the COGID instruction is correct.
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-03-31 02:03
    David, looking at the instruction set, COGID takes till the next hub cycle, SETCOG should only take 1 clock cycle. Setting b3=1 %1xxx uses the next available cog.

    I know this works...
    '------------------------------------------------------------------------------------------------
    ' Return to the ROM Monitor...
    '------------------------------------------------------------------------------------------------
    Run_monitor     setcog  #0                      ' not required if still cog 0
                    coginit monitor_pgm,monitor_ptr ' init cog0 with monitor
    monitor_pgm     long    $70C                    ' monitor program address
    monitor_ptr     long    90<<9 + 91              ' monitor parameters
    
    and I just modified this and the following works too (on the DE0)...
    ''=======[ Return to the ROM Monitor ]=========================================
    '------------------------------------------------------------------------------
    Run_monitor     'setcog  #0                              ' not required if still cog 0
      cogid cog
      setcog cog
                    coginit monitor_pgm,monitor_ptr         ' init cog0 with monitor
    monitor_pgm     long    $70C                            ' monitor program address
    monitor_ptr     long    90<<9 + 91                      ' monitor parameters
    cog  long 0
    
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-31 04:43
    Cluso99 wrote: »
    David, looking at the instruction set, COGID takes till the next hub cycle, SETCOG should only take 1 clock cycle. Setting b3=1 %1xxx uses the next available cog.

    I know this works...
    '------------------------------------------------------------------------------------------------
    ' Return to the ROM Monitor...
    '------------------------------------------------------------------------------------------------
    Run_monitor     setcog  #0                      ' not required if still cog 0
                    coginit monitor_pgm,monitor_ptr ' init cog0 with monitor
    monitor_pgm     long    $70C                    ' monitor program address
    monitor_ptr     long    90<<9 + 91              ' monitor parameters
    
    and I just modified this and the following works too (on the DE0)...
    ''=======[ Return to the ROM Monitor ]=========================================
    '------------------------------------------------------------------------------
    Run_monitor     'setcog  #0                              ' not required if still cog 0
      cogid cog
      setcog cog
                    coginit monitor_pgm,monitor_ptr         ' init cog0 with monitor
    monitor_pgm     long    $70C                            ' monitor program address
    monitor_ptr     long    90<<9 + 91                      ' monitor parameters
    cog  long 0
    
    Very odd. Is there any chance that the COGID opcode is wrong in the instruction table? I guess I'll have to dump some code from PNut to see what bit pattern gets generated for it.
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-31 04:54
    Hi David.

    It is what I have on BIT's used.
    instructions                                                                               clocks
    -------------------------------------------------------------------------------------------------
    000011 ZCR 0 CCCC DDDDDDDDD SSSSSSSSS     COGINIT D,S    ''launch COG at D, COG PTRA = S     1..9
    000011 000 1 CCCC DDDDDDDDD 000000000     CLKSET  D      ''set clock to D                    1..8
    000011 001 1 CCCC DDDDDDDDD 000000001     COGID   D      ''get COG number into D             2..9
    000011 000 1 CCCC DDDDDDDDD 000000011     COGSTOP D      ''stop COG in D                     1..8
    000011 ZC1 1 CCCC DDDDDDDDD 000000100     LOCKNEW D      ''get new lock into D, C = busy     2..9
    000011 000 1 CCCC DDDDDDDDD 000000101     LOCKRET D      ''return lock in D                  1..8
    000011 0C0 1 CCCC DDDDDDDDD 000000110     LOCKSET D      ''set lock in D, C = prev state     1..9
    000011 0C0 1 CCCC DDDDDDDDD 000000111     LOCKCLR D      ''clear lock in D, C = prev state   1..9
    -------------------------------------------------------------------------------------------------
    
    
    David Betz wrote: »
    Very odd. Is there any chance that the COGID opcode is wrong in the instruction table? I guess I'll have to dump some code from PNut to see what bit pattern gets generated for it.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-31 06:14
    Sapieha wrote: »
    Hi David.

    It is what I have on BIT's used.
    instructions                                                                               clocks
    -------------------------------------------------------------------------------------------------
    000011 ZCR 0 CCCC DDDDDDDDD SSSSSSSSS     COGINIT D,S    ''launch COG at D, COG PTRA = S     1..9
    000011 000 1 CCCC DDDDDDDDD 000000000     CLKSET  D      ''set clock to D                    1..8
    000011 001 1 CCCC DDDDDDDDD 000000001     COGID   D      ''get COG number into D             2..9
    000011 000 1 CCCC DDDDDDDDD 000000011     COGSTOP D      ''stop COG in D                     1..8
    000011 ZC1 1 CCCC DDDDDDDDD 000000100     LOCKNEW D      ''get new lock into D, C = busy     2..9
    000011 000 1 CCCC DDDDDDDDD 000000101     LOCKRET D      ''return lock in D                  1..8
    000011 0C0 1 CCCC DDDDDDDDD 000000110     LOCKSET D      ''set lock in D, C = prev state     1..9
    000011 0C0 1 CCCC DDDDDDDDD 000000111     LOCKCLR D      ''clear lock in D, C = prev state   1..9
    -------------------------------------------------------------------------------------------------
    
    
    Thanks Sapieha! Those are the encodings that GCC currently uses. I went back to my original code and now it seems to work. I guess there was some other problem that I've since fixed. Sorry for sending everyone on a wild goose chase!
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-31 21:58
    Hi Chip.

    monitor_ptr long 90<<9 + 91 'Pins for one monitor

    Why pin number 90 are shifted 9 positions --Not 8

    That give 5B B4 00 00
    In position B4 I wanted me 90 = $5A for correct pin number
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-01 12:59
    Hi Chip.

    Any info on use Internal "D" port

    Function it as all others -- else is it differences ?
  • cgraceycgracey Posts: 14,151
    edited 2013-04-03 10:10
    Sapieha wrote: »
    Hi Chip.

    monitor_ptr long 90<<9 + 91 'Pins for one monitor

    Why pin number 90 are shifted 9 positions --Not 8

    That give 5B B4 00 00
    In position B4 I wanted me 90 = $5A for correct pin number

    It's that way because in PASM it's easy to move into that 9-bit field using the MOVD instruction. In a high-level language, it wouldn't matter. So, I made it easy in assembly.
  • cgraceycgracey Posts: 14,151
    edited 2013-04-03 10:11
    I need to document that. Port D is the shared mailbox system.

    Right now, I'm almost done with the first SDRAM driver.
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-03 10:15
    Hi Chip.

    Thanks.
    Now I understand that
    cgracey wrote: »
    It's that way because in PASM it's easy to move into that 9-bit field using the MOVD instruction. In a high-level language, it wouldn't matter. So, I made it easy in assembly.
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-03 10:16
    Hi Chip.

    Time to wait for me.
    Thanks
    cgracey wrote: »
    I need to document that. Port D is the shared mailbox system.

    Right now, I'm almost done with the first SDRAM driver.
  • Bill HenningBill Henning Posts: 6,445
    edited 2013-04-03 11:21
    Great news! SDRAM frame buffers will be very very useful :)

    Looking forward to the Port D docs as well.
    cgracey wrote: »
    I need to document that. Port D is the shared mailbox system.

    Right now, I'm almost done with the first SDRAM driver.
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-07 01:33
    Hi Chip.

    In Yours "PropII_Monitor v2.spin" ---- You use instruction "cmpr" but it is still not described.
  • cgraceycgracey Posts: 14,151
    edited 2013-04-07 02:52
    Sapieha wrote: »
    Hi Chip.

    In Yours "PropII_Monitor v2.spin" ---- You use instruction "cmpr" but it is still not described.

    CMPR D,S/#n is SUBR D,S/#n NR

    It compares S/#n to D and sets C if S<D.
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-07 02:55
    Hi Chip.

    Thanks
    cgracey wrote: »
    CMPR D,S/#n is SUBR D,S/#n NR

    It compares S/#n to D and sets C if S<D.
Sign In or Register to comment.