Is there a simulator available for the Propeller?
sstandfast
Posts: 39
Hello,
Well it has happened, I have finally written a program that is complex enough I can't debug it without being able to "see" what is going on.· Not that it was too terribly difficult to do since I've only been playing with the Propeller off and on now for just under a month.· I am just now starting to get·a feel for the chip although I must say it is a much bigger leap from the PICMicro's than I first thought it was going to be.· One tool that would be of great assistance would be a simulator.· I have found pPropellerSim by Ale but I haven't quite got the hang of it yet and it appears to only be capable of supporting one cog.··Add to it the fact that it can only shows variables as their physical addresses with no ability to map which variable is which from code at compile time makes it very difficult to use.· Especially for someone who is still trying to figure out the in's and out's of the Propeller.
I know I'm asking alot, but it would be really nice to have a debugging toolset similar MPLAB SIM for the PICmicro's.· Something that you can have your code open in one window with a register map in a second window and the ability to step through your code line by line and watch how the registers change.· Perhaps as I get more experience with the Propeller I won't need a simulator anymore but for right now, it would be a big help.
In the mean time, I suppose I could start a second thread and post the code that doesn't quite work as expected and see if anyone can help me.
Thanks for putting up with my rantings.
Shawn
Well it has happened, I have finally written a program that is complex enough I can't debug it without being able to "see" what is going on.· Not that it was too terribly difficult to do since I've only been playing with the Propeller off and on now for just under a month.· I am just now starting to get·a feel for the chip although I must say it is a much bigger leap from the PICMicro's than I first thought it was going to be.· One tool that would be of great assistance would be a simulator.· I have found pPropellerSim by Ale but I haven't quite got the hang of it yet and it appears to only be capable of supporting one cog.··Add to it the fact that it can only shows variables as their physical addresses with no ability to map which variable is which from code at compile time makes it very difficult to use.· Especially for someone who is still trying to figure out the in's and out's of the Propeller.
I know I'm asking alot, but it would be really nice to have a debugging toolset similar MPLAB SIM for the PICmicro's.· Something that you can have your code open in one window with a register map in a second window and the ability to step through your code line by line and watch how the registers change.· Perhaps as I get more experience with the Propeller I won't need a simulator anymore but for right now, it would be a big help.
In the mean time, I suppose I could start a second thread and post the code that doesn't quite work as expected and see if anyone can help me.
Thanks for putting up with my rantings.
Shawn
Comments
PASD can do this, but you can debug only 1 cog at a time (and only Assembly), but it is a realtime emulator, not a simulator:
www.insonix.ch/propeller/prop_pasd.html.
And then there is another simulator, called GEAR. Search for it with 'search.parallax.com'.
Andy
Shawn
http://forums.parallax.com/showthread.php?p=701256
I have found pPropellerSim by Ale but I haven't quite got the hang of it yet and it appears to only be capable of supporting one cog. Add to it the fact that it can only shows variables as their physical addresses with no ability to map which variable is which from code at compile time makes it very difficult to use. Especially for someone who is still trying to figure out the in's and out's of the Propeller.
If you use the built-in editor and compile your code using the built-in compiler you will have all your symbols loaded at the right positions. Can you explain what did not work for you and what you did ?. I always look for ways of improving it.
Thanks for that!· That does help at least decipher a little bit about what's going on.· But I am still having trouble with this simulator.· I am running an example program written by Mike Green that demonstrates indexing into a look-up table.· The code was found in the ASM tutorial "Sticky" on this forum.· Here is a link: http://forums.parallax.com/showthread.php?p=601870· The code is about 3/4 of the way down the page.· When I copied and pasted this code into pPropellerSim, at first I had a bear of a time getting it to compile.· I kept getting a "line 9: Too few arguments for directive(DAT)" error.· Removing the ORG 0 and moving the first line of assembly onto the same line as the DAT statement gave a slightly different error.· This time it said "Line 9: Argument(s) Missing".· It took probably 20 min. to figure out that the DAT directive was the problem.· It didn't need to be there.· Did I just miss that in the documentation somewhere?
Deleting the DAT statement and altering the symbol name from "test" to "testa" to avoid conflict with the instruction of the same name I was able to get a successful compilation! Yea!· However, when the code was run in the simulator the results were not what was expected.· Attached is a screen shot of the simulator and it's contents.· Line 0 is label testa and contains mov ptr,#2 as expected.· Line 1 is call #look, also as expected.· Label Look is located at $00C and contains jmp #testa.· So basically all this program does is jump to "Look" where instead of executing it's code, it simply returns immediately.· What I expected to see this code do is jump to·"Look" which would then retrieve the third element from the look-up table, store that into variable "data" and then branch to an infinate idle loop.· This is definately not what I am seeing.· The symbol "data" remains 0 and the actual table look-up portion of the code is never executed.· I'm not sure if this is a problem with the simulator, Mike's code, or I just don't know what I'm doing.· The answer is probably the last one so if either you or Mike would be willing to lend some advise I'd greatly appreciate it.
Thanks,
Shawn
What was the label "look_ret" is now being treated as "look" and the original "look" label is gone along
with other labels like "table" and "mask". I don't know how things got that way, but maybe you should
fix them. You can take the original program and stick an "x" in front of each label. For the labels starting
with ":", use an "x" instead for the ":", then try to use the simulator on the new version and see what
happens.
Thanks for the prompt reply.· Like I said earlier, all I did was copy and paste directly from your previous post.· The only changes I made were to remove the DAT ORG 0 line and add an "a" to label "test" so that the assembler did not confuse it with a command.· So I'm not sure how my code compiles so much differently than yours does.· Either I'm not doing something right or there is a problem somewhere else.
I tried adding the "x's" to the front of all the labels as you suggested but that only changed the label names.· It had no effect on the generated code.· Just to make sure we are all on the same page, here is the code I am trying to simulate using pPropellerSim.
This code moves #2 to ptr and then jumps to look_ret, which then immediately jumps back to testa.· For further clarification, here is the "x" modified code to make sure I understood you right Mike.
·Either version will produce the exact same results mentioned in my previous post.· Any thoughts?
Thanks for your help,
Shawn
P.S.· Mike, I am having a bit of a hard time understanding what exactally these lines are doing in your example.· Could you please clairify them for me?
Up to this point I follow what is going on.· You have added the offset or index to the base address of the look-up table.· You retrieved the base address of the look-up table by adding the "#" modifier to the symbol, which returned the address pointer and not the contents of table.· However, I am stumped by what the movs :inline, data does.· The way I understand it, you are·moving bits 0..8 of the 32-bit variable "data" to the first entry of :inline, which is another mov instruction.· This does what exactally?· Next, there is a NOP which the comments state is for pipelining?· My first thoughts was that it was to synchronize the COG with the HUB access window but there are no HUB statements in this code so that doesn't make sense.· Could you please explain what this "Pipelining" is that you speak of?· Also, do you think you could explain what the 0-0 is doing in this·code and why it couldn't have simply been :inline mov data,0.· Since the NR, WZ, WC effects are not specified it's not to toggle the Z or C flags.· Therefore, I am confused by this as well.
I appreciate any help you can provide.
Thanks,
Shawn
Just copy that in the PropTool press F10, then start PASD, set the right COM port, and press F2. Now you can single step thru the code, and watch the variables in the CogRAM viewer.
About ' movs :inline,data ':
this sets only the source field of the instruction at :inline to the value in data (bits 8..0). This field is set to 0-0 in the souce code, to indicate it will be modified. You can clearly see all the modifications with PASD.
Andy