Hub stack bug
ozpropdev
Posts: 2,792
in Propeller 2
I have discovered and issue with the PUSHA,PUSHB,POPA,POPB instrcutions
Data pushed to stack is masked to 8 bits.
Data popped from stack is invalid.
Test program output
Data pushed to stack is masked to 8 bits.
Data popped from stack is invalid.
Test program output
PTRA initial value 00008000 Data "pushed" onto hub stack FEEDFACE 00C0FFEE PTRA value after 2 "pushes" 00008008 Hub contents PTRA[-2] to PTRA[2] 000000CE 000000EE 00000000 00000000 00000000 "popped" values from hub stack 00000000 00000000
Comments
Thanks for noticing this. This looks like just an assembler problem. I forgot to change the offsets from 4 to 1 when I went back to scaled PTRx offsets. There was also some op-code problem, since I last moved the RDxxxx/WRxxxx instructions around. These PUSHA/PUSHB/POPA/POPB instructions exist in a little table of their own, since they are aliases to the main instructions, so they're often getting orphaned when I make changes.
In the file below is a new PNut.exe. You'll need to rename from PNut.txt to PNut.exe:
Can you please see if this solves the problem?
My code doesn't start now?
Even this code doesn't work
I'm sorry. I think the problem is that the assembler has changed in other ways to accommodate some things in the new FPGA release that I'm about to post. It should be ready in about 1/2 hour.
I posted a link to the new files at the start of the 'Prop2 FPGA files!!!" thread.
Loaded new image and new Pnut.
Modified code for syntax changes.
All looking good at this end.
Cheers
Brian
Super!
Do the PUSHA/PUSHB/POPA/POPB instructions work correctly now?
I could have tested them here, but it seemed there was a 99% chance that the assembler had just been not up-to-date on their encodings in the first release.
Stack stuff is looking good. Test results return correct values.
Thanks!
Yes, it's outputting to serial (@115200). Check out @ozpropdev's attachment. He's got a few lines of setup and two helper procedures. That's it!
(note: with Chip's latest FPGA change, the code will not work. before you use it for your own tests, make sure to fix the "rep" code.)