Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Assignment

Exercise 1

Convert each of the following numbers to 8-bit signed magnitude, 8-bit one's complement and 8-bit two's complement. Report your answers in binary.

a. (-97)10

8-bit signed magnitude 8-bit one's complement 8-bit two's complement

b. (-47)10

8-bit signed magnitude 8-bit one's complement 8-bit two's complement

c. (-127)10

8-bit signed magnitude 8-bit one's complement 8-bit two's complement

d. 12610

8-bit signed magnitude 8-bit one's complement 8-bit two's complement

Exercise 2

Convert the following 16-bit two's complement numbers in hexadecimal representation to decimal.

a. AC2416
b. 64A216 c. 5D1716
d. FFFF16

Find the decimal equivalents for the following 8-bit two's complement numbers.

a. 0010 0100 Decimal Equivalent

b. 1010 1001 Decimal Equivalent

c. 1100 0011 Decimal Equivalent

d. 0101 0101 Decimal Equivalent

Exercise 4

Perform two's complement addition on the following pairs of numbers. In each case, indicate the value of the status bits after the addition. Assume NZVC=0000 prior to the addition.

a. 1000 0010 + 1000 0010 =                 NZVC=

b. 1010 1001 + 0110 1100=                  NZVC=

c. 1001 1111 + 1111 1110=                  NZVC=

d. 0111 1010 + 0110 0110=                  NZVC=

Exercise 5

Using the PEP/8 instruction, 72004A, answer the following questions. What is the instruction in binary?

Starting from the left, what do bits 6 - 8 represent? (be specific) For this instruction, what register will be used?

Explain what is stored in mem[004A]?

The following is in single-precision IEEE 754 format, 1 01111111 10110011001100110011010.

What is the sign bit?

Does the sign bit represent a positive or negative number?

What is the bias used in IEEE 754 single-precision format?

As shown above, what is the exponent in binary?

What is the exponent after the bias is removed? (In decimal)

As shown above, what is the significand in binary?

Explain why it is possible for error to be introduced when converting a decimal number to IEEE 754 format.

Exercise 7

Using the PEP/8 instruction, D11AA3, and the following table, answer the following questions.

 

Accumulator

Index Register

Mem[1AA3]

Mem[1AA5]

Mem[1AA7]

NZVC

Content

2A34

FF32

3AF0

2AFF

1AFF

0000

Content before instruction.

What is the instruction?

What is the register?

What is the addressing mode?

What is the content of the accumulator after the instruction is executed, (hex)?

What is the content of the index register after the instruction is executed, (binary)?

What is the content of mem[1AA3] after the instruction is executed, (hex)?

What is the content of mem[1AA5], (binary)?

What is the content of mem[1AA7], (hex)?

What is the RTL specification for this instruction?

What is the value of the NZVC bit after execution?

The following is in Pep/8 assembly language.

LDX 8, i
ORX 0x0030, i
STBYTEX num, d CHARO num, d STOP
num: .BYTE 0
.END

What is the output of this program?

What is ORX doing?

Why is the ORX instruction required?

What is the hexadecimal object code that is suitable for PEP/8. (Include all code necessary for the object code to run on the PEP/8. Use PEP/8 to check your work)

Exercise 9

The following is in Pep/8 assembly language.

DECO 'X', i CHARO '\n',i DECO 0xFFE3, i CHARO '\n',i CHARO 0x003D, i STOP
.END

What is the output of DECO ‘X', i?

What is the output of DECO 0xFFE3, i?

What is the output of CHARO 003D, i?

What is the hexadecimal object code that is suitable for PEP/8. (Include all code necessary for the object code to run on the PEP/8. Use PEP/8 to check your work)

Draw the runtime stack for the following C++ program. (Show any global variables and include main in the runtime stack)

Use

retAddr for the return address retVal for the return value NA not used

#include using namespace std; int ounces;
void size(int& ou, int lbs) { ou = lbs*16;
}
int main() {
int lbs;
cout << "Enter number of pounds"; cin >> lbs;
size(ounces, lbs);
cout <<"You have " << ounces << "ounces"; return 0;
}

Draw the call tree, as in Figure 2.30, for the function binCoeff of Figure 2.28 for the call statement from the main program: (e) binCoeff (4, 2)

Part 1) Draw the call tree for the call statement from the main program. (See Fig 2.30 for an example)

Part 2) How many times is the function called?

Part 3) What is the maximum number of stack frames on the run-time stack during the execution, including main).

Part 4) The sequence of calls and returns for the program. (See page 66 below Fig 2.30)

Exercise 12

The Fibonacci sequence is 0 1 1 2 3 5 8 13 21...

Each Fibonacci number is the sum of the preceding two Fibonacci numbers. The sequence starts with the first two Fibonacci numbers, and is defined recursively as:

fib(0) = 0
fib(1) = 1
fib(n) = fib(n-1) + fib(n-2) for n > 1
The C++ program that computes the Fibonacci number is as follows: #include
using namespace std; int fib (int n) {
if (n == 0) { return 0;
}
else if (n == 1) { return 1;
}
else {
return fib (n - 1) + fib (n - 2);
}
}
int main () { int num;
cout << "Which Fibonacci number? "; cin >> num;
cout << "The number is " << fib (num) << endl; return 0;
}

Part 1) Draw the call tree for the Fibonacci number fib(5)

Part 2) How many time is fib called?

Part 3) What is the maximum number of stack frames allocated on the run-time stack? (Do not include the main stack.)

Exercise 13

The object code for Figure 6.14 has a CPA at 000C to test the value of j. Because the program branches to that instruction from the bottom of the loop, why doesn't the compiler generate a LDA j,d at that point before CPA.

Exercise 14

Explain the difference in the memory model between global and local variables. How are each allocated and accessed in PEP/8?

Exercise 15

Draw the values just before and just after the CALL at 0022.

37_After execution.jpg

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92743926

Have any Question?


Related Questions in Computer Engineering

Describe some of the advantages and disadvantages of using

Describe some of the advantages and disadvantages of using the N-version programming approach.

Quesiton an important principle in information security is

Quesiton: An important principle in information security is the concept of layers of security, which is often referred to as layered security, or defense in depth. 1) Please explain the concept of layers of security. 2) ...

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Suppose you have two sorted arrays of n integers x01n and

Suppose you have two sorted arrays of n integers: X0[1..n] and X1[1..n]. Devise and analyze an efficient algorithm for finding the median of all numbers in arrays X0 and X1. Now, suppose you have not two, but three such ...

Question research parallel computing and prepare an

Question : Research parallel computing and prepare an informal paper 2 -3 pages in length, single spaced with a blank line beltween paragraphs. The response must be typed, single spaced, must be in times new roman font ( ...

Question discussion pointdefine and briefly discuss the

Question: Discussion point: Define and briefly discuss the following brainstorming techniques, the delphi technique, brainstorming, or nominal group technique. Please read the above discussion point and write the respons ...

University bookstores order books that instructors adopt

University bookstores order books that instructors adopt for the courses. The number of copies order matches the projected the demand. However, at the end of the semester the bookstore has too many copies on hand and mus ...

Sorting amp searching i need this written in cwrite a

Sorting & Searching ( I need this written in C) Write a program that will allow a user the opportunity to compare and analyze the efficiency of several sorting algorithms. The program will sort integer arrays of size 10, ...

Junit test labyou will be creating a junit test class for

JUnit Test Lab You will be creating a JUnit Test Class for Gradebook.java, that has been provided for you.   Add a getScoreSize() method to the Gradebook class which returns scoresSize; Add a toString() method to the Gra ...

Case study 1 requirement analysis and gathering for the

Case Study 1: Requirement Analysis and Gathering for the State Firefighters Association Read the mini case on The State Firefighters Association located in Chapter 3 of the textbook and complete the assignment. Write a t ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As