![]() |
.. (לתיקייה המכילה) | |
I would like to do <a thing> using an assembly command I found in the mips manual. Can I? Should I? | |
Can you? Yes. However, note that the list of commands at the beginning of the exercise is a match for all the IR commands you learned in class, plus lw and sw that write and read from the stack, and that you don't need more in order to solve the homework. If you're looking outside this list and, at most "syscall", you're probably making your life difficult in some way. |
I would like to do <a thing> which would create more optimized assembly code in case of <a scenario>. Can I do that? | |
NO. STOP. STEP AWAY FROM THE OPTIMIZATION. DO NOT DO THIS. YOU'RE JUST MAKING THINGS HARD FOR YOURSELF. Produce naive code. Naive code is enough. |
How do I work with spim and qtspim? | |
spim is a linux executable which runs a mips program, and QtSpim is a debugger which you can install for windows, linux or mac. Here are a few pointers for using them. 1. spim.zip needs to be unzipped in your csl2 account, and you will then have access to spim (the simulator you will be tested with). 2. qtspim likes files with a *.s extension. 3. qtspim can set breakpoints in your code. 4. You can always debug with printouts using the syscalls (see the impl of print and printi in the pdf). 5. Both of these only run a "full" assembly program. What does this mean for you? That initially, when all you can handle is, say, basic arithmetic, you will need to wrap that code in a program - an entry point and an exit point. You can take the "wrapper" from either spim's hello world or qtspim's hello world. Until such time as you generate this code yourself, you can take your code and paste it into an existing main, and then run. |
What is the associativity of logical operators (and, or)? | |
Left associativity. |
How should I recycle registers for a function call? Can we have more than 15 parameters for a function? | |
During a function call, you can dedicate one register per argument, which will be later written to the stack. Following this instruction, no expression will require more than 15 registers at once. In particular, there won't be any function with more than 15 parameters . |
What should we do with the outputs from the previous assigment? | |
Remove the printing of the scopes. The output should be valid assembly code, which will be run by spim directly. You can leave the printing of errors. The tested code will not contain any lexical or semantic errors, so assuming your implementation of HW3 is correct, this won't make a difference. |