P2 Instruction Verification
Dave Hein
Posts: 6,347
in Propeller 2
A while ago I wrote some programs that I use to verify that the instructions that I implemented in spinsim match the FPGA. Since I don't have a P2 yet, I was hoping that Chip, Peter or someone else that has a P2 could run the programs on their P2. The attached zipfile contains the program source in C along with P2 executable binary files and the text output from the FPGA. It also contains loadp2.exe, which is a Windows command-line program that loads binary files to the P2. I also include the loadp2_src directory that contains the source for loadp2 so it can be built for other platforms, such as Mac, Linux or Cygwin.
A program is loaded as follows:
loadp2 -t -f 80000000 -m ff -b 115200 testopsa.bin
The -t option causes the terminal emulator to run, -f sets the system clock frequency, -m sets the clock mode, and -b sets the baud rate. If the clock rate is changed from 80MHz the baud rate should be changed proportionately. For 160MHz the baud rate should be 230400.
Could someone please run the 5 binary files and save the outputs to text files, and then post the resulting output files. The output is saved by redirecting the output to a file. I watch the serial activity LED on the PropPlug to determine when the program is complete, and then hit the ESCAPE key to exit loadp2.
A program is loaded as follows:
loadp2 -t -f 80000000 -m ff -b 115200 testopsa.bin
The -t option causes the terminal emulator to run, -f sets the system clock frequency, -m sets the clock mode, and -b sets the baud rate. If the clock rate is changed from 80MHz the baud rate should be changed proportionately. For 160MHz the baud rate should be 230400.
Could someone please run the 5 binary files and save the outputs to text files, and then post the resulting output files. The output is saved by redirecting the output to a file. I watch the serial activity LED on the PropPlug to determine when the program is complete, and then hit the ESCAPE key to exit loadp2.
zip
271K
Comments
Here's an example:
https://zipcpu.com/zipcpu/2017/07/26/cpu-sim-debugger.html
Thanks for making these tests!!!!
Dave, here are the dump files:
The ALTx instructions which try to add a negatve number to D don't work, because S[17:9] doesn't get sign-extended, as it should.
That is fantastic that everything else seems to be okay. I am really relieved that you got such a test together. Now I have confidence and a lot of little things I haven't had time to check, exactly. Everything is looking pretty good, so far.
I've had a few instances where I thought I ruined the chip, but it was just my setup and programming issues. The chip is still running just fine.
I ran it in spinsim with -p and I saw output. When I tried to run it with verbosity or have it list executed instructions I see vast numbers of waitx 7
What am I missing?
Dave, I looked at the .diff file, but it doesn't make any sense to me.
The failure of the ALTx instructions (excepting ALTI) is that S[17:9] is not sign-extended before getting added into D. Is there any way you could verify that that is, indeed, what is causing the error?
Have run those instructions which are in P1 on the P1? It would be nice to know what instructions have different C and Z results for the tips and traps thread.
I'll look into it.
What I should probably do is run the image through a disassembler.
btw - I tried to send you ( @"Dave Hein" ) but as I don't seem to be able to see an outbox or sent items in the forum I'm not sure if you got it or whether my browser ate it.
spinsim -t -v3 -80000300 testopsa.bin
This will tell spinsim to run 80 million + 300 cycles. spinsim runs about one-tenth real-time speed on my PC, so the waitx takes about 10 seconds instead of 1 second.
The p2gcc project contains a disassembler in the p2dump utility. You would run it by typing
p2dump -data -dis -hub 400 testopsa.bin
I didn't receive a PM from you. I'll send you a PM, and you should see the envelope in the upper left of the screen indicate that you have a message.
I think we can trust the PM functionality enough now - I wrote a much shorter version of my original PM.
Thanks,
Red
I'm supposed to get my P2 board on the 28th, and I'll test out the p2gcc code at the time. I'll probably make some changes to the serial driver so the baud rate will be independent of the chip frequency.
Why does a downloader need frequency ? Is it a two stage loader, that changes the SysCLK from RCFAST ? (but then it needs to know more than just frequency)
There was a python P2 loader around somewhere too ?
Cheers,
Jesse
EDIT: Moved irrelevant comments to the referenced thread.
Yes, loadp2 is a two stage loader. One reason I do this so that I can load into a location other than zero. Because of this, loadp2 needs to know the frequency and mode to initialize the P2. Currently, loadp2 is setup for the FPGA P2 running at 80MHz. I'll add another setup for the P2 Eval board, and there are also the custom settings using the -f and -m options.