Strange behavior in hubexec mode
Dave Hein
Posts: 6,347
in Propeller 2
I'm getting some inconsistent behavior with a program running in hubexec mode. When I add code to the program, or even just add a data buffer between two routines it starts to produce unexpected results. I checked the logic of my program, and it looks OK, but it's possible I have a bug in it. However, I found that if I add two NOPs after each CALL, JMP and RET the weirdness goes away. I wonder if there is something that gets out of sync for a few cycles when the streamer is restarted after a CALL/JMP/RET instruction. Has anybody else seen a problem like this?
I would post the code, but it's about 1000 lines of assembly. I haven't been able to reduce the program down to a few lines of code that still shows the problem. I'll keep playing with it to see if I can zero in on the specific instructions that are showing the problem.
I would post the code, but it's about 1000 lines of assembly. I haven't been able to reduce the program down to a few lines of code that still shows the problem. I'll keep playing with it to see if I can zero in on the specific instructions that are showing the problem.
Comments
I haven't seen behaviour like that.
I did however have a similar issue with P2-Hot that required inserting a NOP to fix a task glitch.
If you sweep that empty block in size, does the problem come/go matching the eggbeater modulus ?
I think the affect of adding NOPs just moved code around in address space. I found that if I added lots of NOPs it could make the problem reappear, just like adding longs between routines.
I'm currently updating spinsim with the latest instruction changes, and I'm going to try running my program under it. If I don't see any strangeness under spinsim this would indicate there might be something wrong with the FPGA. If I do see the same thing under spinsim then the problem is in my code. If so, I will be able to debug it easier under spinsim than with the FPGA.
If you could come up with some simplified example that can be made to work or fail with the addition or subtraction of NOPs, that would get me right to where I can diagnose it.
As I was updating spinsim I ran into a problem with synchronization between the filling of the streaming FIFO and fetching code from it to be executed. It had something to do with both pieces of logic properly waiting for the correct eggbeater cycles. Maybe the FPGA has a similar problem.
I'll try running with the latest version of the FPGA to see if the problem persists. If the problem is still there I'll try to reduce my program to the minimum amount of code that shows the problem.
Dave, that would be great. I'm really anxious to fix any problem with hub exec.
Here is my modified test harness with very nearly a pattern of inserting longs and the error comes and goes. Eleven good ones and five with error messages. 11 + 5 = 16 Hmmmm. Good binary number, that
So you can reproduce this with the file attached. I use a DE0-Nano without add-on board, a Prop-Plug and Parallax Serial Terminal with all the preference tab special characters on, as I use a little cursor addressing
To find the code you need to go to xyzzy, it's a label and there are some comments. It's fine without any longs there, then the five-ish error ones, then eleven good.
I hope this helps. The routine where this is detected has been invoked via a calla / reta pair and it is always when the function returns the answer, so whether something gets mucked up on the call or on the ret or inbetween I'm not sure.
Of course, it could be my software...but even if it's the verilog, I'll still love you.
*** EDITED TO ADD ***
I forgot to say, it's 115,200 Baud and you need to hit Enter to kick it off - helps to have a wide screen, about 30-ish lines and clear the screen when you enable it. I'll add this last paragraph to my previous message
and I will also continue adding extra longs to see if this is a definite repeat. Oh, and monitor the forum.
I forgot to say, it's 115,200 Baud and you need to hit Enter to kick it off - helps to have a wide screen, about 30-ish lines and clear the screen when you enable it. I'll add this last paragraph to my previous message
and I will also continue adding extra longs to see if this is a definite repeat. Oh, and monitor the forum.
I have done just over another two cycles of 16 longs, the pattern is 11 good ones, 1 with some errors, 3 with a lot of errors, 1 with some errors, and then the cycle repeats.
You're using a DE0-Nano, right?
One thing I did that I never tested was to have the FIFO consider itself full 8 longs earlier on hub exec mode than during normal data mode, since hub exec eats data no faster than 1 long per two clocks. Perhaps, I need to up it by one.
If I made a DE0-Nano file without the early FIFO-full signal, could you see if it fixes the problem?
Yes DE0-Nano without the add-on board, I'll happily check for you, and PM if you want to do any of this by phone, not a problem.
Is Dave H using DE0-Nano?
Loading now...
Will not Hubexec start loosing sync with next Fifo reload if we use RDLUT instructions?
No. That FIFO interface doesn't care what goes on.
I think it may be having a problem in hub exec mode, though, because I had it sense 'full' at 8 longs, instead of the normal 16, while the timing is a little advanced in hub exec because the first instruction is fetched right away. I changed the 'full' sensor to 9 longs now, so that 78rpm can see if it fixes the problem.
The group of 5 error longs has reduced by 1 and that good one is the first of the what were the 5 errors.
Previously for the 5 errors we had 1 okish, 3 bad, 1okish
Now we have 4, 1okish, 2 bad, 1 okish
So whatever you did is along the right tracks, but not quite there.
International Rescue thanks you for your custom and we now lay claim to Gracey Island.
Ok, I'll woof up another file where there is no reduction in the 'full' sensor, so we can see if that completely fixes the problem. A little voice was telling me that this might not have been a good idea when I was implementing it.
Stand by...
Post when ready, I'll put the kettle on... I think I've got RSI typying
And have a little stroll around the kitchen.
I have it loaded. Off we go, round 2...
Thank you, I enjoyed that interaction. It looks like I won't be needing that FINDBUG instruction now. Perhaps you could reallocate for Peter's jmplnk!
I have a large supply of commas and zeroes should you need some.
Whew! What a relief. Thank you for testing that. I had to go play a game of solitaire to get past the waiting.
I will make this change permanent now and may make an interim new set of files for the four target boards.