Question

In: Computer Science

The following problems deal with sign extension and overflow. Registers X0 and X1 hold the values...

The following problems deal with sign extension and overflow. Registers X0 and X1 hold the values as shown in the table below. You will be asked to perform LEGv8 operations on these registers and show the result for the contents of A and B in the table 2 following.

A.

X0 = 0x7000000016

X1 = 0x0FFFFFFF16

B.

X0 = 0x4000000016

X1 = 0x4000000016

Table 2.

  1. For the contents of registers X0 and X1 as specified above, what is the value of X4 for the following assembly code for the contents of A and B respectively:

ADD X4, X0, X1

  1. Is the result in X4 the desired result, or has there been overflow in each of A and B?
  1. For the contents of registers X0 and X1 as specified above, what is the value of X0 for the following assembly code for the contents of A and B respectively:

SUB X4, X0, X1

  1. Is the result in X4 the desired result, or has there been overflow in each of A and B?

  1. For the contents of registers X0 and X1 as specified above, what is the value of X4 for the following assembly code for the contents of A and B respectively:

ADD X4, X0, X1

ADD X4, X0, X0

  1. Is the result in X4 the desired result, or has there been overflow in each of A and B?

Solutions

Expert Solution

Answer is as follows :

We have following 32 bit data stored in registers with capacity of 32 bits. if the result include more than 32 bits it will lead to overflow

A :

X0 = 0x7000000016 i.e. 0111 0000 0000 0000 0000 0000 0000 0000 in binary

X1 = 0x0FFFFFFF16 i.e. 0000 1111 1111 1111 1111 1111 1111 1111 in binary

B :

X0 = 0x4000000016 i.e. 0100 0000 0000 0000 0000 0000 0000 0000 in binary

X1 = 0x4000000016 i.e. 0100 0000 0000 0000 0000 0000 0000 0000 in binary

So Solution for given queries are :

Part I : ADD X4, X0, X1

This instruction Add the contents of register X0 and X1 and store the result to register X4

A) We get 0110 1111 1111 1111 1111 1111 1111 1111 after additon i.e. 0x7FFFFFFF

B) We get 1000 0000 0000 0000 0000 0000 0000 0000 after addition i.e. 0x80000000

In both cases we get the desired result i.e. stored in register X4. So there is not any kind of overflow in A and B.

Part II : SUB X4, X0, X1

This instruction subtract the contents of register X0 from X1 and store the result to register X4

A) We get 0110 0000 0000 0000 0000 0000 0000 0001 after subtraction i.e. 0x60000001

B) We get 0000 0000 0000 0000 0000 0000 0000 0000 after subtraction i.e. 0x00000000

In both cases we get the desired result i.e. stored in register X4. So there is not any kind of overflow in A and B.

Part III:

Instruction 1 : ADD X4, X0, X1

This instruction Add the contents of register X0 and X1 and store the result to register X4

A) We get 0110 1111 1111 1111 1111 1111 1111 1111 after additon i.e. 0x7FFFFFFF

B) We get 1000 0000 0000 0000 0000 0000 0000 0000 after addition i.e. 0x80000000

Instruction 2 : ADD X4, X0, X0

This instruction Add the contents of register X0 and X0 and store the result to register X4

A) We get 1110 1111 1111 1111 1111 1111 1111 1111 after additon i.e. 0xE0000000

B) We get 1000 0000 0000 0000 0000 0000 0000 0000 after addition i.e. 0x80000000

So in this final values of X4 are :

A : 0xE0000000 and B : 0x80000000

In both cases we get the desired result i.e. stored in register X4. So there is not any kind of overflow in A and B.

if there is any query please ask in the comments...


Related Solutions

Assume that the registers have the following values (all in hex) and that CS= 1000, DS...
Assume that the registers have the following values (all in hex) and that CS= 1000, DS = 2000, SS=3000, SI=4000, DI = 5000, BX=6080, BP= 7000, AX=25FF, CX=8791, and DX=1299. Calculate the physical address of the memory where the operand is stored and the contents of the memory locations in each of the addressing examples. a) MOV [SI], AL b) MOV [SI+BX+8], AH c) MOV [BX]+300, DX Now Examine the status of the CF, PF, AF, ZF, and SF if...
find the general solution of the following as follows Xn+2 = -2Xn+1 + 3Xn, x0=1 x1=2...
find the general solution of the following as follows Xn+2 = -2Xn+1 + 3Xn, x0=1 x1=2 a) find the 2x2 matrix that satisfies Yn+1=AYn b) Find the characteristic value of A and its corresponding characteristic vector c) express X0 = (1 2)as a linear combination of characteristic vector d) find Yn e) find Xn
How do you simplify the following boolean expressions: Y3= X3' X2 X1 X0' + X3' X2...
How do you simplify the following boolean expressions: Y3= X3' X2 X1 X0' + X3' X2 X1 X0 + X3 X2 X1 X0' +X3X2X1X0 Y2 = X3' X2 X1' X0' + X3' X2 X1' X0 + X3 X2 X1' X0' + X3 X2 X1' X0 +  X3 X2' X1' X0' + X3 X2' X1' X0 + X3 X2' X1 X0' + X3 X2' X1 X0 Y1 = X3' X2' X1 X0' + X3' X2' X1 X0 + X3' X2 X1 X0'...
Perform the following arithmetic in Binary assuming 16 bit registers (67)10 + (-89)10 List the values...
Perform the following arithmetic in Binary assuming 16 bit registers (67)10 + (-89)10 List the values of the status bits: C, V, N and Z
How does each of the following viruses deal with issues and problems related to translation initiation,...
How does each of the following viruses deal with issues and problems related to translation initiation, expression of downstream cistrons and fine-tuning of gene expression? Influenza A virus Rhabdovirus eg VSV
Assume that the registers have the following values all in hex and CS=0700, DS=0B00, SS=0A00, SI=A200,...
Assume that the registers have the following values all in hex and CS=0700, DS=0B00, SS=0A00, SI=A200, DI=2C00, AX=A00B, BX=130C, BP=AF09, CX=F1D5 and DX=1055. Calculate the physical address of memory where the operand is stored and show the contents of memory locations in each of the following addressing examples. a) MOV [BX]-10AH, CH b) MOV [BP][DI]+1CH,DX c) MOV [DI+BP-99FH],BX d) MOV [SI+4BH],BL
A random sample from a given population gives the following numerical values: x1, y2, · ·...
A random sample from a given population gives the following numerical values: x1, y2, · · · , xn: (a) What is meant by the expression “random sample”? (b) Prove that ∑n j=1 (xi − x¯) = 0. (c) Indicate the type of measures and state one advantage and disadvantage of the in the following table: Measure Type Advantage Disadvantage Mean Median Mode Range
Solve the following problems using the two phase method: max 3x1 + x2 S.t. x1 −...
Solve the following problems using the two phase method: max 3x1 + x2 S.t. x1 − x2 ≤ −1 −x1 − x2 ≤ −3 2x1 + x2 ≤ 4 x1, x2 ≥ 0 Please show all steps
A multivariate random variable (X1, X2, X3) takes values in the following set S with equal...
A multivariate random variable (X1, X2, X3) takes values in the following set S with equal probability: S = {(1, 1, 1),(3, 0, 0),(0, 3, 0),(0, 0, 3),(1, 2, 3)}. a) Compute E[X1|X2 = i], for each i = 0, 1, 2, 3, and E[X1]. b) Compute the marginal p.m.f. of Xi for each i = 1, 2, 3.
Find the following values, using the equations, and then work the problems using a financial calculator...
Find the following values, using the equations, and then work the problems using a financial calculator to check your answers. Disregard rounding differences. (Hint: If you are using a financial calculator, you can enter the known values and then press the appropriate key to find the unknown variable. Then, without clearing the TVM register, you can "override" the variable that changes by simply entering a new value for it and then pressing the key for the unknown variable to obtain...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT