reference implementation

COMP1521 – 22T3 Outline Timetable Forum Assignment 1 Assignment
A f W41 IV 11V.I.VUlt1V0 d%V.L.OnZo,v, 41 Yl – V
In the case of an invalid instruction. any output to stdout will be ignored. As long as the given error message is printed to stderr, you program is correct
The reference implementation uses sees to print invalid instruction codes. You will not be penalized if you implement extra MIPS instructions beyond the subset above and do not print an error message for them.
Execution halts with an error message if there is a system call which is not in this subset. You can assume overflow does not occur during arithmetic or other operations.
You can assume that division by zero should result in a quotient and a remainder of 0. You do not need to handle instructions that access memory such as LW or SW. You do not need to handle branch labels. 1521 mips2hex translates these into the relative offset which is part of the branch instruction code. You do not need to handle pseudo-instructions. 1521 mips2hex translates these into the appropriate real instructions. Eg. U is translated into ADDI. You do not need to handle the JR instruction. 1521 mips2hex deletes the last instruction if it is JR Any other occurences of JR would be invalid. The corresponding .hex files contains only real instructions in the assignment subset. For convenience mips2hex translates some pseudo-instructions and a few instructions outside the subset into instruction codes in the assignment subset This is mainly done to translate different types of branches into SLT plus BEQ or BNE The reference implementation will print error messages stderr. The provided code also uses stderr when appropriate. Any additional error messages you add should also print to stderr. Any messages that do not indicate an error should be printed to stdout. Your submitted code must be C only. You may call functions from the standard C library (e.g, functions from std10.h stdlib.h . string.h etc.) and the mathematics library ( nath.h ). You may use asserth You may not submit code in other languages. You may not use systen function, or other C functions to run external programs. You may not use functions from other libraries: in other words. you cannot use cicc’s -1 flag. Your program must not require extra compile options. It must compile with dcc •.c -o Masc and it will be run with dcc when marking. Run-time errors from illegal C will cause your code to fail automarking. If you need clarification on what you can and cannot use or do for this assignment ask in the class forum. If your program writes out debugging output it will fail automarking tests: make sure you disable debugging output before submission. You are required to submit intermediate versions of your assignment. See below for details.
Change Log
Version 1.0 12022 la 31 1203001 Version 1.1 12022 10 31 201)300)
Version 1.2 12022 11 01 1230001 Version 13 12022 11 02 0130130)
• Initial release
• (SPEC) Fix bit pattern for MFHI and MFLO. which had an extra 0 and were missing a a • (SPEC) Fix the semantics of DIV. HI is remainder and LO is quotient this was accidentally reversed • (REFERANCE) Fix the implementation of DIV. HI is remainder and LO is quotient this was accidentally reversed
• (SPEC) Add clarification that the program should halt when it tries to execute an invalid syscall
• (REFERANCE) Fix MULT incorrectly handling negative numbers
Aims The Assignment Reference implementation MITI Instruction Subset System Calls Registers Making Converting MIPS Assembler Instruction codes Examples Getting Started Assumptions and Clirificaeons Change Log Assessment