Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I would like to compare my answers to the following three questions: QUESTION 1 (10 points) Translate the line of code below to assembly language.

I would like to compare my answers to the following three questions:

image text in transcribed

QUESTION 1 (10 points) Translate the line of code below to assembly language. The terms A, B, C, D, E and F are memory labels (addresses). Minimize the number of instructions in the assembly code that you write. F = (A+B-C) / (A + D*E); Part a) Write the code for the accumulator architecture. Part b) Write the code for the stack architecture. The division operation does (TOS/2nd TOS) and the subtract operation does (TOS . 2nd TOS). Part c)I is said that a stack architecture makes it easy to develop a compiler. Explain this statement. (10 points) QUESTION 2. Repeat the question above Part a) Write the code for a register-memory architecture. Part b) Write the code for a load-store architecture. Part c) What is the term 'code density? Which of the two codes in this question has a better code density? Does having a higher code density guarantees faster execution? QUESTION 3. (10 points) The MIPS architecture supports byte and halfword (16-bit) memory transfer operations. The instructions are load byte (lb), load byte unsigned (lbu), store byte (sb), load halfword (lh), load halfword unsigned (lhu) and store halfword (sh) Code: short int a, b; 1/16-bit variables (a g address 100) (baddress 200) Part a) Assuming 16-bit operations are supported (lh, lhu, sh), write a MIPS code that swaps the variables a and b. Part b) If MIPS doesn't support byte and halfword operations, then we can access the memory using the load word' (lw) and store word' (sw) only, which are 32-bit operations. Accordingly, rewrite the code above using only (lw, sw) to access the memory. You can use other logic/arithmetic/branch instructions. QUESTION 1 (10 points) Translate the line of code below to assembly language. The terms A, B, C, D, E and F are memory labels (addresses). Minimize the number of instructions in the assembly code that you write. F = (A+B-C) / (A + D*E); Part a) Write the code for the accumulator architecture. Part b) Write the code for the stack architecture. The division operation does (TOS/2nd TOS) and the subtract operation does (TOS . 2nd TOS). Part c)I is said that a stack architecture makes it easy to develop a compiler. Explain this statement. (10 points) QUESTION 2. Repeat the question above Part a) Write the code for a register-memory architecture. Part b) Write the code for a load-store architecture. Part c) What is the term 'code density? Which of the two codes in this question has a better code density? Does having a higher code density guarantees faster execution? QUESTION 3. (10 points) The MIPS architecture supports byte and halfword (16-bit) memory transfer operations. The instructions are load byte (lb), load byte unsigned (lbu), store byte (sb), load halfword (lh), load halfword unsigned (lhu) and store halfword (sh) Code: short int a, b; 1/16-bit variables (a g address 100) (baddress 200) Part a) Assuming 16-bit operations are supported (lh, lhu, sh), write a MIPS code that swaps the variables a and b. Part b) If MIPS doesn't support byte and halfword operations, then we can access the memory using the load word' (lw) and store word' (sw) only, which are 32-bit operations. Accordingly, rewrite the code above using only (lw, sw) to access the memory. You can use other logic/arithmetic/branch instructions

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

From Herds To Insights Harnessing Data Analytics For Sustainable Livestock Farming

Authors: Prof Suresh Neethirajan

1st Edition

B0CFD6K6KK, 979-8857075487

More Books

Students also viewed these Databases questions

Question

Is it clear what happens if an employee violates the policy?

Answered: 1 week ago