EBK COMPUTER SYSTEMS
3rd Edition
ISBN: 8220101459107
Author: O'HALLARON
Publisher: YUZU
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 3.11, Problem 3.51PP
Explanation of Solution
Table for code sequences:
- The details of table are shown below:
Tx | Ty | Instructions |
long | double | vcvtsi2sdq %rdi, %xmm0, %xmm0 |
double | int | vcvttsd2si %xmm0, %eax |
float | double |
vunpcklpd %xmm0, %xmm0, %xmm0 vcvtpd2ps %xmm0, %xmm0 |
long | float | vcvtsi2ssq %rdi, %xmm0, %xmm0 |
float | long | vcvttss2siq %xmm0, %rax |
Explanation:
- The argument “x” is either in “%xmm0” or in named portion of register “%rdi”.
- The assembly instructions are used to perform type conversion and to copy value to named portion of register “%rax”...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
[1] (
Show your work. Show hoe you compute memory address by using the effective memory
address computation.
Assume the following values are stored at the indicated memory addresses and
registers:
Address Value
0x100
OxFF
0x104
OxAB
0x108
0x13
0x10c
0x11
Register
%rax
%rcx
%rdx
$0x108
(%rax)
4(%rax)
9(%rax, %rdx)
260(%rcx,%rdx)
OxFC (,%rcx, 4)
(%rax, %rdx, 4)
Value
0x100
0x1
0x3
Fill in the following table showing the values for the indicated operands:
Operand
Value
%rax
0x104
3. (15 pts.) Consider the following fragment of C code:
for (i=0; i<=100; i=i+1)
a [i] = b[i] + c;
Assume that a and b are arrays of words and that the base address of a is in $a0 and
the base address of b is in $a1. Register $t0 is associated with variable I and register
$50 with the value of c. You may also assume that any address constants you need are
available to be loaded from memory.
(1) (10 pts.) Write the code for MIPS.
(2) (5 pts.) How many instructions are executed during the running of this code if
there are no array out-of-bounds exceptions thrown?
(3) How many memory data references will be made during execution?
c programming not c++ (cache)
Chapter 3 Solutions
EBK COMPUTER SYSTEMS
Ch. 3.4 - Prob. 3.1PPCh. 3.4 - Prob. 3.2PPCh. 3.4 - Prob. 3.3PPCh. 3.4 - Prob. 3.4PPCh. 3.4 - Prob. 3.5PPCh. 3.5 - Prob. 3.6PPCh. 3.5 - Prob. 3.7PPCh. 3.5 - Prob. 3.8PPCh. 3.5 - Prob. 3.9PPCh. 3.5 - Prob. 3.10PP
Ch. 3.5 - Prob. 3.11PPCh. 3.5 - Prob. 3.12PPCh. 3.6 - Prob. 3.13PPCh. 3.6 - Prob. 3.14PPCh. 3.6 - Prob. 3.15PPCh. 3.6 - Prob. 3.16PPCh. 3.6 - Practice Problem 3.17 (solution page 331) An...Ch. 3.6 - Practice Problem 3.18 (solution page 332) Starting...Ch. 3.6 - Prob. 3.19PPCh. 3.6 - Prob. 3.20PPCh. 3.6 - Prob. 3.21PPCh. 3.6 - Prob. 3.22PPCh. 3.6 - Prob. 3.23PPCh. 3.6 - Practice Problem 3.24 (solution page 335) For C...Ch. 3.6 - Prob. 3.25PPCh. 3.6 - Prob. 3.26PPCh. 3.6 - Practice Problem 3.27 (solution page 336) Write...Ch. 3.6 - Prob. 3.28PPCh. 3.6 - Prob. 3.29PPCh. 3.6 - Practice Problem 3.30 (solution page 338) In the C...Ch. 3.6 - Prob. 3.31PPCh. 3.7 - Prob. 3.32PPCh. 3.7 - Prob. 3.33PPCh. 3.7 - Prob. 3.34PPCh. 3.7 - Prob. 3.35PPCh. 3.8 - Prob. 3.36PPCh. 3.8 - Prob. 3.37PPCh. 3.8 - Prob. 3.38PPCh. 3.8 - Prob. 3.39PPCh. 3.8 - Prob. 3.40PPCh. 3.9 - Prob. 3.41PPCh. 3.9 - Prob. 3.42PPCh. 3.9 - Practice Problem 3.43 (solution page 344) Suppose...Ch. 3.9 - Prob. 3.44PPCh. 3.9 - Prob. 3.45PPCh. 3.10 - Prob. 3.46PPCh. 3.10 - Prob. 3.47PPCh. 3.10 - Prob. 3.48PPCh. 3.10 - Prob. 3.49PPCh. 3.11 - Practice Problem 3.50 (solution page 347) For the...Ch. 3.11 - Prob. 3.51PPCh. 3.11 - Prob. 3.52PPCh. 3.11 - Practice Problem 3.52 (solution page 348) For the...Ch. 3.11 - Practice Problem 3.54 (solution page 349) Function...Ch. 3.11 - Prob. 3.55PPCh. 3.11 - Prob. 3.56PPCh. 3.11 - Practice Problem 3.57 (solution page 350) Function...Ch. 3 - For a function with prototype long decoda2(long x,...Ch. 3 - The following code computes the 128-bit product of...Ch. 3 - Prob. 3.60HWCh. 3 - In Section 3.6.6, we examined the following code...Ch. 3 - The code that follows shows an example of...Ch. 3 - This problem will give you a chance to reverb...Ch. 3 - Consider the following source code, where R, S,...Ch. 3 - The following code transposes the elements of an M...Ch. 3 - Prob. 3.66HWCh. 3 - For this exercise, we will examine the code...Ch. 3 - Prob. 3.68HWCh. 3 - Prob. 3.69HWCh. 3 - Consider the following union declaration: This...Ch. 3 - Prob. 3.71HWCh. 3 - Prob. 3.72HWCh. 3 - Prob. 3.73HWCh. 3 - Prob. 3.74HWCh. 3 - Prob. 3.75HW
Knowledge Booster
Similar questions
- ▸ A is an array of 100 words and variables g and hare registers x20 and x21. ▸ Assume the starting (base) address of A is in x22. Use x9 for the temporary register. I > Compile the C statement. The number 8 is also known as the offset. Offset to be added is 32 as each word is 4 bytes. g= h + A[8]: Load word 1w x5, 40(x6) x5- Memory[x6 + 40] Word from memory to registerarrow_forwardSystems Programming Purpose: The purpose of this assignment is to practice loop instructions and array iterations in M6800 assembly language programming. Write an assembly language program which implements the following C code that is a find minimum problem solution implementation: int A[10] = {8, 14, 6, 16, 5, 5, 10, 9, 4, 11}; int i = 0; int min = 255; // This is the largest number 8-bit accumulators can hold. while (i < 10) { if (A[i] < min) min = A[i]; } Your solution should be able to handle all possible array elements and orderings for any value an accumulator can hold. You should treat variable į as XR in assembler (index register) and store variable min in the address 60H. 0010: 00 00 00 00 00 00 00 00 0O 00 00 00 00 00 00 00 8628: 00 060 00 00 00 600 00 00 00 08 08 00 6 00 00 00 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0050: 00 G0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 006 0: 00 00 00 00 00 00 00 00 00 08 00…arrow_forward(4) [8]Write code for a function multBy3divBy4, that for argument int x, computes 3*x/4, but follows the bit-level integer coding rules (text p.128) like in problem 3 of the assignment 1. (you may assume ints are 32 bits). (Note: The operation in your code 3*x is allowed to cause overflow.)arrow_forward
- #include using namespace std; int main() { int type; double Vth, Vg, Vd, Vs; cin>>type>>Vth>>Vg>>Vd>>Vs; return 0; }arrow_forward(Base Indexed Memory Addressing Mode) Only at [{DS | SS | ES}: {SI | DI} + {BX + BP}] BA EA There is a combination between (Base and Index) in Effective Add. (EA) Ex. Described each line and write down the equation of physical add. For the following assembly code: 01 org 100 02 MOV [BX+DI], CL 03 MOV CH, [вх+SI) 04 MOV AH, [BP+DI] 05 MOV [BP+SI], AL 06 retarrow_forwardProblem (5) Consider the code in main() below. Write code (in C++) to close as many memory leaks as possible. If there is still some memory leaking, describe why you cannot take care of it. int** pp; int* p1, p2; int x = 2; p2=new int; pp=new int*; *pp = p2; = new int; %3D p2 **pp = p1 *p2; *pp; p2 = new int;arrow_forward
- (d) You are working on a redesign of a simple 16-bit computer which supports at most 64 kilobytes of memory. Currently, memory is word-addressed and all memory accesses load or store a 16-bit value. For example, LDA Ox6502 loads a 16-bit value from address Ox6502 into register A. The change is to support additionally 8-bit accesses, thanks to an expanded machine language (already designed by a colleague) which now supports instructions such as: ; load 16 bits from addr 6502 into A ; load 8 bits from addr 6502 into A LDAW Ox6502 LDAB Ox6502 Outline, at a high level, how you would bring about this change in the CPU design, and mentioning any difficulties you expect to encounter.arrow_forwardCOAL - Computer Organization and Assembly Languagearrow_forwardQuestion 3 (a) Provide a single line of C++ code that will declare an integer pointer variable named x. (b) You have variable c declared as int c; Give the single line of C++ code that will assign the integer that is pointed to by x (from above) to c. (c) Now provide the C++ code that will assign the address of c to x. (d) You may assume that x is now pointing to an allocated and initialised block of 10 integers. Write a for loop that uses pointer arithmetic to print out the contents of this block. (e) What is a segmentation fault?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr