Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Amdahl’s Law - Computer Architecture and Engineering - Exams, Exams of Computer Architecture and Organization

Main points of this past exam are: Amdahl’S Law, Principle Components, Integer Arithmetic, Instruction Class, Floating Point, Branches, Mips Rating, Optimized Version, Unoptimized Program, Maximum Speedup

Typology: Exams

2012/2013

Uploaded on 04/02/2013

shashikanth_0p3
shashikanth_0p3 🇮🇳

4.8

(8)

55 documents

1 / 16

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
University of California, Berkeley
College of Engineering
Computer Science Division EECS
Fall 1999 John Kubiatowicz
Midterm I
October 6, 1999
CS152 Computer Architecture and Engineering
Your Name:
SID Number:
Discussion Section:
Problem Possible Score
120
215
335
430
Total
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Amdahl’s Law - Computer Architecture and Engineering - Exams and more Exams Computer Architecture and Organization in PDF only on Docsity!

University of California, Berkeley College of Engineering Computer Science Division  EECS

Fall 1999 John Kubiatowicz

Midterm I

October 6, 1999 CS152 Computer Architecture and Engineering

Your Name:

SID Number:

Discussion Section:

Problem Possible Score

1 20

2 15

3 35

4 30

Total

Problem 1: Performance

Problem 1a: Name the three principle components of runtime that we discussed in class. How do they combine to yield runtime?

Problem 1b: What is Amdahl’s law for speedup? State as a formula which includes a factor for clock rate.

Let us suppose that you have been running an important program on your company’s 300MHz Acme II processor. By running a detailed simulator, you were able to collect the following instruction mix and breakdown of costs for ezach instruction type:

Instruction Class Frequency (%) Cycles Integer arithmetic and logical 40 1 Load 20 1 Store 10 2 Branches 20 3 Floating Point 10 5 Problem 1c : What is the CPI and MIPS rating of the Acme II for this program?

Problem 1d: Suppose that you turn on the optimizer and it eliminates 30% of the arithmetic/logic instructions (i.e. 12% of the total instructions), 30% of load instructions, and 20% of the floating-point instructions. None of the other instructions are effected. What is the speedup of the optimized program? (Be sure to state the formula that you are using for speedup and show your work)

Problem 2: Propagation Delay

Problem 2a: Assume the following characteristics for NAND gates: Input load: 150fF, Internal delay: TPlh=0.2ns, TPhl=0.5ns, Load-Dependent delay: TPlhf=.0020ns, TPhlf=.0021ns

For the circuit below, assume that inputs X 0 – X 5 are all set to 1. What are the propagation delays from A to Y (for rising and falling-edges of Y)?

X 0

A

X 1

Y

Z

X 2 X 3 X 4 X 5

Problem 2b : Suppose that we construct a new gate, XOR, as follows:

Compute the standard parameters for the linear delay models for this complex gate, assuming the parameters given above for the NAND gate:

A Input Capacitance: Load-dependent Delays: B Input Capacitance: TPAYlhf: TPAYhlf: TPBYlhf: TPBYhlf:

Internal delays for A⇒Y, assuming that B is set to 1 (worst case delays): TPAYlh: TPAYhl:

Problem 2c: Now, suppose we use our new XOR gate in the circuit below. Let X 0 – X 5 be set to 1. Compute the propagation delays from A ⇒ Y (both rising and falling edges):

A

B

Y

X 0

A

X 1

Y

Z

X 2 X 3 X 4 X 5

Problem 3a: The above example showed unsigned M. Is it easy extend the algorithm for a signed M?

Problem 3b: From this point on, assume M is unsigned. For a 64-bit, unsigned-value M, what is the largest possible integer square-root, S (^) max? How many bits would it take to represent? Explain without using a calculator. ( hint: Start by finding the smallest integer that is bigger than S (^) max ).

Problem 3c: Also for a 64-bit unsigned-value M, what is the largest possible remainder, R (^) max? How many bits would it take to represent? Explain without using a calculator. ( Use the same hint as above).

Here is pseudo-code for a square root algorithm. Assume that the input value of M has been restricted so that S (^) max is no more than 31 bits in size and R (^) max is no more than 32 bits in size. Let Result and Remain be 32-bit global values which will store the square root and remainder respectively. Inputs Mhi and Mlow are 32-bit arguments that give the upper and lower 32-bits of the input. This code is modeled after version 3 of the divider from class:

isqrt(Mlow ,Mhi ) ⇒ (Result, Remainder) { /* All temporaries are 32-bit values */ int nextbit, temp, topbit, lowerbits;

/* missing initialization instructions */

while (nextbit > 0) { ROL96(topbits,Remainder, lowerbits);

/* Above restrictions on M ensure temp only 32 bits. */ temp = (2 * Result) | nextbit; if (topbits > 0 || Remainder ≥ temp) { Result = Result | nextbit; SUBcarry(topbits, Remainder, temp); } nextbit = nextbit >> 1; } }

The ROL96(hi,low,extra) pseudo-instruction takes three 32-bit registers and treats them as a combined 96-bit register. It shifts the combined value left by one position, inserting a zero at the far right (of the extra register).

The SUBcarry(hi,low,subvalue) pseudo-instruction takes three 32-bit registers. It treats the first two as a combined 64-bit register. It subtracts the 32-bit subvalue from this 64-bit register.

Problem 3d: The pseudo-code is missing some initialization instructions. What should be there? ( hint: look at the example square root again and try to figure out what the various arguments to ROL96 must be. Also, make sure that every variable has an initial value!):

Problem 3f: Implement the ROL96($t0,$t1,$t2) pseudo-instruction in 7 MIPS instructions. Assume that $t0, $t1, and $t2 are the three input registers (with $t0 the most significant). (hint: what happens if you use signed slt on unsigned numbers?)

Problem 3g: Implement the SUBcarry($t0,$t1,$t2) pseudo-instruction in 3 MIPS instructions.

Problem 3h: What is the maximum “CPI” of your isqrt() procedure? (i.e. what is the total number of cycles to perform an isqrt)? Assume that each real MIPS instruction takes 1 cycle, and pseudo- instructions ROL96 and SUBcarry take 7 and 3 cycles respectively:

EXTRA CREDIT [5pts => Save until last!]: Draw the data path for a hardware square-root engine that does 64-bit square-roots. Explain what you are doing and how this will be controlled.

In class, we made our multicycle machine support the following six MIPS instructions:

op | rs | rt | rd | shamt | funct = MEM[PC] op | rs | rt | Imm16 = MEM[PC]

INST Register Transfers ADDU R[rd] ← R[rs] + R[rt]; PC ← PC + 4 SUBU R[rd] ← R[rs] - R[rt]; PC ← PC + 4 ORI R[rt] ← R[rs] + zero_ext(Imm16); PC ← PC + 4 LW R[rt] ← MEM[ R[rs] + sign_ext(Imm16)]; PC ← PC + 4 SW MEM[R[rs] + sign_ext(Imm16)] ← R[rs]; PC ← PC + 4 BEQ if ( R[rs] == R[rt] ) then PC ← PC + 4 + sign_ext(Imm16) || 00 else PC ← PC + 4

For your reference, here is the microcode for two of the 6 MIPS instructions:

Label ALU SRC1 SRC2 ALUDest Memory MemReg PCWrite Sequence Fetch Add PC 4 ReadPC IR ALU Seq Dispatch Add PC ExtShft Dispatch

RType Func rs rt Seq rd-ALU Fetch BEQ Sub rs rt ALUoutCond Fetch

In this problem, we are going to add three new instructions to this data path:

lui $rd, ⇒ R[rd] ← Imm16 || 0000000000000000 multacc $rd, $rs, $rt ⇒ R[rd] ← (R[rs]×R[rt]) + R[rd] bltual $rs, $rt if (R[rs] < R[rt]) then PC ← PC + 4 + sign_ext(Imm16) || 00 R[31] ← PC + 4 else PC ← PC + 4

1. The lui instruction is familiar to you from the normal MIPS instruction set. It places the 16 bit immediate field into the upper 16 bits of R[rd], filling the lower 16 bits of R[rd] with zeros. Important note: the encoding for the lui instruction has a zero in the rs field.

  1. The multacc instruction (multiply-accumulate) uses register R[rd] as both a source and a destination register. It multiplies the values R[rs] and R[rt], adds the result to register R[rd], then places the result back into register R[rd]. Assume that this instruction does not overflow.
  2. The bltual instruction (branch on less than unsigned and link) checks to see if R[rs] is less than R[rt]. If it is, it will save the PC in $ra (like jal), then branch to the offset.

Problem 4a: How wide are microinstructions in the original datapath (answer in bits and show some work!)?

Problem 4b: Draw a block diagram of a microcontroller for the unmodified datapath. Include sequencing hardware, the dispatch ROM, the microcode ROM, and decode blocks to turn the fields of the microcode into control signals. Make sure to show all of the control signals coming from somewhere. ( hint: The PCWr, PCWrCond, and PCSrc signals must come out of a block connected to thePCWrite field of the microinstruction).

Problem 4c: Come up with a binary encoding for the ALUDest field of the microinstruction (rd-ALU, rt-ALU, rt-Mem, or blank). Construct logic which maps this binary field to the appropriate control signals from problem 4b.

Problem 4e: Describe changes to the microinstruction assembly language for these new instructions. How wide are your microinstructions now?

Problem 4f: Write complete microcode for the three new instructions. Include the Fetch and Dispatch microinstructions. If any of the microcode for the original instructions must change, explain how ( Hint: since the original instructions did not use R[rd] as a register input, you must make sure that your changes do not mess up the original instructions).

Problem 4g: What are the CPI values for each of the three new instructions?