Question: For this week s programming, we will be implementing basic operations on integer values. We have two source registers ( R 1 and R 2

For this weeks programming, we will be implementing basic operations on integer values. We have
two source registers (R1 and R2 with values x and y, respectively), and another register (R4) whose
value (z) dictates which operation should be performed on x and y.
First, you must read the value z in register R4. We then look at its value:
if z >0: we perform multiplication (x y);
if z =0: we perform addition (x + y);
if z <0: we perform subtraction (y x).
The result of this operation should be stored in register R3. Please note:
1. You do not have to convert the negative values into their decimal notation when doing any of
the operations;
2. For subtraction, make sure that you perform it in the right order on x and y (so y x, not
x y);
3. For addition, the order does not matter;
4. For multiplication, we also expect that if x <0 and y <0, then x y >0(in other words,
multiplying two negative numbers should yield a positive number)
Note that you must make sure that you implement an efficient way of doing multiplication. In assembly lc3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!