Design a new ALU for MARIE that supports multiplication.
Design a instruction to perform multiplication. Describe it.
Give RTN notation to accomplish the multiply
Show any modifications necessary to the state chart to
accomplish this multiply instruction.
Describe how this instruction will impact the performance of the chip.
Repeat the previous exercise for an add immediate instruction, an instruction where the operand is added to the accumulator.
Repeat the previous exercise for an jump relative instruction. This instruction will store the sum of the value of the program counter and the value of the operand in the program counter. Please note, I believe that there will
be some issues with hardware that you must overcome to solve this problem.
Implement in C/C++ a two pass assembler for the MARIE assembly language. This program counts as 50% of the grade for this homework.
Your program should input a program written in assembly language
and produce a program in MARIE machine language. (as described in section 4.5)
Labels begin in column 1 and are terminated with a comma
Exit, Halt
Opcodes begin with an uppercase letter, and can be found in the chart on page 177.
Input, Output, Halt, Clear do not have operands.
The operand for Skipcond is the two bit code.
All other operands are a label.
The pseudo-operands Dec and Hex mark a data location.
They must be proceeded by a label.
The operand is a number, specified in either decimal or hex.
You may assume that there are no errors in the input file.
You do not have to deal with comments, but you may if you wish.
For output you should produce a TKGate Memory File.
Each line begins with the address of the data, followed by a /.
This address is 12 bits (the size of memory) and in hex.
The data, 16 bits at a time, in hex, is output.
Instructions like Halt, should have an operand of all 0.
An Example
Load X
Sub Y
Skipcond 10
Jmp BIGX
Load Y
Jmp END
BIGX, Load X
END, Halt
X, Dec 1
Y, Dec 2
Should encode to
000/ 1008 4007 8800 9006 1009 9007 1008 7000 0001 0002
When you are finished, email the c code to me.
You should really consider using the map class in C++. If you
don't know this, it is worth learning for this project.