CO5570 Anonymous Questions and Answers |
This page lists the various questions and answers. To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers.
We have taken the liberty of making some minor typographical corrections to some of the questions as originally put. Although most of the questions here will have been submitted anonymously, this page also serves to answer some questions of general interest to those on the course.
Submission reference: IN3338
Do we need to add comments to explain our code?
I will only mark you on functionality, so don't add comments for marking purposes.
Keywords: assign3
Submission reference: IN3337
Hello, I'm trying to get my method to work for translating just opcodes and regs at the moment. I tried testing it by passing a test.mal file with ADD D, A. It should translate to 00101001, but instead translates to null01, so im not sure what part of my code im doing wrong for this to happen.
code deleted
You are not splitting on commas when there is more than one operand, so you never match one of the register names because it has a comma attached to it.
It would be worth putting some basic println debugging statements in for situations like this that you cannot understand. For instance:
System.err.println(Arrays.toString(segments));
Keywords: assign3
Submission reference: IN3335
Would you be able to create another tester so we can see if our output matches up with yours?
I am not sure what another file would do that the current one doesn't. There is an example of every instruction in the current one, so you could create your own variations on that and check them against the spec.
Keywords: assign3
Submission reference: IN3334
for the test file you put out
LOADN 127 LOADA 34 ADD D, A SUB A,D JMP 16 JGT A,4 JLT D,39 JEQ A,125 COPY A , D COPY D,A STORE 1when tested with my code my output was
0000000001111111 00011000000000 0010100100 0011011000 01001000000000 01010100000100 01101000100111 01110101111101 1000011000 1000100100 1001000000000001is this correct?
No, because all the lines should be exactly 8 bits long. I have provided the file of how the output should look.
Keywords: assign3
Submission reference: IN3333
As an example when I test my assembler with STORE 16 it should output 10010000 00010000 however my program outputs 100100010000 all on one line however its still the correct output is this allowed?
No. The output must be broken over two lines. Just output the two parts separately rather than joining them together.
Keywords: assign3
Submission reference: IN3331
Are there any .mal files we can use for testing?
I suggest that you create some of your own for now, but I will release some of mine shortly.
Keywords: assign3
Submission reference: IN3321
Hi, For submitting our solutions, should we create a .zip file containing ONLY the .java files? Not the .class files? In my case I've only 2 java files, "Main.java" and "Assembler.java"; what about cases where someone has other .java files? Will the "automatic testing harness" compile ALL .java files in the folder regardless of their names? Thank you.
Yes, just your .java files. The testing harness will compile all submitted .java files that are need to build the full program.
Keywords: assign3
Submission reference: IN3291
The command for the assignment (A3) is not working (java.nio.file.NoSuchFileException: prog.mal)
That means that you are either not passing prog.mal to the main method when you are running the program, or that the file does not exist in the working directory of the program when you are running the program.
If you are using an IDE to run the program then you will need to set up a program configuration that tells the IDE what program arguments to run the program with and where to run it (its working directory). It could be that you haven't done that.
Submission reference: IN6498
Sample question.
Sample answer.
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. |