New Semester
Started
Get
50% OFF
Study Help!
--h --m --s
Claim Now
Question Answers
Textbooks
Find textbooks, questions and answers
Oops, something went wrong!
Change your search query and then try again
S
Books
FREE
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Tutors
Online Tutors
Find a Tutor
Hire a Tutor
Become a Tutor
AI Tutor
AI Study Planner
NEW
Sell Books
Search
Search
Sign In
Register
study help
computer science
computer organization design
Computer Organization And Design The Hardware Software Interface 4th Revised Edition David A. Patterson, John L. Hennessy - Solutions
Assume A and B are signed 8-bit decimal integers stored in two’s complement format. Calculate A + B using saturating arithmetic. The result should be written in decimal. Show your work.The following table also shows pairs of decimal numbers. a. b. A 15 151 В 139 214
Calculate by hand A divided by B. Show all the steps necessary to achieve your answer. Assume there is a guard, a round bit, and a sticky bit, and use them if necessary. Write the final answer in both the 16-bit floating point format described in 3.11.2 and in decimal and compare the decimal result
Booth’s algorithm is another approach to reducing the number of arithmetic operations necessary to perform a multiplication. This algorithm has been around for years and involves identifying runs of ones and zeros and performing only shifts instead of shifts and adds during the runs. Find a
Using a table similar to that shown in Figure 3.11, calculate A divided by B using the hardware described in Figure 3.9. You should show the contents of each register on each step. Assume A and B are 6-bit signed integers in sign-magnitude format. Be sure to include how you are calculating the
Calculate (A × B) × C by hand, assuming A, B, and C are stored in the modified 16-bit NVIDIA format described in 3.11.2 (and also described in the text). Assume 1 guard, 1 round bit, and 1 sticky bit, and round to the nearest even. Show all the steps, and write your answer in both the 16-bit
Using a table similar to that shown in Figure 3.11, calculate A divided by B using non-performing division. You should show the contents of each register on each step. Assume A and B are 6-bit unsigned integers.Figure 3.11The following table shows further pairs of octal numbers.
Using the IEEE 754 floating point format, write down the bit pattern that would represent A. Can you represent A exactly?The following table shows pairs, each consisting of a fraction and an integer. a. b. A -1/4 1/10 B 4 10
Write down the binary representation of the decimal number, assuming the IEEE 754 single precision format.The following table shows decimal numbers. a. 63.25 b. 146987.40625
What is A – B if they represent unsigned 12-bit octal numbers? The result should be written in octal. Show your work.The following table also shows pairs of octal numbers. a. b. A 7040 4365 В 0444 3412
What is A – B if they represent unsigned 16-bit hexadecimal numbers? The result should be written in hexadecimal. Show your work.The following table also shows pairs of hexadecimal numbers. a. b. A C352 5ED4 B 36AE 07A4
Calculate the sum of A and B by hand, assuming A and B are stored in the modified 16-bit NVIDIA format described in 3.11.2. Assume 1 guard, 1 round bit, and 1 sticky bit, and round to the nearest even. Show all the steps.The following table shows pairs of decimal numbers. a. b. A 2.6125 x
Write down the bit pattern assuming that we are using base 30 numbers in the mantissa instead of base 2. (Base 16 numbers use the symbols 0–9 and A–F. Base 30 numbers would use 0–9 and A–T.) Assume there are 20 bits, and you do not need to normalize. Is this representation exact? Do you see
When shifting a register one bit to the right, there are several ways to decide what the new entering bit should be. It can always be a zero, or always a one, or the incoming bit could be the one that is being pushed out of the right side (turning a shift into a rotate), or the value that is
The following table shows further pairs of decimal numbers.Write the loop in MIPS assembly language. a. b. A 8.625 x 10 1.84375 x 10 B -4.875 x 10 1.3203125 x 10
Show the step-by-step result of multiplying A and B, using Booth’s algorithm. Assume A and B are 8-bit two’s complement integers, stored in hexadecimal format.The following table shows further pairs of hexadecimal numbers. a. b. A F6 08 B 7F 55
Calculate A × (B × C) by hand, assuming A, B, and C are stored in the modified 16-bit NVIDIA format described in 3.11.2 (and also described in the text). Assume 1 guard, 1 round bit, and 1 sticky bit, and round to the nearest even. Show all the steps, and write your answer in both the 16-bit
Write an MIPS assembly language program to calculate A divided by B using nonperforming division. Assume A and B are 6-bit two’s complement signed integers.The following table shows further pairs of octal numbers. а. b. A 72 75 В 07 47
What do you get if you add A to itself B times? What is A × B? Are they the same? What should they be?The following table shows pairs, each consisting of a fraction and an integer. a. b. A -1/4 1/10 B 4 10
Write down the binary representation of the decimal number, assuming the IEEE 754 double precision format.The following table shows decimal numbers. a. 63.25 b. 146987.40625
What is A – B if they represent signed 12-bit octal numbers stored in sign-magnitude format? The result should be written in octal. Show your work.The following table also shows pairs of octal numbers. a. b. A 7040 4365 В 0444 3412
What is A – B if they represent signed 16-bit hexadecimal numbers stored in sign-magnitude format? The result should be written in hexadecimal. Show your work.The following table also shows pairs of hexadecimal numbers. a. b. A C352 5ED4 B 36AE 07A4
For the following problems, you will be using the MIPS assembly code as listed in the table.Write C code that is equivalent to the assembly code in the table. Assume that the largest constant that you can load into a 32-bit integer is 16 bits. a. b. lui $t0, 0x1234 addi $t0, $t0, 0x5678 lui $t0,
The first three problems in this Exercise refer to a critical section of the form lock(lk);operationunlock(lk);where the “operation” updates the shared variable shvar using the local (nonshared) variable x as follows:Explain why in your code from 2.29.2 register $a1 contains the address of
The problems in this Exercise refer to the following function, given as array code:What would change in your answer from 2.33.4 if registers $t0–$t7 and $a0–$a3 in the MIPS calling convention were all callee-saved, just like $s0–$s7?Data from 2.33.4Compare the worst-case number of executed
For the following problems, you will be using the MIPS assembly code as listed in the table.What is the value of register $t0 after the sequence of code in the table above? a. b. lui $t0, 0x1234 addi $t0, $t0, 0x5678 lui $t0, 0x1234 andi $t0, $t0, 0x5678
The following problems explore number conversions from decimal to signed and unsigned binary numbers.For the base ten numbers above, convert the negated values from the table to 2’s complement hexadecimal. a. -1ten b. 1024 ten
In the following problems, you will be asked to write MIPS instructions to extract the bits “Field” from register $t0 shown in the figure and place them into register $t1 at the location indicated in the following table. The bits shown as “XXX” are to remain unchanged.Find the shortest
For the following problems, you will be using making modifications to the MIPS instruction set architecture.If the instruction set of the MIPS processor is modified, the instruction format must also be changed. For each of the suggested changes above, what is the impact on the range of addresses
What are the contents of the 5-element array pointed by v right after “jal sort” returns to the main code?The remaining three problems in this exercise refer to a program that allocates memory for an array, ills the array with some numbers, calls the sort function from Figure 2.27, and then
Various C-level logical statements are shown in the table below. In this exercise, you will be asked to evaluate the statements and implement these C statements using MIPS assembly instructions.For your sequence of instructions in 2.15.5, show the bit-level representation of each instruction. a.
In the following problems, you will be using the MIPS assembly code as listed below to explore the trade-offs of the immediate field in the MIPS I-type instructions.How many extra instructions are needed to do execute your code in 2.27.5 MIPS statements in the table versus the code shown in the
In the following problems, you will perform various MIPS operations on a pair of registers, $s0 and $s1. Given the values of $s0 and $s1 in each of the questions below, state if there will be over low.Assume that register $s0 = 0x8FFFFFFF and $s1 = 0xD0000000. For the table above, will there be
For these problems, the table holds various binary values for register $t0. Given the value of $t0, you will be asked to evaluate the outcome of different branches.Suppose the program counter (PC) is set to 0x2000 0000. Is it possible to use the jump (j) MIPS assembly instruction to get set the PC
For these problems, the table holds MIPS assembly code fragments. You will be asked to evaluate each of the code fragments, familiarizing you with the different MIPS branch instructions.For the loops written in MIPS assembly above, assume that the register $t1 is initialized to the value N. How
The first three problems in this Exercise refer to a critical section of the formlock(lk);operationunlock(lk);where the “operation” updates the shared variable shvar using the local (nonshared) variable x as follows:If we want to atomically perform the same operation on two shared variables
For these problems, the table holds MIPS assembly code fragments. You will be asked to evaluate each of the code fragments, familiarizing you with the different MIPS branch instructions.Rewrite the loop to reduce the number of MIPS instructions executed. a. b. addi $t1, $0.50 LOOP: lw $s1,
The table below contains various values for register $s1. You will be asked to evaluate if there would be overflow for a given operation.Assume that register $s0 = 0x70000000 and $s1 has the value as given in the table. If the instruction: add $s0, $s0, $s1 is executed, what is the result in base
The following three problems in this Exercise refer to a function f that calls another function func. The code for C function func is already compiled in another module using the MIPS calling convention from Figure 2.14. The function declaration for func is “int func(int a, int b);”. The code
In the following problems, the data table contains MIPS instructions. You will be asked to translate the entries into the bits of the opcode and determine the MIPS instruction format.What is the binary then hexadecimal representation of the opcode, Rs, and Rt fields in this instruction? For R-type
For the following problems, the table has an assembly code fragment that computes a Fibonacci number. However, the entries in the table have errors, and you will be asked to ix these errors. For number n, the Fibonacci of n is calculated as follows:Show the contents of the stack after each function
In the following problems, the data table contains the values of various fields of MIPS instructions. You will be asked to determine what the instruction is, and find the MIPS format for the instruction.What is the binary representation of the instructions above? a. op=0, rs=3, rt=2, rd=3, shamt=0,
Using a table similar to that shown in Figure 3.7, calculate the product of the octal unsigned 6-bit integers A and B using the hardware described in Figure 3.4. You should show the contents of each register on each step.Figure 3.7Figure 3.4Let’s look in more detail at multiplication. We will use
Assume A and B are unsigned 8-bit decimal integers. Calculate A – B. Is there overflow, underflow, or neither?Overflow occurs when a result is too large to be represented accurately given a finite word size. Underflow occurs when a number is too small to be represented correctly—a negative
Calculate the time necessary to perform a multiply using the approach given in Figures 3.4 and 3.5 if an integer is A bits wide and each step of the operation takes B time units. Assume that in step 1a an addition is always performed-either the multiplicand will be added, or a zero will be. Also
Calculate the product of A and B by hand, assuming A and B are stored in the modified 16-bit NVIDIA format described in 3.11.2. Assume 1 guard, 1 round bit, and 1 sticky bit, and round to the nearest even. Show all the steps; however, as is done in the example in the text, you can do the
Using a table similar to that shown in Figure 3.11, calculate A divided by B using the hardware described in Figure 3.9. You should show the contents of each register on each step. Assume A and B are unsigned 6-bit integers.Figure 3.9Figure 3.11Let’s look in more detail at division. We will use
Using a table similar to that shown in Figure 3.11, calculate A divided by B using non-restoring division. You should show the contents of each register on each step. Assume A and B are 6-bit unsigned integers.Figure 3.11Figure 3.10 describes a restoring division algorithm, because when subtracting
As discussed in the text, one possible performance enhancement is to do a shift and add instead of an actual multiplication. Since 9 × 6, for example, can be written (2 × 2 × 2 + 1) × 6, we can calculate 9 × 6 by shifting 6 to the left 3 times and then adding 6 to that result. Show the best
Calculate (A + B) + C by hand, assuming A, B, and C are stored in the modified 16-bit NVIDIA format described in 3.11.2 (and also described in the text). Assume 1 guard, 1 round bit, and 1 sticky bit, and round to the nearest even. Show all the steps, and write your answer in both the 16-bit
Describe the algorithm in detail.Division is so time-consuming and difficult that the CRAY T3E Fortran Optimization guide states, “The best strategy for division is to avoid it whenever possible.” This exercise looks at the following different strategies for performing divisions. a.
Calculate A × (B + C) by hand, assuming A, B, and C are stored in the modified 16-bit NVIDIA format described in 3.11.2 (and also described in the text). Assume 1 guard, 1 round bit, and 1 sticky bit, and round to the nearest even. Show all the steps, and write your answer in both the 16-bit
What decimal number does the bit pattern represent if it is a two’s complement integer? An unsigned integer?In a Von Neumann architecture, groups of bits have no intrinsic meanings by themselves. What a bit pattern represents depends entirely on how it is used. The following table shows bit
What is the sum of A and B if they represent unsigned 12-bit octal numbers? The result should be written in octal. Show your work.The book shows how to add and subtract binary and decimal numbers. However, other numbering systems are also very popular when dealing with computers. The octal (base 8)
What is the sum of A and B if they represent unsigned 16-bit hexadecimal numbers? The result should be written in hexadecimal. Show your work.Hexadecimal (base 16) is also a commonly used numbering system for representing values in computers. In fact, it has become much more popular than octal. The
Write down the binary bit pattern assuming a format similar to that employed by the DEC PDP-8 (the leftmost 12 bits are the exponent stored as a two’s complement number, and the rightmost 24 bits are the mantissa stored as a two’s complement number ). No hidden 1 is used. Comment on how the
Using a table similar to that shown in Figure 3.7, calculate the product of the hexadecimal unsigned 8-bit integers A and B using the hardware described in Figure 3.6. You should show the contents of each register on each step.Figure 3.6Figure 3.7Let’s look in more detail at multiplication. We
Write down the bit pattern in the mantissa assuming a floating point format that uses binary numbers in the mantissa (essentially what you have been doing in this chapter). Assume there are 24 bits, and you do not need to normalize. Is this representation exact?Binary numbers are used in the
Assume A and B are signed 8-bit decimal integers stored in sign magnitude format. Calculate A + B. Is there overflow, underflow, or neither?Overflow occurs when a result is too large to be represented accurately given a finite word size. Underflow occurs when a number is too small to be represented
Write an MIPS assembly language program to calculate the product of A and B, assuming they are stored in IEEE 754 format. Indicate if there is overflow or underflow. (Remember, IEEE 754 assumes 1 guard, 1 round bit, and 1 sticky bit, and rounds to the nearest even.)Floating point multiplication is
Calculate the time necessary to perform a multiply using the approach described in the text (31 adders stacked vertically) if an integer is A bits wide and an adder takes B time units.For many reasons, we would like to design multipliers that require less time. Many different approaches have been
Show the best way to calculate A × B using shifts and add, if A and B are 8-bit signed integers stored in sign-magnitude format.In this exercise we will look at a couple of other ways to improve the performance of multiplication, based primarily on doing more shifts and fewer arithmetic
Execution time in a multiprocessor system can be split into computing time for the routines plus routing time spent sending data from one processor to another. Consider the execution time and routing time given in the following table. In this case, the routing time is an important component of the
The following table contains MIPS assembly code for a lock. Refer to the definition of the ll and sc pairs of MIPS instructions.Rewrite the code above so that the code may operate correctly. Be sure to avoid any race conditions. a. try: MOV LL ADDI SC BEQZ MOV R3, R4 R2,0 (R2) R2, R2, 1 R3,0
The table below contains various values for register $s1. You will be asked to evaluate if there would be overflow for a given operation.Assume that register $s0 = 0x7FFFFFFF and $s1 has the value as given in the table. If the instruction: sub $s0, $s0, $s1 is executed, will there be overflow?
In the following problems, you will be asked to write MIPS instructions to extract the bits “Field” from register $t0 shown in the figure and place them into register $t1 at the location indicated in the following table. The bits shown as “XXX” are to remain unchanged.Find the shortest
For the following problems, you will be using making modifications to the MIPS instruction set architecture.If the instruction set of the MIPS processor is modified, the instruction format must also be changed. For each of the suggested changes above, what is the impact on the range of addresses
In the following problems, you will be using the MIPS assembly code as listed below to explore the trade-offs of the immediate field in the MIPS I-type instructions.For the MIPS statements above, show the bit-level instruction representation of each of the instructions in hexadecimal. a.
In the following problems, you will perform various MIPS operations on a pair of registers, $s0 and $s1. Given the values of $s0 and $s1 in each of the questions below, state if there will be over low.Assume that register $s0 = 0x70000000 and $s1 = 0x10000000. For the table above, will there be
For these problems, the table holds various binary values for register $t0. Given the value of $t0, you will be asked to evaluate the outcome of different branches.Suppose that register $t0 contains a value from above. What is the value of $t2 after the following instructions? a. 0x00101000 b.
Each entry in the following table has code and also shows the contents of various registers. The notation “($s1)” shows the contents of a memory location pointed to by register $s1. The assembly code in each table is executed in the cycle shown on parallel processors with a shared memory
For these problems, the table holds MIPS assembly code fragments. You will be asked to evaluate each of the code fragments, familiarizing you with the different MIPS branch instructions.For the loops written in MIPS assembly above, assume that the register $t1 is initialized to the value 10. What
The first three problems in this Exercise refer to a critical section of the formlock(lk);operationunlock(lk);where the “operation” updates the shared variable shvar using the local (nonshared) variable x as follows:Using your code from 2.29.2 as an example, explain what happens when two
The following table contains MIPS instructions.For the MIPS assembly code above, write the equivalent ARM assembly code. a. addi r3, r2, 0x2 b. addi r3, r2, -1
For these problems, the table holds MIPS assembly code fragments. You will be asked to evaluate each of the code fragments, familiarizing you with the different MIPS branch instructions.What is the total number of MIPS instructions executed? a. b. addi $t1, $0.50 LOOP: lw $s1, 0($50) add $s2, $s2,
The following table contains x86 assembly instructions.Write equivalent MIPS assembly statements. a. push eax. b. test eax, 0x00200010
The following problems deal with translating from MIPS to C. Assume that the variables g, h, i, and j are given and could be considered 32-bit integers as declared in a C program.For the MIPS assembly instructions above, what is a corresponding C statement? a. b. addi f, f. 4 add f, g. h f. i. f add
The table below contains various values for register $s1. You will be asked to evaluate if there would be overflow for a given operation.Assume that register $s0 = 0x70000000 and $s1 has the value as given in the table. If the instruction: add $s0, $s0, $s1 is executed, will there be overflow?
The following three problems in this Exercise refer to a function f that calls another function func. The code for C function func is already compiled in another module using the MIPS calling convention from Figure 2.14. The function declaration for func is “int func(int a, int b);”. The code
The following problems deal with translating from MIPS to C. For the following exercise, assume that the variables g, h, i, and j are given and could be considered 32-bit integers as declared in a C program.For the MIPS assembly instructions above, what is a corresponding C statement? addi f, f.
In the following problems, the data table contains MIPS instructions. You will be asked to translate the entries into the bits of the opcode and determine the MIPS instruction format.For the instructions above, show the binary then hexadecimal representation of these instructions. a. addi $t0, $t0,
For the following problems, the table has an assembly code fragment that computes a Fibonacci number. However, the entries in the table have errors, and you will be asked to ix these errors. For number n, the Fibonacci of n is calculated as follows:The MIPS assembly program above computes the
The following problems deal with translating from MIPS to C. Assume that the variables g, h, i, and j are given and could be considered 32-bit integers as declared in a C program.For the MIPS statements above, what is a corresponding C statement? a. b. addi f, f, -4 add i, g, h f. i. f add
In the following problems, the data table contains the values of various fields of MIPS instructions. You will be asked to determine what the instruction is, and find the MIPS format for the instruction.What type (I-type, R-type) instruction do the instructions above represent? a. op=0, rs=3, rt=2,
The following problems deal with translating from MIPS to C. Assume that the variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in registers $s6 and $s7, respectively.For the MIPS assembly
The following three problems in this Exercise refer to this function, written in MIPS assembly following the calling conventions from Figure 2.14:Figure 2.14What is the C equivalent of this code? Assume that the function’s arguments are named a, b, c, etc. in the C version of the function. a. f:
The remaining three problems in this exercise refer to the following function, given in both C and x86 assembly. For each x86 instruction, we also show its length in the x86 variable-length instruction format and the interpretation (what the instruction does). Note that the x86 architecture has
In the following problems, the data table contains hexadecimal values. You will be asked to determine what MIPS instruction the value represents, and find the MIPS instruction format.For the hexadecimal entries above, what instruction do they represent? a. 0x01090012 b. OXAD090012
For the remaining three problems in this Exercise, we assume that the sort function from Figure 2.27 is changed in the following way:Figure 2.27When sorting a 10-element array that was already sorted, how many more (or fewer) instructions are executed as a result of this change? a. b. void swap(int
The following problems explore the translation of hexadecimal numbers to other number formats.Show how the data in the table would be arranged in memory of a little-endian and a big-endian machine. Assume the data is stored starting at address 0. a. Oxabcdef12 b. 0x10203040
The following problems deal with translating from MIPS to C. Assume that the variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in registers $s6 and $s7, respectively.For the MIPS assembly above,
For a 25% improvement in performance, how many cycles, on average, may an arithmetic instruction take if load/store and branch instructions are not improved at all?The following table shows the proportions of instruction execution for the different instruction types.
The problems in this Exercise refer to the following function, given as array code:Compare the number of temporary registers (t-registers)needed for your array-based code from 2.33.1 and for your pointer-based code from 2.33.3.Data from 2.33.1Translate this function into MIPS assembly.Data from
In the following exercise, the data table contains various MIPS logical operations. You will be asked to find the result of these operations given values for registers $t0 and $t1.Assume that $t0 = 0xA5A50000 and $t1 = A5A50000. What is the value of $t2 after the two instructions in the table?
In this exercise, you will explore 32-bit constants in MIPS. For the following problems, you will be using the binary data in the table below.If the immediate field of an MIPS instruction was only 8 bits wide, write the MIPS code that creates the 32-bit constants listed above and stores that value
The following problems explore number conversions from decimal to signed and unsigned binary numbers.For the base ten numbers above, convert to 2’s complement hexadecimal. a. -1ten b. 1024 ten
In the following problems, you will be asked to write MIPS instructions to extract the bits “Field” from register $t0 shown in the figure and place them into register $t1 at the location indicated in the following table. The bits shown as “XXX” are to remain unchanged.Find the shortest
For the following problems, you will be using making modifications to the MIPS instruction set architecture.If the instruction set of the MIPS processor is modified, the instruction format must also be changed. For each of the suggested changes above, what is the impact on the range of addresses
Various C-level logical statements are shown in the table below. In this exercise, you will be asked to evaluate the statements and implement these C statements using MIPS assembly instructions.For the C statements in the table above, write a minimal sequence of MIPS assembly instructions that does
In the following problems, you will compare code written using the ARM and MIPS instruction sets. The following table shows code written in the ARM instruction set.Assuming that the average CPI of the MIPS assembly routine is the same as the average CPI of the ARM assembly routine, and the MIPS
In the following problems, you will be using the MIPS assembly code as listed below to explore the trade-offs of the immediate field in the MIPS I-type instructions.By reducing the size of the immediate fields of the I-type and J-type instructions, we can save on the number of bits needed to
Showing 500 - 600
of 1073
1
2
3
4
5
6
7
8
9
10
11
Step by Step Answers