3.5 MIC-1 Microcode Extension
In MIC-1 microcode, write a new MIC-1 assembly interpreter that supports three additional instructions and changes the HALT instruction.
In C, modify the MIC-1 assembler to produce MIC-1 object files for this modified instruction set.
MULT - 1111111 1 00 mmmmmm - multiply the signed value at the top of the stack by the 6-bit immediate unsigned value mmmmmm. The result of the multiplication should replace the value at the top of the stack, provided that no overflow occurred. If the multiplication would overflow a 16-bit result, the top of the stack must not be changed. After the operation, the accumulator must be set to 0 if the multiplication succeeded, and -1 if an overflow occurred.
RSHIFT - 1111111 1 01 ??ssss - right shift the current signed accumulator by the 4-bit immediate unsigned value ssss. This is a zero-fill operation. The ?? bits are ignored.
DIV - 1111111 1 10 ?????? - divide the 16-bit signed number at the top stack location (SP) by the 16-bit signed number at the location just under the top stack location (SP+1) and push on two new locations the signed remainder and signed quotient. The remainder should be at SP-1 and the quotient should be at SP-2. If the divisor is equal to 0, the remainder should be set to -1 and the quotient should be set to 0. After the operation, the accumulator must be set to 0 if the division was legal, and -1 if an attempt to divide by 0. Legal divisions should satisfy the equations dividend = divisor * quotient + remainder, abs(remainder) < abs(divisor), and sign(remainder) = sign(dividend). The ?????? bits are ignored.
HALT - 1111111 1 11 ?????? - halt the processor. The ?????? bits are ignored.
There are three example assembly programs that use these new instructions. You will need to use these as tests. The links are as follows: a4_div_test.asm, a4_mult_test.asm, and a4_rshift_test.asm.
A README file that contains a short write-up of your project. It should discuss the approach you took to solving the problem, it should discuss any problems or issues that still remain, it should discuss any interesting things that you learned in the course of the project. Finally, it should provide the grade you believe the project deserves with a detailed explanation of why. This explanation should almost certainly focus on why you believe the program is correct.
This file must be in plain-text. If you need formatting, use Markdown. It must be limited to 80 characters wide, unless you are quoting program output.
Your microcode source, named rmd.mc.
Your compiled microcode, named rmd.prom.
Your modified masm source directory that starts as a copy of the online version and contains the same number of files, with the same names, but with different contents that you write to support the new instructions.
Three test input files, named div.in, mult.in, and rshift.in, that contains debugger input to the three test assembly programs to show that your microcode is implemented correctly.
Three test output files, named div.out, mult.out, and rshift.out, that contains the expected output for the test input files.
A Makefile that builds the modified microcode, builds the modified assembler, builds the test object files, and then tests them by running them with the corresponding .in files as input and compares the actual output to corresponding .out files. You may assume that the mcc and mic1 binaries are in the PATH.
This assignment will be graded based on its correctness and your ability to articulate why it is correct.