NestedCall, FibonacciElement, StaticsTest Fail -but in different ways

classic Classic list List threaded Threaded
4 messages Options
l
Reply | Threaded
Open this post in threaded view
|

NestedCall, FibonacciElement, StaticsTest Fail -but in different ways

l

Here my problem:
-SimpleFunction=PASS
-NestedCall=FAIL
-FibonacciElement=FAIL
-StaticsTest=FAIL 

NestedCall (Correct Output)
| RAM[0] | RAM[1] | RAM[2] | RAM[3] | RAM[4] | RAM[5] | RAM[6] |
|    261    |    261    |    256    |   4000   |   5000    |    135    |    246    |

NestedCall (My Output)
| RAM[0] | RAM[1] | RAM[2] | RAM[3] | RAM[4] | RAM[5] | RAM[6] |
|       261 |       261 |       256 |     4000 |      5000 |          0 |       246 |

FibonacciElement(Correct Output)
| RAM[0] |RAM[261]|
|    262    |      3 |

FibonacciElement(My Output)
| RAM[0] |RAM[261]|
|    257    |      0 |

FibonacciElement(My Output- with modified RAM location)
| RAM[0]    |RAM[256]|
|    257    |      3 |

StaticsTest(Correct Output)
| RAM[0] |RAM[261]|RAM[262]|
|    263 |              -2 |            8 |

StaticsTest(My Output)
| RAM[0] |RAM[261]|RAM[262]|
|    258    |               0 |            8 |

StaticsTest(My Output modified memory position)
| RAM[0]  |RAM[256]|RAM[257]|
|    258 |              -2 |            8 |


So when looking at my results it seems like I have a stack pointer skew .. I am not sure why it didn't show up in

NestedCall - The only issue was in the temp section RAM[5] and I overwrite the section all the time for many different operations.. I didn't think that it was important because I was was under the impression that the temp section was undefined. I am not sure that it matters but maybe it is an indication of why I am having issues in another files. Also, my other final results match Nestedcall Stack Diagram.NestedCall.asm

FibonacciElement & StaticsTest:
The only thing that I can think of is that it is some kind of stack skew that I am not understanding.  I have made a lot of unnecessary changes in the code, done a lot of print statement and in the end the sum total of my efforts have brought me to this this forum. begging for help .
FibonacciElement.asm
StaticsTest.asm 

I have uploaded the files.
Please let me know if I can send anything to help the debugging process. Any assistance is appreciated.
 
Reply | Threaded
Open this post in threaded view
|

Re: NestedCall, FibonacciElement, StaticsTest Fail -but in different ways

cadet1620
Administrator
Your generated code must not use temp 0-7 (RAM[5-12]). The 'temp' segment is for VM programs like those generated by the compiler. Your generated code can use RAM[13,14,15] for anythng that it needs to.

The most likely reason for your SP to be off by 5 is that you are jumping to Sys.init instead of doing a VM "call Sys.init 1" command.

No guesses about StaticsTest.

Hint: your code will be easier to debug if you write the input VM commands to the output as ASM comments.
l
Reply | Threaded
Open this post in threaded view
|

Re: NestedCall, FibonacciElement, StaticsTest Fail -but in different ways

l
Yo Cadet,
Thanks so much for the rapid and thoughtful response. I really appreciate you taking your precious time and analyzing my situation maybe one day I can do the same for someone else.
cadet1620 wrote
Your generated code must not use temp 0-7 (RAM[5-12]). The 'temp' segment is for VM programs like those generated by the compiler. Your generated code can use RAM[13,14,15] for anythng that it needs to.
Wow.. I really didn't pay attention to that part.. Well will start on those changes tomorrow
cadet1620 wrote
No guesses about StaticsTest.
-Ha that makes 2 of us

cadet1620 wrote
Hint: your code will be easier to debug if you write the input VM commands to the output as ASM comments.
- I was doing that in Project 7 . But in Project 8 I think my pride and ego got in the way. I assume I should have let go of the pride instead of all the sleep I missed out on

cadet1620 wrote
The most likely reason for your SP to be off by 5 is that you are jumping to Sys.init instead of doing a VM "call Sys.init 1" command.
Well seems like another detail that just didn't click for me. But I was thinking that it could be something like this instead of me just forgetting to push or pop correctly.

Once again thanks for the assistance and rapid response. Changes will be implemented tomorrow and I will let you know what's crackin'
l
Reply | Threaded
Open this post in threaded view
|

Re: NestedCall, FibonacciElement, StaticsTest Fail -but in different ways

l
In reply to this post by cadet1620
Hey Cadet

Your words of wisdom resolved my issues. All test are passing. Let me know if I can add anything else useful to the post to make this thread more useful to anyone else .. Such as closing summary or anything else like that.

Now on to project 9