I spent too much time trying to find error on my code. I didn't find one. But it doesn't work.

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

I spent too much time trying to find error on my code. I didn't find one. But it doesn't work.

Mike2345
Didn't understand what I did wrong I implemented it but I still can't find what I did wrong I spent too much time trying everything but it is hard can I get some tips on how I should pass the test. I implemented the call,return, function each just as suggested. Besides the test has nothing to initialize is that normal? Somebody help me it's has been a while since I started trying....
Reply | Threaded
Open this post in threaded view
|

Re: I spent too much time trying to find error on my code. I didn't find one. But it doesn't work.

WBahn
Administrator
Mike2345 wrote
Didn't understand what I did wrong I implemented it but I still can't find what I did wrong I spent too much time trying everything but it is hard can I get some tips on how I should pass the test. I implemented the call,return, function each just as suggested. Besides the test has nothing to initialize is that normal? Somebody help me it's has been a while since I started trying....
You are giving use nothing to go on. Just telling us that it doesn't work doesn't help us figure out why it doesn't work.

Which tests have you passed? What is the first test that does not pass? What are the indications that it doesn't pass? What specific steps have you taken to determine why it doesn't pass?
Reply | Threaded
Open this post in threaded view
|

Re: I spent too much time trying to find error on my code. I didn't find one. But it doesn't work.

Mike2345
Sorry for insufficient information I provided. I passed the simple function and I got stuck in Fibonacci test. Besides the test doesn't set "sp" is it a problem not to set sp in the test script?.In addition,  I'm confused about the temporary variables I should use when implementing the "return". What should I use for storing the temporary frame and the temporary ret frame? I used @R13,@R14 it doesn't work and I also used temporary variables to store the values it doesn't work either. Is there any tips you give on how I can store the temporary variables.
Reply | Threaded
Open this post in threaded view
|

Re: I spent too much time trying to find error on my code. I didn't find one. But it doesn't work.

WBahn
Administrator
The Fibonacci test only tests program flow commands and should be done before you even attempt the SimpleFunction test (although these are pretty independent). Fibonacci is focused on array manipulation.

If you are talking about the FibonacciElement test that follows the SimpleFunction test, I'll offer the same tip that is in the Tips section of the text: "The last two programs assume that the startup code is already part of the VM implementation."

Is you VM translator translating both .vm files into a single .asm file?
Reply | Threaded
Open this post in threaded view
|

Re: I spent too much time trying to find error on my code. I didn't find one. But it doesn't work.

Mike2345
I implemented the VM Translator in Reactjs since it is a front end. It accepts a directory and combine any VM code within the directory  then change it to assembly code and print it in the browser I will copy the changed code from the brow6 and I will create a file with the name of the directory and I paste the copied code to the file.
Reply | Threaded
Open this post in threaded view
|

Re: I spent too much time trying to find error on my code. I didn't find one. But it doesn't work.

WBahn
Administrator
Sounds like a lot of manual work involved. But be that as it may, I don't see anything in your description about the bootstrap code. How are you handling that?
Reply | Threaded
Open this post in threaded view
|

Re: I spent too much time trying to find error on my code. I didn't find one. But it doesn't work.

Mike2345
I found it impossible to create file using react I will be using back-end for handling the manual work. What do you mean by bootstrap code?
Reply | Threaded
Open this post in threaded view
|

Re: I spent too much time trying to find error on my code. I didn't find one. But it doesn't work.

WBahn
Administrator
Mike2345 wrote
I found it impossible to create file using react I will be using back-end for handling the manual work. What do you mean by bootstrap code?
The bootstrap code that is described at the end of Section 8.3.2, where it states that, "the computer's bootstrap code should effect the following operations (in machine language): SP=256; call Sys.init".

The bootstrap code that is referenced in the section on the Test Programs for Function Calling Commands, where it states, "Recall that according to the VM Specification, the bootstrap code generated by the VM implementation must include a call to the Sys.init function."
Reply | Threaded
Open this post in threaded view
|

Re: I spent too much time trying to find error on my code. I didn't find one. But it doesn't work.

Mike2345
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: I spent too much time trying to find error on my code. I didn't find one. But it doesn't work.

WBahn
Administrator
Mike2345 wrote
I just implemented the function,call,return. I assumed that the CPU Emulator handles about the sys.init. this is the implementation I did.
Bad assumption.

The text tells you multiple times that it does not and that your translator is responsible for generating the bootstrap code.

The CPU Emulator emulates the CPU's behavior. It runs machine code (or, equivalently, assembly code) on the CPU. It knows absolutely nothing about virtual machines.

Reply | Threaded
Open this post in threaded view
|

Re: I spent too much time trying to find error on my code. I didn't find one. But it doesn't work.

Mike2345
Okay thanks. so how can I implement the bootstrap code?
Reply | Threaded
Open this post in threaded view
|

Re: I spent too much time trying to find error on my code. I didn't find one. But it doesn't work.

WBahn
Administrator
First thing is to read what the Bootstrap code does. It is spelled out in the text. Have you done that?

What, in your understanding, is the bootstrap code responsible for?

What is the assembly code that would accomplish each of the tasks the bootstrap code is responsible for?

Reply | Threaded
Open this post in threaded view
|

Re: I spent too much time trying to find error on my code. I didn't find one. But it doesn't work.

Mike2345
Thank you so much for your help. I implemented the bootstrap code and it worked.
Reply | Threaded
Open this post in threaded view
|

Re: I spent too much time trying to find error on my code. I didn't find one. But it doesn't work.

WBahn
Administrator
Great! So glad that it worked. Now on to the next adventure.