Shop OBEX P1 Docs P2 Docs Learn Events
P2 (2015) Assembly Instruction Set document - plus bugs section — Parallax Forums

P2 (2015) Assembly Instruction Set document - plus bugs section

Peter JakackiPeter Jakacki Posts: 10,193
edited 2015-10-08 08:03 in Propeller 2
Since we really only have a list of instructions without any descriptions we have to scour the myriad of P2 posts for information and then we have to filter out what is current as well. I've been adding a few bits of information to a document which has the instruction set and any other information such as memory maps etc that are necessary for writing assembly code for the P2.

Anyone can edit this P2 2015 Assembly Instruction Set document, please.

edit: here is a link for the published (view only) document version

So even just comments will help and any pearls of wisdom gleaned from the forum. Later on this can all be reformatted nice and neatly but otherwise it would be a good repository and reference.

Comments

  • Also, don't forget the one that Chip started (and will hopefully continue) working on:

    https://docs.google.com/document/d/10qQn_-B7avY2ce0N1MDDdzOF1lACPNWUJkjHFyzITiY/edit

    Or maybe he'll abandon that one and work on the same one we are. :)
  • Yeah, I haven't seen any updates for some time and there is hardly anything there about the instructions, not even a list. Since I had to paste these little pearls somewhere then why not make it open. If we already have the information and all we have to do is gather together in one place then this means Chip can concentrate on the design. Any information we can't find I'm sure Chip will answer. So this way it's a win-win.
  • I've added an extra section at the end of the document covering possible bugs as I had trouble with the subx instruction. Also where possible I will include links to more information such as forum discussions etc.

    Please everyone, don't be shy about contributing. There's a wealth of knowledge out there and I'm still scratching my head about some of these instructions which might only take you 5 minutes to comment on in the document. You don't have to worry about formatting or anything fancy, just pure raw information and links.
  • Cluso99Cluso99 Posts: 18,066
    Excellent work Peter.
    Updated the cog registers and hub addresses and the internal stack info as per my understanding.
  • MJBMJB Posts: 1,235
    I merged Chip's document in -
    maybe an incentive to keep all in one document.
  • cgraceycgracey Posts: 14,133
    Seairth wrote: »
    Also, don't forget the one that Chip started (and will hopefully continue) working on:

    https://docs.google.com/document/d/10qQn_-B7avY2ce0N1MDDdzOF1lACPNWUJkjHFyzITiY/edit

    Or maybe he'll abandon that one and work on the same one we are. :)
    I haven't forgotten, at all. I've been tied up making Verilog changes, still.

  • evanhevanh Posts: 15,126
    We'll have a limb each before it's done. ;)
  • Ha! Anytime we want Chip at a gathering, we all just bring our piece! (morbid, I know, but it's been a long few weeks for me. Play time!)

  • cgraceycgracey Posts: 14,133
    Nice work, Peter!

    Have you found any bugs in any of the math operators? I remember you saying something about SUBX not working correctly.
  • cgracey wrote: »
    Nice work, Peter!

    Have you found any bugs in any of the math operators? I remember you saying something about SUBX not working correctly.
    Thanks Chip, I didn't want to duplicate anything you might be doing, just trying to get a handle on the instruction set etc. But it's like a construction site, bits and pieces all over the place at the moment, waiting to be moved and assembled.

    Now that Tachyon is starting to work again I will finish off that part of it and implement the inline assembler so then it will be easy to test out sections of assembly code. Then get back to confirming operation of these instruction but definitely the subx didn't like the source and dest being the same perhaps or whatever. Either way it doesn't work like P1 but of course I should check again with all the new updates, shouldn't I.

  • cgraceycgracey Posts: 14,133
    cgracey wrote: »
    Nice work, Peter!

    Have you found any bugs in any of the math operators? I remember you saying something about SUBX not working correctly.
    Thanks Chip, I didn't want to duplicate anything you might be doing, just trying to get a handle on the instruction set etc. But it's like a construction site, bits and pieces all over the place at the moment, waiting to be moved and assembled.

    Now that Tachyon is starting to work again I will finish off that part of it and implement the inline assembler so then it will be easy to test out sections of assembly code. Then get back to confirming operation of these instruction but definitely the subx didn't like the source and dest being the same perhaps or whatever. Either way it doesn't work like P1 but of course I should check again with all the new updates, shouldn't I.

    That's great that Tachyon is usable as a test bed for everything else.

    I'll look into SUBX tonight.

    Thank you, and thanks to the others for all their help.
  • Taking note of the many lengthy discussions in the P2 forum I can't help but wonder what can be achieved if that same time and energy were applied to documentation itself. Imagine all those threads that you may have been part of in the past and all that knowledge you have on an instruction and even why it was devised. Opinions are one thing and this is a forum after all, but aren't we more than just a forum of opinions?

    I'd like to think that we have a bond, a common interest in the Propeller development, but for that to flourish we need to balance our time and energy between discussions and between doing. At the moment there is a great need for us to have better documentation so we can get to doing more with the P2 but the documentation is a big "doing" that needs to be done first. Who's "gunna" do it? Somebody else? To paraphrase a quote:

    Documenting the P2 is an important job and everybody is confident that somebody will do it.
    Of course, anybody can do it, but nobody does it. Somebody might get upset that nobody does it because it is a job everybody can do.
    Everybody thinks that anybody can do it, but nobody realizes that everybody is busy instead discussing what to do.
    Will it end up that everybody finds somebody to blame when nobody does what anybody could do?

    While Chip is busy doing what he can and what we can't we are not "nobodies", we are somebody that knows something and can do something and if we all accept that and pitch in then we will achieve amazing things and everybody will benefit.

  • rjo__rjo__ Posts: 2,114
    that's a bump


    We need rising threads around here... if we can sink threads we should be able to raise them:)
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-10-23 05:37
    This document has been updated, here is the pubdoc version. I have added a link to a new opcode testing document to which I am adding my observations while testing opcodes and examining the results. This is being done interactively with my new inline assembler written in Tachyon Forth on the P2. A sample is shown below:

    INCMOD
    Increment the destination and wrap after source is passed
    dest = (dest+1)//(source+1)
    If a modulus 10 is required then set the source to 9
    TF2# asm
     02.0000 F783.1D8F   incmod 1st , 2nd
     02.0004 FD60.002D   ret
     02.0008             end ok
    TF2# 9 -1 12 execs
     0002 [ 0000.0000  0000.01A5  0000.0009  FFFF.FFFF ]TOP
     0002 [ 0000.0000  0000.01A5  0000.0009  0000.0000 ]TOP
     0002 [ 0000.0000  0000.01A5  0000.0009  0000.0001 ]TOP
     0002 [ 0000.0000  0000.01A5  0000.0009  0000.0002 ]TOP
     0002 [ 0000.0000  0000.01A5  0000.0009  0000.0003 ]TOP
     0002 [ 0000.0000  0000.01A5  0000.0009  0000.0004 ]TOP
     0002 [ 0000.0000  0000.01A5  0000.0009  0000.0005 ]TOP
     0002 [ 0000.0000  0000.01A5  0000.0009  0000.0006 ]TOP
     0002 [ 0000.0000  0000.01A5  0000.0009  0000.0007 ]TOP
     0002 [ 0000.0000  0000.01A5  0000.0009  0000.0008 ]TOP
     0002 [ 0000.0000  0000.01A5  0000.0009  0000.0009 ]TOP
     0002 [ 0000.0000  0000.01A5  0000.0009  0000.0000 ]TOP
     0002 [ 0000.0000  0000.01A5  0000.0009  0000.0001 ]TOP  ok
    TF2#
    
    edit: replaced with newer stack list to one corresponding with stack notation where the top item is the rightmost

    The assembler is invoked from the serial terminal and I enter two instructions in raw format (haven't added a preprocessor yet) which is assembled and listing. I can then enter two parameters 8 and -1 which are the 2nd and 1st parameters respectively and run that code 10 times with the stack listing each time plus the initial stack.
  • ozpropdevozpropdev Posts: 2,791
    edited 2015-10-22 09:08
    @Peter
    Be aware that if the dest. value is greater than the source value, INCMOD does not rollover to zero.

    Edit: See more discussion here including Chip's comments.
    http://forums.parallax.com/discussion/comment/1249697/#Comment_1249697
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-10-22 11:00
    ozpropdev wrote: »
    @Peter
    Be aware that if the dest. value is greater than the source value, INCMOD does not rollover to zero.

    Confirmed, but the document stands as "my observations", not as a final answer, but to gain some insight and help document the the operations. A bit like a playground in a way.
    TF2# asm
     02.0000 F783.2191   incmod 1st , 2nd
     02.0004 FD60.002D   ret
     02.0008             end ok
    TF2# 9 7 exec  0002 [0000.0008 0000.0009 0000.01A5 0000.01A5 ]  ok
    TF2# exec  0002 [0000.0009 0000.0009 0000.01A5 0000.01A5 ]  ok
    TF2# exec  0002 [0000.0000 0000.0009 0000.01A5 0000.01A5 ]  ok
    TF2# DROP 11 exec  0002 [0000.000C 0000.0009 0000.01A5 0000.01A5 ]  ok
    TF2# exec  0002 [0000.000D 0000.0009 0000.01A5 0000.01A5 ]  ok
    TF2# exec  0002 [0000.000E 0000.0009 0000.01A5 0000.01A5 ]  ok
    
  • evanhevanh Posts: 15,126
    edited 2015-10-22 11:34
    [deleted]
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-10-28 05:58
    We could still use some basic instruction descriptions but I am starting to give each instruction it's own color coded bit-field table a bit like the old P2 document. We shall see how that goes.

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-10-28 14:25
    Thanks again, Peter J. Tachyon on P2 rocks at getting this stuff available early, and allowing users verify it all is what it is.

    Your desire to document the P2 is very generous.
  • Thanks again, Peter J. Tachyon on P2 rocks at getting this stuff available early, and allowing users verify it all is what it is.

    Your desire to document the P2 is very generous.

    Thanks Loopy, but now I feel like I'm "flundering" with all that I've taken on! A week ago I was all set to tack on SD FAT32 and then move on to the network servers, and now look, my "desire" to document the P2 is a rod for my own back but "somebody" has got to do it.

    As for Tachyon I realize now that I have made it incompatible with the DE0 as the DE0 doesn't have Cordic and the job would so much easier if PNut had some IFDEFs etc to make it easier to build different versions. But I will dig out my DE0 and make sure I get the latest version of Tachyon to run on it.

    If I can get on with actually writing code rather then documenting I will have a fully self-hosting system up soon and even have VGA even if it has to be bit-bashed.
  • As for Tachyon I realize now that I have made it incompatible with the DE0 as the DE0 doesn't have Cordic and the job would so much easier if PNut had some IFDEFs etc to make it easier to build different versions. But I will dig out my DE0 and make sure I get the latest version of Tachyon to run on it.

    Can't you do the IFDEFs in Tachyon? Include non-CORDIC versions of everything, and then at boot test if the CORDIC works, and if it doesn't then change any words that use the CORDIC to point to the non-CORDIC versions of the functions.

  • rjo__rjo__ Posts: 2,114
    I use your documentation all the time. And this seemed like a good time to bump the thread.

    While I'm at it... there is a section in the cordic documentation that is missing ... regarding rotating a point. I haven't been able to figure it out:)
  • Yeah, when I need a brain break from software I format up a few more instructions until my head goes numb then I switch back and Forth (pun). Bit by bit it gets done. Mostly it's a lonely job.

    Here is a pdf of the latest version.
  • rjo__rjo__ Posts: 2,114
    Thanks Peter
  • Okay, I've gone through Chip's latest changes and updated the document accordingly but I still can't find information on a lot of the newer instructions and I still need to go through and check all opcodes. I might reorder them in the same way Chip has it in his document to help with making changes but somehow tag them or create an extra field for the instruction class so that we can sort them back into their groups later on.
Sign In or Register to comment.