Shop OBEX P1 Docs P2 Docs Learn Events
Prop2 FPGA files!!! - Updated 2 June 2018 - Final Version 32i - Page 18 — Parallax Forums

Prop2 FPGA files!!! - Updated 2 June 2018 - Final Version 32i

11516182021160

Comments

  • jmgjmg Posts: 15,173
    Seairth wrote: »
    REPLUT D/#

    For consistency, make an alias for SETQ to the cog variant:

    REPCOG D/#

    There is a REP already, and these are Block Move opcodes so maybe

    BLKLUT D/#

    BLKCOG D/#

  • cgracey wrote: »
    I'm working on the docs now, to clear this up.

    For the moment, can you provide the updated SETINTx map? I want to verify the hub rd/wr events.

  • cgraceycgracey Posts: 14,155
    Seairth wrote: »
    cgracey wrote: »
    I'm working on the docs now, to clear this up.

    For the moment, can you provide the updated SETINTx map? I want to verify the hub rd/wr events.

    I just updated that section of the Google Docs document.
  • SETQCOG/SETQLUT

    Or SETQC/SETQL

    Make the most sense to me setting the count and not doing the REP or the BLK with these instructions.
  • mindrobots wrote: »
    SETQCOG/SETQLUT

    Or SETQC/SETQL

    Make the most sense to me setting the count and not doing the REP or the BLK with these instructions.

    I like SETQC/SETQL. It keeps the SETQx pattern and C, L, etc. is more descriptive than 1, 2, etc.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-10-28 04:31
    @cgracey. Hi Chip, there have been a number of times I've had a look at your document and wanted to leave a comment. Would it be possible for you to change the default permissions so that we can at least leave a comment?

    I'm having trouble with the new files and something has changed with PNut's handling of REP but I will try to find out although that information tends to get buried not just in one thread but in who knows which thread what with all the OT stuff.

    How does addct1 etc differ from addcnt?

    I have this transmit code that PNut complains about and doesn't work:
    send  	        setb	A,#8		' add stop bit
    		shl	A,#1		' insert start bit
    		getcnt	A1
    		rep	@sn1,#10
    		 testb 	A,#0 wz 	' test next bit to send
    		 setbnz	outb,#tx_pin	' set/clr txd
    		 addcnt	A1,bit_time
    		 waitcnt
    		 shr	A,#1
    sn1   		ret
    
  • This: "rep @sn1,#10" should be, "rep #@sn1,#10"

    Pnut will calculate the value based on the label and plug it in as if you had typed: "rep #4,#10"

    https://ddingus.gitbooks.io/propeller-2-instruction-reference/content/rep.html

    I captured this at the time of discussion. Same with the other example. The GitBook is kind of awesome, but it does not have tables... Smile. Oh well, there are two in that book and maybe I'll figure something out to do more.

  • cgraceycgracey Posts: 14,155
    @cgracey. Hi Chip, there have been a number of times I've had a look at your document and wanted to leave a comment. Would it be possible for you to change the default permissions so that we can at least leave a comment?

    I'm having trouble with the new files and something has changed with PNut's handling of REP but I will try to find out although that information tends to get buried not just in one thread but in who knows which thread what with all the OT stuff.

    How does addct1 etc differ from addcnt?

    I have this transmit code that PNut complains about and doesn't work:
    send  	        setb	A,#8		' add stop bit
    		shl	A,#1		' insert start bit
    		getcnt	A1
    		rep	@sn1,#10
    		 testb 	A,#0 wz 	' test next bit to send
    		 setbnz	outb,#tx_pin	' set/clr txd
    		 addcnt	A1,bit_time
    		 waitcnt
    		 shr	A,#1
    sn1   		ret
    

    Change ADDCNT to ADDCT1 and change WAITCNT to WAITCT1.

    You now have ADDCT1..3, not just ADDCNT. Same with WAITCT1..3, instead of just WAITCNT. You've got 3 timers now.
  • cgraceycgracey Posts: 14,155
    potatohead wrote: »
    This: "rep @sn1,#10" should be, "rep #@sn1,#10"

    Pnut will calculate the value based on the label and plug it in as if you had typed: "rep #4,#10"

    https://ddingus.gitbooks.io/propeller-2-instruction-reference/content/rep.html

    I captured this at the time of discussion. Same with the other example. The GitBook is kind of awesome, but it does not have tables... Smile. Oh well, there are two in that book and maybe I'll figure something out to do more.
    I think REP still uses just @symbol for determining the instruction count, not #.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-10-28 05:07
    No, it had to be an @ to work and it didn't like local labels either. However the main problem was that I was starting up a receive cog in #10 but the new FPGA now "only" has 10 cogs. Also it seems PNut allows labels anywhere on a line so when it finds old instructions like addcnt it creates a symbol then throws an error on the operand :) Easy fixed but I got caught for a second. So I use the addct1 etc but why couldn't they just be called addcnt1 etc rather than truncating them unnecessarily?
  • potatoheadpotatohead Posts: 10,261
    edited 2015-10-28 05:14
    I can't check at the moment. When we know which it is, I'll make edits. At the time we had the discussion, I'm pretty sure the "#@" syntax was present in a lot of the "bad label" discussion I initiated.

    When it was all resolved, and I realized the label argument was stupid, I typed that one up.

    Again, let me know which it is.

  • cgraceycgracey Posts: 14,155
    No, it had to be an @ to work and it didn't like local labels either. However the main problem was that I was starting up a receive cog in #10 but the new FPGA now "only" has 10 cogs. Also it seems PNut allows labels anywhere on a line so when it finds old instructions like addcnt it creates a symbol then throws an error on the operand :) Easy fixed but I got caught for a second. So I use the addct1 etc but why couldn't they just be called addcnt1 etc rather than truncating them unnecessarily?

    I like ADDCNT1 better, too, but when we have to make WAITxxx, we only have three letters to work with. I was thinking TM1..3 might be better than CT1..3.
  • cgraceycgracey Posts: 14,155
    potatohead wrote: »
    I can't check at the moment. When we know which it is, I'll make edits. At the time we had the discussion, I'm pretty sure the "#@" syntax was present in a lot of the "bad label" discussion I initiated.

    When it was all resolved, and I realized the label argument was stupid, I typed that one up.

    Again, let me know which it is.

    I'm not at my computer, but I'm pretty sure it's @label.
  • jmgjmg Posts: 15,173
    cgracey wrote: »
    I like ADDCNT1 better, too, but when we have to make WAITxxx, we only have three letters to work with.
    Why the hard limit ?

    cgracey wrote: »
    I was thinking TM1..3 might be better than CT1..3.
    It is a counter being used as a timer, but the guide here should be what units are used ?
    The values added and compared are cycle counts, not ns, so Count semantics seems correct.

    What does seem natural is to include a simple backward compatible alias

    ie when someone codes a default (As above)
    addcnt A1,bit_time
    waitcnt

    that becomes
    addct1 A1,bit_time
    waitct1

    if they need other Counters they code
    addct2 A1,bit_time
    waitct2

    New code using all 3 timers would naturally use 1.2.3
  • cgraceycgracey Posts: 14,155
    edited 2015-10-28 05:47
    jmg wrote: »
    cgracey wrote: »
    I like ADDCNT1 better, too, but when we have to make WAITxxx, we only have three letters to work with.
    Why the hard limit ?

    cgracey wrote: »
    I was thinking TM1..3 might be better than CT1..3.
    It is a counter being used as a timer, but the guide here should be what units are used ?
    The values added and compared are cycle counts, not ns, so Count semantics seems correct.

    What does seem natural is to include a simple backward compatible alias

    ie when someone codes a default (As above)
    addcnt A1,bit_time
    waitcnt

    that becomes
    addct1 A1,bit_time
    waitct1

    if they need other Counters they code
    addct2 A1,bit_time
    waitct2

    New code using all 3 timers would naturally use 1.2.3

    If we exceed 7 characters, we overshoot what was supposed to be the next tab stop.
  • Chip,
    what about having the 1-3 be a parameter.

    WAITCNT n
    ADDCNT S, D, n
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-10-28 07:54
    Roy Eltham wrote: »
    Chip,
    what about having the 1-3 be a parameter.

    WAITCNT n
    ADDCNT S, D, n

    That sounds a bit more sensible and it's similar to we do for the CALLD instruction where we specify 1 of 4 registers etc.
    Screenshot%20from%202015-10-28%2018%3A02%3A40.png

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-10-28 12:33
    I know the P2 is not quite set in cement yet but is it that fluid that we have different machine codes for the same opcodes on minor updates? I used my assembler written in TF2 to test a little cordic function and it kept crashing. Comparing the machine code it produced with what PNut *now* produces shows something is different. Do I have to go through all the opcodes again or is just a few minor things that have changed?
    new
    CCCC 1101011 CZ0 000000000 000110001        RET                 {WC,WZ}
    CCCC 1101011 CZ0 000000000 000110010        RETA                {WC,WZ}
    CCCC 1101011 CZ0 000000000 000110011        RETB                {WC,WZ}
    
    old
    CCCC 1101011 CZ0 000000000 000101101        RET                 {WC,WZ}
    CCCC 1101011 CZ0 000000000 000101110        RETA                {WC,WZ}
    CCCC 1101011 CZ0 000000000 000101111        RETB                {WC,WZ}
    

    EDIT: Just did a diff between the old and new and I can spot the changes but a little heads up would be welcome next time :)
  • mindrobots wrote: »
    Loopy, all Chip is providing are the binary image files (.rbf, .pof, .jic). They are built for the specific boards and I can't imagine there is any way to port them ot another board. You'd need the actual verilog source so you could take care of pin assignments and such and then rebuild them for the target boards.

    Yeah, with all the joy and buzz from Tachyon Forth on the Propeller 2, that just slipped my mind. I was actually looking at the DE0-Nano just to get going when I got this rather mis-guided brainwave.

    The DE0-Nano is still available at $89.00USD from Altera.

    At least I don't have to study how to hack and modify Verilog;-)

  • cgraceycgracey Posts: 14,155
    I know the P2 is not quite set in cement yet but is it that fluid that we have different machine codes for the same opcodes on minor updates? I used my assembler written in TF2 to test a little cordic function and it kept crashing. Comparing the machine code it produced with what PNut *now* produces shows something is different. Do I have to go through all the opcodes again or is just a few minor things that have changed?
    new
    CCCC 1101011 CZ0 000000000 000110001        RET                 {WC,WZ}
    CCCC 1101011 CZ0 000000000 000110010        RETA                {WC,WZ}
    CCCC 1101011 CZ0 000000000 000110011        RETB                {WC,WZ}
    
    old
    CCCC 1101011 CZ0 000000000 000101101        RET                 {WC,WZ}
    CCCC 1101011 CZ0 000000000 000101110        RETA                {WC,WZ}
    CCCC 1101011 CZ0 000000000 000101111        RETB                {WC,WZ}
    

    EDIT: Just did a diff between the old and new and I can spot the changes but a little heads up would be welcome next time :)

    Peter, sorry I didn't say anything. I'll remember next time, maybe putting asterisks on the affected lines in instructions.txt, or something.

    This whole matter of opcode assignment has been the most ongoingly-difficult aspect of the whole project. It's something I've wished was sublimated into the design process, like other implementation details, but it's always sticking out.
  • cgraceycgracey Posts: 14,155
    Roy Eltham wrote: »
    Chip,
    what about having the 1-3 be a parameter.

    WAITCNT n
    ADDCNT S, D, n

    It should probably have a # for consistency.

    What about just using 'WTxxxxx' instead of 'WAITxxx'?
  • cgraceycgracey Posts: 14,155
    Peter, the old WAITCNT is now WAITCT1/WAITCT2/WAITCT3/WMLONG.

    Other changes occurred at the end of the D-only instructions, starting at SETEDG.
  • cgracey wrote: »
    I know the P2 is not quite set in cement yet but is it that fluid that we have different machine codes for the same opcodes on minor updates? I used my assembler written in TF2 to test a little cordic function and it kept crashing. Comparing the machine code it produced with what PNut *now* produces shows something is different. Do I have to go through all the opcodes again or is just a few minor things that have changed?

    Well if I were in your position I wouldn't want to be unnecessarily constricted all because the P2 image was released early for us eager testers. However I was right in the middle of trying to update the document with the new format, update my Tachyon Forth kernel, and my assembler etc while writing a short snippet to test interactively when I had one crash after another. Seems it wasn't a bug in the chip, the bug was Chip!

    I can always use a diff tool to spot any changes to the instruction set and hopefully there aren't too many next time, I'm trying to tidy up the P2 assembly instruction set document and I'm having as much success as trying to keep my workbench tidy!
  • RaymanRayman Posts: 14,646
    edited 2015-10-28 14:52
    what does WMLONG have to do with WAITCNT?

    Thanks for the documentation update.
    One question... Are all instructions 2-clock except hub interactions?
  • Rayman wrote: »
    what does WMLONG have to do with WAITCNT?

    They use the same opcode and are differentiated from each other by what are normally the WC and WZ flags.
    CCCC 1010100 00I DDDDDDDDD SSSSSSSSS        ADDCT1  D,S/#
    CCCC 1010100 01I DDDDDDDDD SSSSSSSSS        ADDCT2  D,S/#
    CCCC 1010100 10I DDDDDDDDD SSSSSSSSS        ADDCT3  D,S/#
    CCCC 1010100 11I DDDDDDDDD SSSSSSSSS        WMLONG  D,S/#/PTRx
    
  • cgraceycgracey Posts: 14,155
    Rayman wrote: »
    what does WMLONG have to do with WAITCNT?

    Thanks for the documentation update.
    One question... Are all instructions 2-clock except hub interactions?

    Everything but hub and WAITxxx instructions are two clocks, if I'm not missing anything.
  • jmgjmg Posts: 15,173
    cgracey wrote: »
    Roy Eltham wrote: »
    Chip,
    what about having the 1-3 be a parameter.

    WAITCNT n
    ADDCNT S, D, n

    It should probably have a # for consistency.

    What about just using 'WTxxxxx' instead of 'WAITxxx'?

    'WTxxxxx' works, and is probably better than adding a param.

    WAITCNT #n is ok,
    but to be consistent the other form needs to have #n first
    ADDCNT #n, S, D
    and then you have 3 params, which is not as easy to read.
  • cgraceycgracey Posts: 14,155
    jmg wrote: »
    cgracey wrote: »
    Roy Eltham wrote: »
    Chip,
    what about having the 1-3 be a parameter.

    WAITCNT n
    ADDCNT S, D, n

    It should probably have a # for consistency.

    What about just using 'WTxxxxx' instead of 'WAITxxx'?

    'WTxxxxx' works, and is probably better than adding a param.

    WAITCNT #n is ok,
    but to be consistent the other form needs to have #n first
    ADDCNT #n, S, D
    and then you have 3 params, which is not as easy to read.

    It's all these ergonomic matters that take so much time. Implementation can be a lot of work, but waiting for the right ideas to percolate up is the slowest part.
  • OK, just rename the terms and the problem goes away.

    Instead of having the CNT register, and then the three timer registers, CNT1, CNT2 and CNT3

    GETCNT, ADDCNT1, ADDCNT2, ADDCNT3 and then WAITCNT1, WAITCNT2, WAITCNT3 and POLLCNT1, POLLCNT2, POLLCNT3 (which all bump into the next tabstop)

    You have a system ClockTick register (CT) and the three user Clock Tick registers CT1, CT2 and CT3 and your instructions are all nice again:

    GETCT (get clock ticks)
    ADDCT1, ADDCT2, ADDCT3 - add S/# to D (and store result in CT1/2/3)
    WAITCT1, WAITCT2, WAITCT3
    POLLCT1, POLLCT2, POLLCT3

    CNT just ceases to be.
  • evanhevanh Posts: 15,916
    cgracey wrote: »
    Everything but hub and WAITxxx instructions are two clocks, if I'm not missing anything.

    Cool. Weren't all the branch instructions four clocks? I must have missed a change somewhere.
Sign In or Register to comment.