University of California, Berkeley College of Engineering

Similar documents
University of California, Berkeley College of Engineering

University of California, Berkeley College of Engineering

University of California, Berkeley College of Engineering

University of California, Berkeley College of Engineering

University of California, Berkeley College of Engineering

Department of Electrical Engineering and Computer Sciences Fall 2017 Instructors: Randy Katz, Krste Asanovic CS61C MIDTERM 2

University of California, Berkeley College of Engineering

University of California, Berkeley College of Engineering

Department of Electrical Engineering and Computer Sciences Spring 2007 Instructor: Dr. Dan Garcia

University of California, Berkeley College of Engineering

Computer Architecture I Midterm I (solutions)

Department of Electrical Engineering and Computer Sciences Spring 2013 Instructor: Dr. Dan Garcia CS61C Midterm

University of California, Berkeley College of Engineering

Department of Electrical Engineering and Computer Sciences Fall 2016 Instructors: Randy Katz, Bernhard Boser

CS61C Midterm 2 Review Session. Problems Only

Computer Architecture I Midterm I

Department of Electrical Engineering and Computer Sciences Fall 2016 Instructors: Randy Katz, Bernhard Boser

Department of Electrical Engineering and Computer Sciences Spring 2010 Instructor: Dr. Dan Garcia CS61C Midterm

CS61C Midterm 2 Review Session. Problems + Solutions

University of California, Berkeley College of Engineering

Final Exam Fall 2007

University of California, Berkeley College of Engineering

Final Exam Fall 2008

OPEN BOOK, OPEN NOTES. NO COMPUTERS, OR SOLVING PROBLEMS DIRECTLY USING CALCULATORS.

2B 52 AB CA 3E A1 +29 A B C. CS120 Fall 2018 Final Prep and super secret quiz 9

Computer System Architecture Quiz #1 March 8th, 2019

Department of Electrical Engineering and Computer Science Spring 2004 Instructor: Dan Garcia CS61C Midterm

McGill University Faculty of Engineering FINAL EXAMINATION Fall 2007 (DEC 2007)

University of California, Berkeley College of Engineering

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro

CSE 378 Final Exam 3/14/11 Sample Solution

Computer Architecture and Engineering. CS152 Quiz #5. April 23rd, Professor Krste Asanovic. Name: Answer Key

Computer Science 61C Spring Friedland and Weaver. The MIPS Datapath

Name: University of Michigan uniqname: (NOT your student ID number!)

ECE 313 Computer Organization EXAM 2 November 11, 2000

Department of Electrical Engineering and Computer Sciences Fall 2003 Instructor: Dave Patterson CS 152 Exam #1. Personal Information

University of California, Berkeley College of Engineering Department of Electrical Engineering and Computer Science

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences. Spring 2010 May 10, 2010

1. Truthiness /8. 2. Branch prediction /5. 3. Choices, choices /6. 5. Pipeline diagrams / Multi-cycle datapath performance /11

ECE 313 Computer Organization FINAL EXAM December 14, This exam is open book and open notes. You have 2 hours.

CS 2506 Computer Organization II

Computer Architecture CS372 Exam 3

University of California, Berkeley College of Engineering

University of California, Berkeley College of Engineering

/ : Computer Architecture and Design Fall 2014 Midterm Exam Solution

CSCE 212: FINAL EXAM Spring 2009

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012

Format. 10 multiple choice 8 points each. 1 short answer 20 points. Same basic principals as the midterm

CS61C Midterm After the exam, indicate on the line above where you fall in the emotion spectrum between sad & smiley...

Final Exam Spring 2017

CS 230 Practice Final Exam & Actual Take-home Question. Part I: Assembly and Machine Languages (22 pts)

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

4. What is the average CPI of a 1.4 GHz machine that executes 12.5 million instructions in 12 seconds?

EE557--FALL 1999 MAKE-UP MIDTERM 1. Closed books, closed notes

THE HONG KONG UNIVERSITY OF SCIENCE & TECHNOLOGY Computer Organization (COMP 2611) Spring Semester, 2014 Final Examination

Computer Architecture V Fall Practice Exam Questions

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

Computer Architecture and Engineering. CS152 Quiz #1. February 19th, Professor Krste Asanovic. Name:

Winter 2002 FINAL EXAMINATION

CSE 378 Midterm 2/12/10 Sample Solution

SOLUTION. Midterm #1 February 26th, 2018 Professor Krste Asanovic Name:

CS61C Final After the exam, indicate on the line above where you fall in the emotion spectrum between sad & smiley...

CS 351 Exam 2 Mon. 11/2/2015

CS61C Fall 2013 Final Instructions

CS61C Summer 2013 Final Review Session

Memory Hierarchy, Fully Associative Caches. Instructor: Nick Riasanovsky

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro

University of California, Berkeley College of Engineering

Midterm. CS64 Spring Midterm Exam

NATIONAL UNIVERSITY OF SINGAPORE

#1 #2 with corrections Monday, March 12 7:00pm to 8:30pm. Please do not write your U of C ID number on this cover page.

Patrick Murray 4/17/2012 EEL4713 Assignment 5

/ : Computer Architecture and Design Fall Midterm Exam October 16, Name: ID #:

Grading: 3 pts each part. If answer is correct but uses more instructions, 1 pt off. Wrong answer 3pts off.

ECE 313 Computer Organization FINAL EXAM December 13, 2000

CENG 3531 Computer Architecture Spring a. T / F A processor can have different CPIs for different programs.

CS3350B Computer Architecture Quiz 3 March 15, 2018

University of California, Berkeley College of Engineering

EXAM #1. CS 2410 Graduate Computer Architecture. Spring 2016, MW 11:00 AM 12:15 PM

Cache Organizations for Multi-cores

Computer Architecture and Engineering CS152 Quiz #3 March 22nd, 2012 Professor Krste Asanović

UC Berkeley CS61C : Machine Structures

Chapter 2. Instructions:

ECE 2035 Programming HW/SW Systems Fall problems, 7 pages Exam Two 23 October 2013

Q1: /30 Q2: /25 Q3: /45. Total: /100

ECE/CS 552: Introduction to Computer Architecture ASSIGNMENT #1 Due Date: At the beginning of lecture, September 22 nd, 2010

ECE550 PRACTICE Midterm

Student Number: UTORid: Question 0. [1 mark] Read and follow all instructions on this page, and fill in all fields.

CS61C Final Exam After the exam, indicate on the line above where you fall in the emotion spectrum between sad & smiley...

CS 151 Final. (Last Name) (First Name)

Design of Digital Circuits ( L) ETH Zürich, Spring 2017

NAME: 1a. (10 pts.) Describe the characteristics of numbers for which this floating-point data type is well-suited. Give an example.

Alexandria University

RECITATION SECTION: YOUR CDA 3101 NUMBER:

CS 251, Winter 2019, Assignment % of course mark

MCS-284 Final Exam Serial #:

ECE 313 Computer Organization FINAL EXAM December 14, This exam is open book and open notes. You have 2 hours.

6.823 Computer System Architecture Datapath for DLX Problem Set #2

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

CS2100 COMPUTER ORGANISATION

Transcription:

University of California, Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences Spring 2016 Instructors: Vladimir Stojanovic, Nicholas Weaver 2016-04-04 L J After the exam, indicate on the line above where you fall in the emotion spectrum between sad & smiley... Last Name First Name Student ID Number CS61C Login cs61c- The name of your SECTION TA (please circle) Alex Chris Howard Jack Jason Rebecca Stephan William Name of the person to your LEFT Name of the person to your RIGHT All the work is my own. I had no prior knowledge of the exam contents nor will I share the contents with others in CS61C who have not taken it yet. (please sign) Instructions (Read Me!) This booklet contains 10 numbered pages including the cover page. Please turn off all cell phones, smartwatches, and other mobile devices. Remove all hats & headphones. Place your backpacks, laptops and jackets under your seat. You have 110 minutes to complete this exam. The exam is closed book; no computers, phones, or calculators are allowed. You may use one handwritten 8.5 x11 page (front and back) of notes in addition to the provided green sheet. There may be partial credit for incomplete answers; write as much of the solution as you can. We will deduct points if your solution is far more complicated than necessary. When we provide a blank, please fit your answer within the space provided. Points Possible Q1 Q2 Q3 Q4 Q5 Q6 Total 16 6 12 20 20 6 80

Corrections: Q1c: Please only use 2-input AND and OR gates and 1-input NOT gates Q1d: For the example, if the input is 111001, you would output 101110, not 101100. Q4a: The comparator logic happens WITHIN the decode stage (just at the end) Q4b: The End label is not part of the loop Q5: Loop 1 should use N_ROWS and N_COLS instead of NUM_ROWS/NUM_COLS. Cache is write back with write allocate. Q6: S is a 2-bit unsigned number 2/11

Q1: Ben Bitdiddle s Plight (16 points) Ben Bitdiddle was asked to design a new circuit to be used in an awesome top secret project. Unfortunately, Ben Bitdiddle isn t the best when it comes to circuit design, and this one has a lot of excess gates that aren t needed, so it s up to us to create a simpler one for him. a) Fill out the truth table for this circuit. One row of the table is already filled out for you. A B C Out 0 0 0 1 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 b) Given your truth table from part a, use sum of products to write the unsimplified, boolean expression for this circuit. This question will be graded independently of the correctness of part a. DO NOT simplify the expression. 3/11

c) To decouple this question from the previous parts, lets say after you derived the boolean expression and did some simplifying, you got: ( B C)(A + Ā)+Ā BC Using boolean logic, simplify the expression further so that it uses as few gates as possible. Draw the new circuit that corresponds the simplified expression. You may only use NOT, AND, and OR gates Ben s boss is very pleased with his work, and he gets another task for this super secret project! d) Design a FSM that takes in either 0 or 1 as input, and outputs 1 if the total number of 1s seen is odd or the total number of 0s seen is odd, and 0 otherwise. For example, if the input was 111001, you would output 101100 You may not need all of the provided states. One transition is given to you. 4/11

Q2: Timing question (6 points) For the following circuit below, assume that circuit has the following timing criteria: Inverter delay (NOT): 2 ns OR block delay: 8 ns XOR block delay: 16 ns AND gate delay: 6 ns Register setup time: 3 ns The inputs come every 2 ns after every clock edge. a) Assuming the clk-to-q delay is 1 ns, what is the shortest possible clock period at which we can run this circuit at? ns b) Assuming a clock period of 30 ns, what s the maximum possible clk-to-q of the circuit? ns 5/11

Q3: A DataPath-finding Problem (12 points) a) Below is an incomplete datapath for the third stage of a five-stage MIPS pipelined processor. Fill in the datapath so that it can execute any of the instructions given in the table below (part b). You may use 2-1 multiplexers, sign extenders, zero extenders, and any of the basic logic gates to build your datapath. Use tunnels whenever necessary to keep things clean. Do not worry about data hazards or forwarding logic. You also do not have to worry about the switch input on the ALU. You should use only the control signals given in the table. Assume that, for shifts, the ALU shifts Y by X. b) Fill in the values the control signals should take for each instruction. If the value of a signal does not matter for a particular instruction, fill in an X for don t care. Instruction shift sign_ext use_imm add addi ori sll lw 6/11

Q4: Pipelining (20 points) Consider the following code segment: Loop: lw $t1 0($t2) srl $t1 $t1 16 sw $t1 0($t2) addi $t2 $t2-4 sub $t4 $t3 $t2 bne $t4 $0 loop End: sll $0 $0 $0 Assume that originally, $t3 = $t2-196 a) Assume a standard 5 stage pipeline with no forwarding. Register file writes happen before reads, in the same clock cycle. Comparator logic begins at the end of the decode stage. We do not have a branch delay slot. Fill in the corresponding pipeline stages (F, D, E, M, W) at the appropriate times in the table below. If the instruction requires a stall, write the stage again in the table. For example, if an instruction starts at cycle 2 but needs two stalls for the execute stage, then you would write F D E E E M W for cycles 2-8. Instr/Cycle 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 lw $t1 0($t2) srl $t1 $t1 16 sw $t1 0($t2) addi $t2 $t2-4 sub $t4 $t3 $t2 bne $t4 $0 loop b) How many cycles does this loop take to fully execute (from the first lw to the End label)? cycles 7/11

c) Now assume the pipeline has 1 delayed branch slot and standard forwarding hardware. Also, reordering of instructions is allowed to minimize stalls. Write out the reordered sequence of instructions that achieves a minimal number of stalls needed. If you would like, you may also fill in the rest of the table below, but it will not be graded. Instr/Cycle 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 d) How many cycles does this loop take to fully execute (from the first lw to the End label)? cycles 8/11

Q5: Time to Cache in on all of that studying (20 points) Assume we have a direct mapped cache with 16 blocks. Each block holds 8 bytes. Assume also that both memory addresses and integer variables are 32 bits in size. You can also assume that the code starts executing with a cold cache. a) What is the number of tag, index, and offset bits used by the cache? Tag: Index: Offset: Consider the following C code: #define N_COLS 8 #define N_ROWS 8 int *a = malloc(sizeof(int) * N_ROWS * NCOLS); int i, j; int total = 0; /* Loop 1 */ for (i = 0; i < NUM_ROWS; i++) { for (j = 0; j < NUM_COLS; j++) { a[i * N_COLS + j] = i + j; } } /* Loop 2 */ for (j = 0; j < N_COLS; j++) { for (i = 0; i < N_ROWS; i++) { total += a[i * N_COLS + j]; } } Assume that array a is cache-aligned. Assume also that the compiler places total, i, and j in registers rather than in memory. b) What is the cache hit rate (in percentage) when Loop 1 is executed? If any cache misses occur, what kind are they (which of the 3 C s)? Hit Rate: % Miss types: 9/11

c) What is the cache hit rate (in percentage) when Loop 2 is executed? Note that this immediately follows the execution of Loop 1. If any cache misses occur, what kind are they (which of the 3 C s)? Hit Rate: % Miss types: Now, say we double the number of blocks in the cache, so it now has 32 blocks each storing 8 bytes. Remember, we start with a cold cache. d) What is the number of tag, index, and offset bits used by the cache? Tag: Index: Offset: e) What is the cache hit rate (in percentage) when Loop 1 is executed? If any cache misses occur, what kind are they (which of the 3 C s)? Hit Rate: % Miss types: f) What is the cache hit rate (in percentage) when Loop 2 is executed? Note that this immediately follows the execution of Loop 1. If any cache misses occur, what kind are they (which of the 3 C s)? Hit Rate: % Miss types: 10/11

Q6: This is a Complex Floating Point (6 points) Consider the following 16-bit representation for complex, floating point numbers: S Exponent Significand 15 14 13 8 7 0 Bits per field: Sign: 2 (Now all numbers are in the form i Sign ) Example - If you wanted to represent a number with -1 sign, your sign bits would be 10 Exponent: 6 Significand: 8 Everything else follows the IEEE standard 754 for floating point, except in 16 bits Bias: 31 a) Convert 11.3125i into floating point using our new representation. Write your answer in hexadecimal. 0x b) We want to be able to represent positive integers of the form 2 n 8. What is the largest such number that can be represented by the above complex floating point representation? n = c) Are there more imaginary numbers, more real numbers, or an equal number of both with this representation? You can ignore infinities and NaNs for this question. More imaginary More real Equal Congratulations on finishing! Remember to fill in the emotional spectrum on the title page. 11/11