Question

3- please convert the following. show all work a) convert this into one-address machine instruction (load,store,add,sub,mult):...

3- please convert the following. show all work

a) convert this into one-address machine instruction (load,store,add,sub,mult): E = (A*C) + (B*D)

b) convert this into two-address machine instruction: A= C+B*D*E+A.

c) convert this expression using zero-address machine: a=b-c*d.

Homework Answers

Answer #1

(a)Expression:- E= (A*C)+(B*D)

AC is accumulator

M[ ] is memory Location

M[T] is Temporary Location

LOAD A AC=M[A]
ADD B AC=AC+M[B]
STORE T M[T]=AC
LOAD C AC=M[C]
ADD D AC=AC+M[D]
MUL T AC=AC*M[T]
STORE X M[X]=AC

(b) Two Address Instruction contains opcode,destination address,source address,mode

A=C+B*D*E+A

R1,R2 are the registers

M[ ] is the memory Location

MOV R1,B R1=M[B]
MOV R2,D R2=M[B]
MUL R1,R2 R1=R1*R2
MOV R2,E R2=M[E]
MUL R1,R2 R1=R1*R2
ADD R1,C R1=R1+C
ADD R1,A R1=R1+A
MOV X,R1 M[X]=R1

(c)

Expression: a=b-c*d
Postfixed : a = BC-D*
TOP means top of stack
M[X] is any memory location

PUSH B TOP=B
PUSH C TOP=C
SUB TOP=B-C
PUSH D TOP=D
MUL TOP=B-C*D
POP X M[X]=TOP

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Please add some explanation if possible 1.The machine code of LEGv8 instruction SUB X15,X16,X17 in hexadecimal...
Please add some explanation if possible 1.The machine code of LEGv8 instruction SUB X15,X16,X17 in hexadecimal is? 2.The LEGv8 assembly instruction assembled into the hexadecimal machine code D1001695 is? 3.What does the LEGv8 instruction below do? LSL X12,X12,#8 4. Which LEGv8 instruction set X12 to be X10's one's complement? (Assume X9 contains hexadecimal FFFFFFFF.) 5. What is the minimum number of LEGv8 assembly instructions needed to perform the following task? A[20] = A[10] + b + c - 8
Please convert the following numbers to each of the numbering systems: 0xABC 11011100 Show all work
Please convert the following numbers to each of the numbering systems: 0xABC 11011100 Show all work
Please answer the following questions for me <3 ; If a machine instruction, e.g. JMP, can...
Please answer the following questions for me <3 ; If a machine instruction, e.g. JMP, can not specify a segment number then it is using Select one: a. explicit segments b. segment offsets c. code sharing d. implicit segments The primitive data types, double and long Select one: a. may or may not be the same size b. will always be the same size c. will never be the same size d. long will always be bigger Malloc is used...
Add decimal numbers using binary additions for 170 and 493. Steps: Convert each number to binary...
Add decimal numbers using binary additions for 170 and 493. Steps: Convert each number to binary first. Then add the two binary numbers using binary addition. Make sure to keep track of the carry bit and show the carry for each step even when it is zero. Please show all work.
Convert decimal 298 to base 2, 8, and 16 using mathematics. Please show all work.
Convert decimal 298 to base 2, 8, and 16 using mathematics. Please show all work.
For all questions, please show all of your work and reason. 3. An astronaut in an...
For all questions, please show all of your work and reason. 3. An astronaut in an inertial reference frame measures a time interval Δt between her heartbeats. What will observers in all other inertial reference frames measure for the time interval between her heartbeats? a. more than Δt b. Δt c. less than Δt d. The answer depends on whether they are moving toward her or away from her. 4. The special theory of relativity predicts that there is an...
Question 1. Answer the following questions on MIPS Instruction Set. a) Show the minimal sequence of...
Question 1. Answer the following questions on MIPS Instruction Set. a) Show the minimal sequence of MIPS instruction for the following pseudocode segment: A[3] = A[10] + B; Assume that B corresponds to register $t3 and the array A has a base address of 1000C41016 which is required to be loaded to register $t0 in your code. Provide comments for each line of your MIPS instruction. b) Assume that Loop starts at memory location 0xC010. Provide a) instruction format of...
Given the following sequential list of VEX operations: A. add $r3 = $r1, $r2 B. sub...
Given the following sequential list of VEX operations: A. add $r3 = $r1, $r2 B. sub $r8 = $r1, $r3 C. sub $r7 = $r1, 2 D. add $r1 = $r1, 1 E. mpy $r6 = $r3, $r2 Which VEX operations can be scheduled simultaneously to make up the second VLIW instruction? The constructed schedule should satisfy the following conditions: Assume infinite resources and no limit to the number of operations scheduled to a single instruction. Operations that are scheduled...
PLEASE SHOW ALL WORK AND EXPLAIN PLEASE A machine that cost $96,000 on January 1, 2015...
PLEASE SHOW ALL WORK AND EXPLAIN PLEASE A machine that cost $96,000 on January 1, 2015 was depreciated by Ava Company using the double declining method. The machine had a $8,600 residual value and a useful life of 5 Years. On January 1. 2017, the company switched to the straight line method. What is the book value of the machine as of January 1, 2017?________
Question 1: A. Convert the following numbers to their decimal representation. Show your work. 1. 100110112...
Question 1: A. Convert the following numbers to their decimal representation. Show your work. 1. 100110112 =
 2. 4567 =
 3. 38A16 = 4. 22145 = B. Convert the following numbers to their binary representation: 1. 6910 =
 2. 48510=
 3. 6D1A16 = C. Convert the following numbers to their hexadecimal representation: 1. 11010112 =
 2. 89510 = Question 2: Solve the following, do all calculation in the given base. Show your work.