Fill This Form To Receive Instant Help
Homework answers / question archive / 6
7. A program is running on a machine which has a total of 500 instructions, average cycles per instruction for the program is 2.5, and CPU clock rate is 1.78GHz.The execution time of the program will be --------------------- second.
8. Consider a program whose instruction count is 60,000, average CPI is 2.4 and clock rate is 1.9 GHz. Suppose we use a new compiler on the same program for which the new instruction count is 50,000 and new CPI is 4.1, which is running on a faster machine with clock rate 2.5GHz. The speedup achieved will be..................
9. Consider a processor having four types of instruction classes, A, B, C and D, with the corresponding CPI values 1.3, 1.9, 2.5 and 3.8 respectively. The processor runs at a clock rate of 2 GHz. For a given program, the instruction counts for the four types of instruction are 25, 15, 10 and 5 million respectively. The MIPS rating of the processor for this program will be...................
10. Perform signed magnitude multiplication to calculate m * n. (m is the sum of last four digits of your register number, n is the negative value of the sum of last two digit in register number. For eg. Reg no: 19bce0453, then m = 0+4+5+3=12 and n = - 8).
answer:
Step-by-step explanation
6. A Tclock clock cycle of 0.25 nsec means 0.25 * 10-9 seconds. The clock rate (also called) frequency f is 1/Tclock. So,
f = 1/Tclock = 1 / (0.25 * 10-9) = 4 * 109 = 4 GHz.
So the clock rate is f = 4 GHz = 4000 MHz.
7. Ninstructions = 500 , CPI = 2.5, and f = 1.78 * 109.
Based on f we compute the Tclock = 1 / (1.78 * 109) = 1 / 1.78 * 10-9 seconds = 0.5617 * 10-9 seconds.
So Tclock = 0.5617 * 10-9 seconds.
We have Ninstructions to execute. Each one needs CPI clock cycles, so the total number of clock cycles is Ninstructions * CPI = 1250.
Since each clock cycle takes Tclock seconds to execute, the total time Ttotal is:
Ttotal = Ninstructions * CPI * Tclock = 1250 * 0.5617 * 10-9 seconds = 702.12 * 10-9 seconds = 0.70 microseconds
So Ttotal = 702125 * 10-9 seconds = 0.70 microseconds.
8. Ninstructions = 60,000, CPI = 2.4, and f = 1.9 GHz.
Based on f we compute the Tclock = 1 / (1.9 * 109) = 1 / 1.9 * 10-9 seconds = 0.5263 * 10-9 seconds.
So Tclock = 0.5263 * 10-9 seconds.
We have Ninstructions to execute. Each one needs CPI clock cycles, so the total number of clock cycles is Ninstructions * CPI = 144000.
Since each clock cycle takes Tclock seconds to execute, the total time Ttotal is:
Ttotal = Ninstructions * CPI * Tclock = 60000 * 2.4 * 0.5263 * 10-9 seconds = 75789 * 10-9 seconds = 75.78 microseconds.
So Ttotal = 75.78 microseconds.
For the new compiler, the formula becomes:
Ttotal' = Ninstructions' * CPI' * Tclock' = 50000 * 4.1 * 0.4 * 10-9 seconds = 82000 * 10-9 seconds = 82 microseconds.
So Ttotal' = 82 microseconds.
The speedup achieved will be Speedup = Ttotal' / Ttotal = 82 / 75.78 = 1.08.
So Speedup = 1.08.
9. Ninstructions_A = 25 * 106
Ninstructions_B = 15 * 106
Ninstructions_C = 10 * 106
Ninstructions_D = 5 * 106
The total number of instructions executed is
Ninstructions_TOTAL = Ninstructions_A + Ninstructions_B + Ninstructions_C + Ninstructions_D = 55 * 106
So Ninstructions_TOTAL = 55 * 106.
The frequency is f = 2 * 109 Hertz, which means Tclock = 1 / f = 0.5 * 10-9 seconds.
So Tclock = 0.5 * 10-9.
The number of clock cycles need to execute the instructions is
No_of_cycles = Ninstructions_A * CPIA + Ninstructions_B * CPIB + Ninstructions_C * CPIC + Ninstructions_D * CPID = (25 * 1.3 + 15 * 1.9 + 10 * 2.5 + 5 * 3.8) * 106 = 105 * 106
So No_of_cycles = 105 * 106
So we have Ninstructions_TOTAL = 55 * 106 instructions which are executed in No_of_cycles = 105 * 106 clock cycles, and each clock cycle takes Tclock = 0.5 * 10-9 seconds.
This means that the total execution time is
Texec_time = No_of_cycles * Tclock = 105 * 106 * 0.5 * 10-9 seconds
Texec_time = 52.5 * 10-3 seconds
So our processor executes Ninstructions_TOTAL = 55 * 106 instructions in Texec_time = 52.5 * 10-3 seconds. This means
MIPS = Ninstructions_TOTAL / Texec_time = (55 * 106) / (52.5 * 10-3) = 1.0476 * 109 = 1047.6 * 106
In other words, our processor executes about one billion instructions per second, or 1047.6 Mega instructions per second.
So MIPS = 1047.6.
10.
The two numbers must be represented on the same number of bits.
m = 12 = 01100
n = -8 = 11000 (in Two's Complement) and 11000 (in Signed Magnitude integers numbering system)
a) In Two's Complement, multiplication is commutative. It is easier if we multiply -8 by 12:
Explanation: the partial products must be created taking into account that the first number (11000) is negative. This means that the partial products are all either 0 or negative! After obtaining each partial product, we add all of them. The addition can only be done between operands of the same size, so all the partial products must be extended to have the same size. In real life we usually don't write, because we consider the most significant positions and also the least significant positions to be 0.
To have an idea about this, let's first represent the least significant positions, in BOLD characters.
In Two's Complement, the extension is a sign-extension, so:
- the partial products that are zero will be sign-extended with 0s
- the partial products that are non-zero will be sign-extended with 1s
That is why the complete diagram looks like this:
So 12 * (-8) = -96 = 10100000 in Two's Complement
(in Two's Complement 10100000 = 1110100000, because the most significant bits are just a sign extension).
So m * n = -96 = 10100000 in Two's Complement.
a) In Signed Magnitude the MSB is the sign (1 for negative, 0 for positive)
m = 1 1100
n = 0 1000
Here the multiplication is easier to perform. We just compute first the sign bit of the result as an XOR between the sign bits. We can easily see that the sign bit of the result will be 1.
Then, we simply multiply the absolute values of m and n:
So m * n = 1110000 = -96 in Signed Magnitude numbering system.
pfa