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

Size: px
Start display at page:

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

Transcription

1 The University of Michigan - Department of EECS EECS370 Introduction to Computer Organization Midterm Exam 1 October 22, 2009 Name: University of Michigan uniqname: (NOT your student ID number!) Open book, open notes. No laptops, PDAs, cell phones, etc. (calculators are ok). This exam has 6 sets of questions, 15 pages, and 65 points. Questions vary in difficulty; it is strongly recommended that you do not spend too much time on any one question. For questions where a box is provided, please put your final answer in the box. Question Points 1 Short questions /6 2 Floating Point Arithmetic /12 3 Single Cycle Datapath /12 4 ISA Design /15 5 MIPS /10 6 Caller/Callee /10 Total /65 The rules of the Honor Code of the University of Michigan - College of Engineering apply for this exam. Honor code pledge: I have neither given nor received aid on this examination, nor have I concealed any violations of the Honor Code. Signature: (Exams without a signed pledge will not be graded) Page 1/15

2 1. Short Answer Questions [6 points] a) [3 points] The LC2K instruction set lacks a subtract instruction. Show in LC2K assembly how to subtract an operand in register 2 from an operand in register 1, with the result of the subtraction placed in register 3. lw 0 4 neg1 nand add add b) [3 points] Which addressing mode does the following sequence of LC-2K instructions emulate? Assume the initial value of register 0 is zero. a) Register lw lw lw b) Base + displacement c) Indirect d) Double indirect e) PC relative Page 2/15

3 2. Floating Point Arithmetic [12 points] We have constructed a new 10-bit floating point format: 1 bit sign 3 bit exponent with a bias of 3 6 bit mantissa (a.k.a. significand) All other aspects of this format are exactly the same as the standard IEEE floating point studied in class. You must show your work on this problem to be eligible for partial credit. If you need more space, attach another sheet, but label it clearly. a) [2 points] What is the largest number that can be represented exactly in this format? Give both its floating point and decimal representations Floating point: S E E E M M M M M M Decimal: * 2^4 = == b) [4 points] Convert the following two floating point values to decimal: S E E E M M M M M M Decimal: * 2^3 = = S E E E M M M M M M Page 3/15

4 Decimal: * 2^-1 =.101 = c) [4 points] Multiply the two floating point numbers given in part (b) and report your result in the floating point format: Product: S E E E M M M M M M Sign is negative Exponent is = 5 == 2^2 Mantissa multiplication: x Note that the low order two bits are truncated because of limited mantissa space. Hence, the product is * 2^2 == == d) [2 points] Because of limitations on the number of bits in the mantissa, floating point calculations often lose precision. What is the absolute difference between your answer for part (c) and the exact product of the two numbers given in part (b). The exact product is The difference is or 1/64 th. This can easily be determined by examining the value of the bits truncated during the multiplication. Page 4/15

5 3. Single-Cycle Datapath [12 points] The figure on page 9 illustrates the single-cycle LC2K architecture discussed in class. a) [4 points] Assume we want to have a combinational circuit (the box labeled 0? inside the dashed circle) that takes the (32-bit) result of ALU as input and outputs a single bit, Z, which is 1 if and only if the result of the operation done by ALU is zero. For example if you execute add and registers 1 and 2 respectively hold values 5 and -5 then Z will be 1 in that cycle. Sketch the design for this circuit. You may use basic logic gates (e.g., NAND, AND, OR, Inverter) of any number of inputs. All 32 bits of ALU result go into OR gate, then invert the result b) [8 points] Suppose we want to add a new instruction, lbr (loop branch), to LC2K and assign it opcode 7 (111 binary), which was previously unused. lbr has two operands: R and a 16-bit displacement, which are stored in bits and 15-0 respectively. (Similar to I-type instructions, except bits are not used.) lbr decrements register R by 1 and if the new value of register R is not 0 then it branches to PC displacement. Note that regardless of whether or not the branch is taken, R should be updated to contain the decremented value. i. Modify the figure on page 9 to show what extra circuitry must be added to implement this instruction. ii. The following table shows the contents of the control ROM. Fill in the values for line 7. If you need to add control signals in your design, add a new column for each and fill in the entries of the new column for every line of the ROM. If you include multiplexers (MUX's) with more than one select line, be sure to indicate which line is the high-order and which line is the low-order select input. Page 5/15

6 Use these columns for new control signals (if needed.) C 0 C 1 C 2 C 3 C 4 C 5 C 6 C 7 CC 8 CC 9 C 1 C 1 Line Line Line Line 3 This part of ROM is not important to us. 0 0 Line Line Line Line X 1 1 iii. Provide a brief explanation of the sequence of events that take place in your design to execute lbr? Add -1 as an input to MUX before ALU; new control signal C8 for MUX. Add an AND gate with inputs being the three opcode bits and the output of Z inverted. Connect output of this gate to an OR gate along with the BEQ AND gate s output, and loop the output of the OR gate to the MUX control signal that the BEQ AND gate s output originally was connected to. Connect bits to write MUX for register file, add control signal C9 for that MUX. Assume: new inputs to MUX go to the bottom, new control signals go to the left (and are most significant) With the proper control signals: R is added to -1 and Z determines if the result is 0. If not, and the instruction is lbr, this sends PC offset to the PC. R 1 is sent back to the register file. Page 6/15

7 Page 7/15

8 4. ISA Design [15 points] You are the Chief Architect at Broken Arrows, a company specializing in low-overhead, processor design. The ISA for the company s flagship processor, is documented in the tables below. Instructions are 11 bits long. Data and memory addresses are all 8 bits long. The design is a CISC, byte-addressable instruction set. There is one single register, the AllAlone register (called AA) and a stack, to assist with all computation. There are 3 instruction formats, explained below. R-type Instructions Bits 10-3 Bits 2-0 Instruction Opcode Action unused opcode Pop 001 Pop the [top] value from the stack and stores it in AA, resulting in one less value on the stack. Push 010 Push the value of AA onto the top of stack, resulting in one more value on the stack. Halt 011 Halt the processor. I-type Instructions Bits 10-3 Bits 2-0 Instruction Opcode Action 2 s complement immed (IMM) opcode Pushi 000 Push the signextended immediate value onto the stack. Beqnz 100 Pop the [top] entry from the stack. If it is not zero, start executing at PC+1+IMM, where IMM is the sign-extended immediate value. Otherwise, execute the next instruction at PC+1. LoadAdd 101 Form a memory address by popping the [top] stack entry and adding it to the sign-extended immediate value IMM. Now add 1 to the word loaded from memory and then push it onto the stack. StoreSub 110 Form a memory address by popping the [top] stack entry and adding it to the sign-extended immediate value IMM. Pop the [top- 1] stack entry, subtract one and store it to that address in memory. Tadt 111 Tadt stands for Test-And-Divide-by-Two. Form a memory address by popping the [top] stack entry and adding it to the sign-extended immediate value IMM. Compares the value of AA with the value stored at the memory location specified by the address. If the value in AA is less than or equal to the memory value, the value in AA is divided by 2. Q-type Instructions Instruction Opcode ALUOp Bits 10-9 Bits 8-3 Bits 2-0 ALU op unused opcode StAdd Remove the [top] value from the stack, add one and push onto the top of stack. StSub Remove the [top] value from the stack, subtract one and push onto the top of stack. Page 8/15

9 StNand Remove the [top] value from the stack, NAND with the value stored in AA and push the result onto the top of stack. a) [3 points] Translate the following instructions into machine code. Assembly Binary Hexadecimal LoadAdd x 7e5 Tadt x 767 StNand x 401 b) [4 points] The loadadd instruction uses base + displacement memory addressing mode. You are asked to design a new pseudo-instruction loaddir, which uses a direct memory addressing mode. The memory address for loaddir is specified using the 8-bit IMM field as an unsigned address. (i) What is the range of values that the immediate field (IMM) can encode for the loadadd instruction? Solution: [min value] [max value] (ii) What is the range of values that the immediate field (IMM) can encode for the new loaddir pseudo-instruction? Solution: [min value] [max value] Page 9/15

10 c) [8 points] Suppose a number (not zero) in 2 s complement form is stored at memory address 100. Write a short assembly program using the new ISA design described before to find out if the number is even or odd. If the number is even, do nothing. If the number is odd, shift it right once. Store the result back(in either case) at the memory location 101. [Note: You cannot assume any data stored in memory, unless specified. Also you cannot use the pseudo instruction loaddir] Solution : 0 Pushi 100 // block 1 1 LoadAdd 0 2 StSub 3 Pop 4 Pushi 1 // block 2 5 StNand 6 Pushi 1 7 StNand // block 2 8 Pop store one copy of value in AA 9 StNand 10 Pushi 100 // block 1 11 LoadAdd 0 12 StSub 13 Pop //restore the original value back in AA 14 Beqnz 2 15 Pushi 1 16 Beqnz 2 17 Pushi Tadt 0 19 Push 20 StAdd 21 Pushi StoreSub 0 23 Halt Page 10/15

11 5. MIPS [10 points] [10 points] Your friend has asked you to debug his MIPS code. His professor has asked him to implement the SAXPY code. SAXPY (Scalar Alpha X Plus Y) is one of the functions in the Basic Linear Algebra Subprograms (BLAS) package, and is a common operation in computations with vector processors. SAXPY is a combination of scalar multiplication and vector addition, as defined by the algorithm below: //x starts at mem address = 500 int x[10] = { 100, 122, 58, 123, 91, 110, 86, 54, 37, 42}; int y[10] = { 120, 16, 83, 130, 71, 10, 99, 78, 32, 63};... int a = 150; // mem address = 700 main(void) { int i; for (i=0; i < 10; i++) { y[i] = a*x[i] + y[i]; } } start: li $r5,0 li $r10,700 lw $r6, 0($r10) li $r7,500 li $r1,510 li $r4,10 loop: lw $r2,0($r7) mult $r2,$r6 mflo $r2 lw $r3,0($r1) add $r3,$r2,$r2 sw $r2,0($r1) addi $r7,$r7,1 addi $r1,$r1,1 addi $r5,$r5,1 beq $r4,$r5,loop halt Page 11/15

12 What is wrong with your friend s code? Write down which instruction or instructions are causing the code to fail. Explain what needs to be changed or what needs to be added. Notes: there may be more than one problem with the above code. The li instruction is a load immediate in which the register gets loaded with an immediate value. When the mult instruction is run, assume no overflow of the 32 bit register. The first incorrect instruction is the li $r1, 510. We know that x starts at 500 and goes to 539 (40 bytes). Thus y should start at 540 and go till 579, thus the instruction should read li $r1,540 The second error is in the add $r3, $r2, $r2 instruction. In MIPS, the destination register is the first register specified. In this code, we are trying to add the a*x[i] term to y[i] and store the result in $r2 which gets saved in the next line to memory. However, this assembly line is saving the value of $r2 + $r2 into $r3, which is incorrect. We should change this to: add $r2, $r3, $r2 OR add $r2, $r2, $r3 Two more errors exist in the addi $r7,$r7,1 and addi $r1,$r1,1 lines. These lines of assembly tell us where we need to load the instructions from memory. Since the data is bytes, we need to increment the memory address by 4, not by 1. Thus the instructions should be: addi $r7,$r7,4 addi $r1,$r1,4 The final error is the beq instruction. This should read bne since we are comparing the value to 10, which is the number of elements in the array. If it was beq, the program would halt after one iteration. Thus it should read: bne $r4, $r5, loop Page 12/15

13 6. Caller/Callee [10 points] Suppose you are given the following code: int foo() { int a = 20, b = 10, c, i, j = 3; char *p = Hello World\n ; i = 0; bar(b); for (i = 0; i < 17; ++i) { c += a; b = bar(b); } c += j; } return c; int bar(int j) { int a = j; int b = a + 5; while (b > a) { printf("%d\n", b); --b; } } return a; The architecture that you are using contains 3 caller-saved registers ($1, $2, and $3) and 3 callee-saved registers ($4, $5, and $6). Page 13/15

14 a) [2 points] Assume the following register assignments for bar( ): a -> $1, b -> $2. What register should be assigned to each variable in foo( ) to minimize the total number of executed save/restore instructions? (NOTE: a single save or restore instruction in code can be executed multiple times if, for example, it resides within a loop) Fill in the table below. Variable Register in foo( ) a $4 b $1 c $5 i $6 j $2 p $3 b) [2 points] How many save/restore instruction pairs are executed during a single call to foo( ) using the assignments in part a)? Note that you will need to consider bar( ) as well, since we are looking for the total number (ignore printf for the purpose of counting). For function foo: a needs to be saved and restored once. (+1) b doesn t need to be saved or restored. c needs to be saved and restored once. (+1) i needs to be saved and restored once. (+1) j needs to be saved and restored once. (+1) p doesn t need to be saved or restored. For function bar, which is called once outside the loop and 17 times inside the loop: a needs to be saved and restored 18*5 times (+90) b needs to be saved and restored 18*5 times (+90) A total of 184 save/restore pairs are needed, or 368 total instructions. Page 14/15

15 c) [2 points] Now assume the following register assignments are made for bar( ): a->$4, b->$5. Repeat part a) for this configuration. Variable Register in foo ( ) a $4 b $1 c $5 i $6 j $2 p $3 No change is needed from part a). It may be tempting to try to re-assign callee-saved registers to unused variables like p so that bar doesn t need to preserve them, but remember that bar can potentially be called from another function that requires those registers to be preserved. d) [2 points] Repeat part b) with the configuration given in part c). Function foo is unchanged (4 total save/restore pairs). For function bar, which is called once outside the loop and 17 times inside the loop: a needs to be saved and restored 18*1 times (+18) b needs to be saved and restored 18*1 times (+18) A total of 40 save/restore pairs are needed, or 80 total instructions. e) [2 points] What can you conclude about bar s register assignments and the effect they have on optimizing foo? Regardless of how bar assigns its variables to registers, the optimal register assignment for foo remains the same. Page 15/15

The University of Michigan - Department of EECS EECS 370 Introduction to Computer Architecture Midterm Exam 1 February 17, 2011

The University of Michigan - Department of EECS EECS 370 Introduction to Computer Architecture Midterm Exam 1 February 17, 2011 The University of Michigan - Department of EECS EECS 370 Introduction to Computer Architecture Midterm Exam 1 February 17, 2011 Name: KEY_(Answers in red) University of Michigan uniqname: (NOT your student

More information

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

1. Truthiness /8. 2. Branch prediction /5. 3. Choices, choices /6. 5. Pipeline diagrams / Multi-cycle datapath performance /11 The University of Michigan - Department of EECS EECS 370 Introduction to Computer Architecture Midterm Exam 2 ANSWER KEY November 23 rd, 2010 Name: University of Michigan uniqname: (NOT your student ID

More information

CS 2506 Computer Organization II Test 1. Do not start the test until instructed to do so! printed

CS 2506 Computer Organization II Test 1. Do not start the test until instructed to do so! printed Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other computing devices may

More information

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

McGill University Faculty of Engineering FINAL EXAMINATION Fall 2007 (DEC 2007) McGill University Faculty of Engineering FINAL EXAMINATION Fall 2007 (DEC 2007) VERSION 1 Examiner: Professor T.Arbel Signature: INTRODUCTION TO COMPUTER ENGINEERING ECSE-221A 6 December 2007, 1400-1700

More information

3. Instruction Set Architecture The MIPS architecture

3. Instruction Set Architecture The MIPS architecture 3. Instruction Set Architecture The MIPS architecture EECS 370 Introduction to Computer Organization Winter 2007 Prof. Valeria Bertacco & Prof. Scott Mahlke EECS Department University of Michigan in Ann

More information

CS 2506 Computer Organization II

CS 2506 Computer Organization II Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other computing devices may

More information

Computer Architecture I Midterm I

Computer Architecture I Midterm I Computer Architecture I Midterm I April 11 2017 Computer Architecture I Midterm I Chinese Name: Pinyin Name: E-Mail... @shanghaitech.edu.cn: Question Points Score 1 1 2 12 3 16 4 14 5 18 6 17 7 22 Total:

More information

Computer Science and Engineering 331. Midterm Examination #1. Fall Name: Solutions S.S.#:

Computer Science and Engineering 331. Midterm Examination #1. Fall Name: Solutions S.S.#: Computer Science and Engineering 331 Midterm Examination #1 Fall 2000 Name: Solutions S.S.#: 1 41 2 13 3 18 4 28 Total 100 Instructions: This exam contains 4 questions. It is closed book and notes. Calculators

More information

Chapter 4. The Processor

Chapter 4. The Processor Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware We will examine two MIPS implementations A simplified

More information

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

Grading: 3 pts each part. If answer is correct but uses more instructions, 1 pt off. Wrong answer 3pts off. Department of Electrical and Computer Engineering University of Wisconsin Madison ECE 552 Introductions to Computer Architecture Homework #2 (Suggested Solution) 1. (10 points) MIPS and C program translations

More information

Chapter 4. The Processor

Chapter 4. The Processor Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware 4.1 Introduction We will examine two MIPS implementations

More information

CS 2506 Computer Organization II Test 1

CS 2506 Computer Organization II Test 1 Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other computing devices may

More information

Processor (I) - datapath & control. Hwansoo Han

Processor (I) - datapath & control. Hwansoo Han Processor (I) - datapath & control Hwansoo Han Introduction CPU performance factors Instruction count - Determined by ISA and compiler CPI and Cycle time - Determined by CPU hardware We will examine two

More information

ECE331: Hardware Organization and Design

ECE331: Hardware Organization and Design ECE331: Hardware Organization and Design Lecture 15: Midterm 1 Review Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Basics Midterm to cover Book Sections (inclusive) 1.1 1.5

More information

The Processor: Datapath and Control. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

The Processor: Datapath and Control. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University The Processor: Datapath and Control Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Introduction CPU performance factors Instruction count Determined

More information

Stack Memory. item (16-bit) to be pushed. item (16-bit) most recent

Stack Memory. item (16-bit) to be pushed. item (16-bit) most recent CSE 378 Winter 1998 Machine Organization and Assembly Language Programming Midterm Friday February 13th NAME : Do all your work on these pages. Do not add any pages. Use back pages if necessary. Show your

More information

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

/ : Computer Architecture and Design Fall Midterm Exam October 16, Name: ID #: 16.482 / 16.561: Computer Architecture and Design Fall 2014 Midterm Exam October 16, 2014 Name: ID #: For this exam, you may use a calculator and two 8.5 x 11 double-sided page of notes. All other electronic

More information

University of California College of Engineering Computer Science Division -EECS. CS 152 Midterm I

University of California College of Engineering Computer Science Division -EECS. CS 152 Midterm I Name: University of California College of Engineering Computer Science Division -EECS Fall 996 D.E. Culler CS 52 Midterm I Your Name: ID Number: Discussion Section: You may bring one double-sided pages

More information

CS 2506 Computer Organization II

CS 2506 Computer Organization II Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other computing devices may

More information

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University. Instructions: ti Language of the Computer Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Computer Hierarchy Levels Language understood

More information

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle

More information

Chapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor.

Chapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor. COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor The Processor - Introduction

More information

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition The Processor - Introduction

More information

Chapter 4. The Processor. Computer Architecture and IC Design Lab

Chapter 4. The Processor. Computer Architecture and IC Design Lab Chapter 4 The Processor Introduction CPU performance factors CPI Clock Cycle Time Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware We will examine two MIPS

More information

CSE 378 Midterm 2/12/10 Sample Solution

CSE 378 Midterm 2/12/10 Sample Solution Question 1. (6 points) (a) Rewrite the instruction sub $v0,$t8,$a2 using absolute register numbers instead of symbolic names (i.e., if the instruction contained $at, you would rewrite that as $1.) sub

More information

Machine Organization & Assembly Language

Machine Organization & Assembly Language Name: CSE 378 Winter 29 Machine Organization & Assembly Language Midterm Exam Solution your answers on these pages. itional pages may be attached (with staple) if necessary. Please ensure that your answers

More information

CS2100 COMPUTER ORGANISATION

CS2100 COMPUTER ORGANISATION CS00 NATIONAL UNIVERSITY OF SINGAPORE CS00 COMPUTER ORGANISATION (Semester : AY07/8) Time Allowed: Hours INSTRUCTIONS TO CANDIDATES. This assessment paper consists of SEVEN (7) questions and comprises

More information

CS 2504 Intro Computer Organization Test 1

CS 2504 Intro Computer Organization Test 1 Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet and the MIPS reference card. No calculators

More information

Chapter 4. The Processor Designing the datapath

Chapter 4. The Processor Designing the datapath Chapter 4 The Processor Designing the datapath Introduction CPU performance determined by Instruction Count Clock Cycles per Instruction (CPI) and Cycle time Determined by Instruction Set Architecure (ISA)

More information

Chapter 4. The Processor

Chapter 4. The Processor Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware We will examine two MIPS implementations A simplified

More information

COS 471A,COS 471B/ELE 375 Midterm

COS 471A,COS 471B/ELE 375 Midterm COS 471A,COS 471B/ELE 375 Midterm Prof: David August TAs : Jonathan Chang Junwen Lai Neil Vachharajani Fall 2004 Please write your answers clearly in the space provided. For partial credit, show all work.

More information

Unsigned Binary Integers

Unsigned Binary Integers Unsigned Binary Integers Given an n-bit number x x n 1 n 2 1 0 n 12 xn 22 x12 x02 Range: 0 to +2 n 1 Example 2.4 Signed and Unsigned Numbers 0000 0000 0000 0000 0000 0000 0000 1011 2 = 0 + + 1 2 3 + 0

More information

Unsigned Binary Integers

Unsigned Binary Integers Unsigned Binary Integers Given an n-bit number x x n 1 n 2 1 0 n 12 xn 22 x12 x02 Range: 0 to +2 n 1 Example 2.4 Signed and Unsigned Numbers 0000 0000 0000 0000 0000 0000 0000 1011 2 = 0 + + 1 2 3 + 0

More information

CS2214 COMPUTER ARCHITECTURE & ORGANIZATION SPRING 2014

CS2214 COMPUTER ARCHITECTURE & ORGANIZATION SPRING 2014 B CS2214 COMPUTER ARCHITECTURE & ORGANIZATION SPRING 2014 DUE : March 3, 2014 READ : - Related sections of Chapter 2 - Related sections of Chapter 3 - Related sections of Appendix A - Related sections

More information

The RiSC-16 Instruction-Set Architecture

The RiSC-16 Instruction-Set Architecture The RiSC-16 Instruction-Set Architecture ENEE 646: Digital Computer Design, Fall 2002 Prof. Bruce Jacob This paper describes a sequential implementation of the 16-bit Ridiculously Simple Computer (RiSC-16),

More information

The LC3's micro-coded controller ("useq") is nothing more than a finite-state machine (FSM). It has these inputs:

The LC3's micro-coded controller (useq) is nothing more than a finite-state machine (FSM). It has these inputs: midterm exam COSC-120, Computer Hardware Fundamentals, fall 2012 Computer Science Department Georgetown University NAME Open books, open notes (laptops included). Show and explain all your work. Answers

More information

/ : Computer Architecture and Design Fall 2014 Midterm Exam Solution

/ : Computer Architecture and Design Fall 2014 Midterm Exam Solution 16.482 / 16.561: Computer Architecture and Design Fall 2014 Midterm Exam Solution 1. (8 points) UEvaluating instructions Assume the following initial state prior to executing the instructions below. Note

More information

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

Department of Electrical Engineering and Computer Science Spring 2004 Instructor: Dan Garcia CS61C Midterm University of California, Berkeley College of Engineering Department of Electrical Engineering and Computer Science Spring 2004 Instructor: Dan Garcia 2004-03-08 CS61C Midterm Last Name First Name Student

More information

Computer Architecture. The Language of the Machine

Computer Architecture. The Language of the Machine Computer Architecture The Language of the Machine Instruction Sets Basic ISA Classes, Addressing, Format Administrative Matters Operations, Branching, Calling conventions Break Organization All computers

More information

CS 61c: Great Ideas in Computer Architecture

CS 61c: Great Ideas in Computer Architecture MIPS Instruction Formats July 2, 2014 Review New registers: $a0-$a3, $v0-$v1, $ra, $sp New instructions: slt, la, li, jal, jr Saved registers: $s0-$s7, $sp, $ra Volatile registers: $t0-$t9, $v0-$v1, $a0-$a3

More information

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam Two 23 October Your Name (please print clearly) Signed.

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam Two 23 October Your Name (please print clearly) Signed. Your Name (please print clearly) This exam will be conducted according to the Georgia Tech Honor Code. I pledge to neither give nor receive unauthorized assistance on this exam and to abide by all provisions

More information

MIPS Assembly Programming

MIPS Assembly Programming COMP 212 Computer Organization & Architecture COMP 212 Fall 2008 Lecture 8 Cache & Disk System Review MIPS Assembly Programming Comp 212 Computer Org & Arch 1 Z. Li, 2008 Comp 212 Computer Org & Arch 2

More information

The Processor (1) Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

The Processor (1) Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University The Processor (1) Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu EEE3050: Theory on Computer Architectures, Spring 2017, Jinkyu Jeong (jinkyu@skku.edu)

More information

Chapter 2A Instructions: Language of the Computer

Chapter 2A Instructions: Language of the Computer Chapter 2A Instructions: Language of the Computer Copyright 2009 Elsevier, Inc. All rights reserved. Instruction Set The repertoire of instructions of a computer Different computers have different instruction

More information

EC 413 Computer Organization

EC 413 Computer Organization EC 413 Computer Organization Review I Prof. Michel A. Kinsy Computing: The Art of Abstraction Application Algorithm Programming Language Operating System/Virtual Machine Instruction Set Architecture (ISA)

More information

ECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam Two 11 March Your Name (please print) total

ECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam Two 11 March Your Name (please print) total Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

More information

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

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012 Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

More information

MIPS Functions and Instruction Formats

MIPS Functions and Instruction Formats MIPS Functions and Instruction Formats 1 The Contract: The MIPS Calling Convention You write functions, your compiler writes functions, other compilers write functions And all your functions call other

More information

Chapter 3: Arithmetic for Computers

Chapter 3: Arithmetic for Computers Chapter 3: Arithmetic for Computers Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point Computer Architecture CS 35101-002 2 The Binary Numbering

More information

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions Structure of von Nuemann machine Arithmetic and Logic Unit Input Output Equipment Main Memory Program Control Unit 1 1 Instruction Set - the type of Instructions Arithmetic + Logical (ADD, SUB, MULT, DIV,

More information

RiSC-16 Sequential Implementation

RiSC-16 Sequential Implementation RiSC-16 Sequential Implementation ENEE 446: Digital Computer Design, Fall 2000 Prof. Bruce Jacob This paper describes a sequential implementation of the 16-bit Ridiculously Simple Computer (RiSC-16), a

More information

Course Administration

Course Administration Fall 2018 EE 3613: Computer Organization Chapter 2: Instruction Set Architecture Introduction 4/4 Avinash Karanth Department of Electrical Engineering & Computer Science Ohio University, Athens, Ohio 45701

More information

Lecture 4: Instruction Set Architecture

Lecture 4: Instruction Set Architecture Lecture 4: Instruction Set Architecture ISA types, register usage, memory addressing, endian and alignment, quantitative evaluation Reading: Textbook (5 th edition) Appendix A Appendix B (4 th edition)

More information

Computer Organization MIPS ISA

Computer Organization MIPS ISA CPE 335 Computer Organization MIPS ISA Dr. Iyad Jafar Adapted from Dr. Gheith Abandah Slides http://www.abandah.com/gheith/courses/cpe335_s08/index.html CPE 232 MIPS ISA 1 (vonneumann) Processor Organization

More information

Computer Organization EE 3755 Midterm Examination

Computer Organization EE 3755 Midterm Examination Name Solution Computer Organization EE 3755 Midterm Examination Wednesday, 24 October 2012, 9:30 10:20 CDT Alias A Century of Turing Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Problem

More information

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 Spring 2016 Instructors: Vladimir Stojanovic, Nicholas Weaver 2016-04-04 L J After the

More information

CSE Lecture In Class Example Handout

CSE Lecture In Class Example Handout CSE 30321 Lecture 07-08 In Class Example Handout Part A: J-Type Example: If you look in your book at the syntax for j (an unconditional jump instruction), you see something like: e.g. j addr would seemingly

More information

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department Page 1 of 13 King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department COE 301 COMPUTER ORGANIZATION ICS 233: COMPUTER ARCHITECTURE & ASSEMBLY

More information

Chapter 4. The Processor. Instruction count Determined by ISA and compiler. We will examine two MIPS implementations

Chapter 4. The Processor. Instruction count Determined by ISA and compiler. We will examine two MIPS implementations Chapter 4 The Processor Part I Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware We will examine two MIPS implementations

More information

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 Spring 2016 Instructors: Vladimir Stojanovic, Nicholas Weaver 2016-04-04 L J After the

More information

ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design

ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design Professor Sherief Reda http://scale.engin.brown.edu School of Engineering Brown University Spring 2014 Sources: Computer

More information

bits 5..0 the sub-function of opcode 0, 32 for the add instruction

bits 5..0 the sub-function of opcode 0, 32 for the add instruction CS2 Computer Systems note 1a Some MIPS instructions More details on these, and other instructions in the MIPS instruction set, can be found in Chapter 3 of Patterson and Hennessy. A full listing of MIPS

More information

CSCE 5610: Computer Architecture

CSCE 5610: Computer Architecture HW #1 1.3, 1.5, 1.9, 1.12 Due: Sept 12, 2018 Review: Execution time of a program Arithmetic Average, Weighted Arithmetic Average Geometric Mean Benchmarks, kernels and synthetic benchmarks Computing CPI

More information

11/22/1999 7pm - 9pm. Name: Login Name: Preceptor Name: Precept Number:

11/22/1999 7pm - 9pm. Name: Login Name: Preceptor Name: Precept Number: Login Preceptor Precept Number: Computer Science 126 Second Midterm Exam 11/22/1999 7pm - 9pm This exam has 10 questions. The weight of each question is printed in the table below and next to each question.

More information

Solution printed. Do not start the test until instructed to do so! CS 2504 Intro Computer Organization Test 2 Spring 2006.

Solution printed. Do not start the test until instructed to do so! CS 2504 Intro Computer Organization Test 2 Spring 2006. VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted

More information

Lecture 2. Instructions: Language of the Computer (Chapter 2 of the textbook)

Lecture 2. Instructions: Language of the Computer (Chapter 2 of the textbook) Lecture 2 Instructions: Language of the Computer (Chapter 2 of the textbook) Instructions: tell computers what to do Chapter 2 Instructions: Language of the Computer 2 Introduction Chapter 2.1 Chapter

More information

Chapter 1. Computer Abstractions and Technology. Lesson 3: Understanding Performance

Chapter 1. Computer Abstractions and Technology. Lesson 3: Understanding Performance Chapter 1 Computer Abstractions and Technology Lesson 3: Understanding Performance Manufacturing ICs 1.7 Real Stuff: The AMD Opteron X4 Yield: proportion of working dies per wafer Chapter 1 Computer Abstractions

More information

MIPS Instruction Set

MIPS Instruction Set MIPS Instruction Set Prof. James L. Frankel Harvard University Version of 7:12 PM 3-Apr-2018 Copyright 2018, 2017, 2016, 201 James L. Frankel. All rights reserved. CPU Overview CPU is an acronym for Central

More information

Single cycle MIPS data path without Forwarding, Control, or Hazard Unit

Single cycle MIPS data path without Forwarding, Control, or Hazard Unit Single cycle MIPS data path without Forwarding, Control, or Hazard Unit Figure 1: an Overview of a MIPS datapath without Control and Forwarding (Patterson & Hennessy, 2014, p. 287) A MIPS 1 single cycle

More information

EEM 486: Computer Architecture. Lecture 2. MIPS Instruction Set Architecture

EEM 486: Computer Architecture. Lecture 2. MIPS Instruction Set Architecture EEM 486: Computer Architecture Lecture 2 MIPS Instruction Set Architecture EEM 486 Overview Instruction Representation Big idea: stored program consequences of stored program Instructions as numbers Instruction

More information

Arithmetic for Computers

Arithmetic for Computers MIPS Arithmetic Instructions Cptr280 Dr Curtis Nelson Arithmetic for Computers Operations on integers Addition and subtraction; Multiplication and division; Dealing with overflow; Signed vs. unsigned numbers.

More information

ANNA Guide. by Dr. Eric Larson Seattle University. Acknowledgments... 2

ANNA Guide. by Dr. Eric Larson Seattle University. Acknowledgments... 2 ANNA Guide by Dr. Eric Larson Seattle University Table of Contents Acknowledgments... 2 1. ANNA Architecture... 3 1.1 Memory Organization... 3 1.2 Register Set... 3 1.3 Execution of Programs... 3 1.4 Instruction

More information

COMPUTER ORGANIZATION AND DESIGN. The Hardware/Software Interface. Chapter 4. The Processor: A Based on P&H

COMPUTER ORGANIZATION AND DESIGN. The Hardware/Software Interface. Chapter 4. The Processor: A Based on P&H COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface Chapter 4 The Processor: A Based on P&H Introduction We will examine two MIPS implementations A simplified version A more realistic pipelined

More information

Winter 2006 FINAL EXAMINATION Auxiliary Gymnasium Tuesday, April 18 7:00pm to 10:00pm

Winter 2006 FINAL EXAMINATION Auxiliary Gymnasium Tuesday, April 18 7:00pm to 10:00pm University of Calgary Department of Electrical and Computer Engineering ENCM 369: Computer Organization Lecture Instructor for L01 and L02: Dr. S. A. Norman Winter 2006 FINAL EXAMINATION Auxiliary Gymnasium

More information

CS61C Machine Structures. Lecture 13 - MIPS Instruction Representation I. 9/26/2007 John Wawrzynek. www-inst.eecs.berkeley.

CS61C Machine Structures. Lecture 13 - MIPS Instruction Representation I. 9/26/2007 John Wawrzynek. www-inst.eecs.berkeley. CS61C Machine Structures Lecture 13 - MIPS Instruction Representation I 9/26/2007 John Wawrzynek (www.cs.berkeley.edu/~johnw) www-inst.eecs.berkeley.edu/~cs61c/ CS 61C L13 MIPS Instruction Representation

More information

EE 361 University of Hawaii Fall

EE 361 University of Hawaii Fall C functions Road Map Computation flow Implementation using MIPS instructions Useful new instructions Addressing modes Stack data structure 1 EE 361 University of Hawaii Implementation of C functions and

More information

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

ISA and RISCV. CASS 2018 Lavanya Ramapantulu ISA and RISCV CASS 2018 Lavanya Ramapantulu Program Program =?? Algorithm + Data Structures Niklaus Wirth Program (Abstraction) of processor/hardware that executes 3-Jul-18 CASS18 - ISA and RISCV 2 Program

More information

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization CISC 662 Graduate Computer Architecture Lecture 4 - ISA MIPS ISA Michela Taufer http://www.cis.udel.edu/~taufer/courses Powerpoint Lecture Notes from John Hennessy and David Patterson s: Computer Architecture,

More information

Computer Architecture

Computer Architecture Computer Architecture Chapter 2 Instructions: Language of the Computer Fall 2005 Department of Computer Science Kent State University Assembly Language Encodes machine instructions using symbols and numbers

More information

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

ECE 2035 Programming HW/SW Systems Fall problems, 7 pages Exam Two 23 October 2013 Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

More information

CMPSCI 201 Fall 2004 Midterm #2 Answers

CMPSCI 201 Fall 2004 Midterm #2 Answers CMPSCI 201 Fall 2004 Midterm #2 Answers Professor William T. Verts 15 Points You should be quite familiar by now with the single-precision floating point numeric format (one 32-bit word containing

More information

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

NAME: 1a. (10 pts.) Describe the characteristics of numbers for which this floating-point data type is well-suited. Give an example. MSU CSC 285 Spring, 2007 Exam 2 (5 pgs.) NAME: 1. Suppose that a eight-bit floating-point data type is defined with the eight bits divided into fields as follows, where the bits are numbered with zero

More information

ECE 313 Computer Organization EXAM 2 November 11, 2000

ECE 313 Computer Organization EXAM 2 November 11, 2000 This exam is open book and open notes. You have 50 minutes. Credit for problems requiring calculation will be given only if you show your work. 1. ALU Design / Logic Operations 20 Points The subset of

More information

Review Topics. Midterm Exam Review Slides

Review Topics. Midterm Exam Review Slides Review Topics Midterm Exam Review Slides Original slides from Gregory Byrd, North Carolina State University Modified slides by Chris Wilcox, Colorado State University!! Computer Arithmetic!! Combinational

More information

Chapter 2. Instructions: Language of the Computer. Adapted by Paulo Lopes

Chapter 2. Instructions: Language of the Computer. Adapted by Paulo Lopes Chapter 2 Instructions: Language of the Computer Adapted by Paulo Lopes Instruction Set The repertoire of instructions of a computer Different computers have different instruction sets But with many aspects

More information

CSE 351 Midterm - Winter 2015 Solutions

CSE 351 Midterm - Winter 2015 Solutions CSE 351 Midterm - Winter 2015 Solutions February 09, 2015 Please read through the entire examination first! We designed this exam so that it can be completed in 50 minutes and, hopefully, this estimate

More information

CSE 351 Midterm - Winter 2015

CSE 351 Midterm - Winter 2015 CSE 351 Midterm - Winter 2015 February 09, 2015 Please read through the entire examination first! We designed this exam so that it can be completed in 50 minutes and, hopefully, this estimate will prove

More information

ECE Exam I - Solutions February 19 th, :00 pm 4:25pm

ECE Exam I - Solutions February 19 th, :00 pm 4:25pm ECE 3056 Exam I - Solutions February 19 th, 2015 3:00 pm 4:25pm 1. (35 pts) Consider the following block of SPIM code. The text segment starts at 0x00400000 and the data segment starts at 0x10010000..data

More information

CSE351 Spring 2018, Midterm Exam April 27, 2018

CSE351 Spring 2018, Midterm Exam April 27, 2018 CSE351 Spring 2018, Midterm Exam April 27, 2018 Please do not turn the page until 11:30. Last Name: First Name: Student ID Number: Name of person to your left: Name of person to your right: Signature indicating:

More information

CMPSCI 145 MIDTERM #1 Solution Key. SPRING 2017 March 3, 2017 Professor William T. Verts

CMPSCI 145 MIDTERM #1 Solution Key. SPRING 2017 March 3, 2017 Professor William T. Verts CMPSCI 145 MIDTERM #1 Solution Key NAME SPRING 2017 March 3, 2017 PROBLEM SCORE POINTS 1 10 2 10 3 15 4 15 5 20 6 12 7 8 8 10 TOTAL 100 10 Points Examine the following diagram of two systems, one involving

More information

LECTURE 5. Single-Cycle Datapath and Control

LECTURE 5. Single-Cycle Datapath and Control LECTURE 5 Single-Cycle Datapath and Control PROCESSORS In lecture 1, we reminded ourselves that the datapath and control are the two components that come together to be collectively known as the processor.

More information

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA CISC 662 Graduate Computer Architecture Lecture 4 - ISA Michela Taufer http://www.cis.udel.edu/~taufer/courses Powerpoint Lecture Notes from John Hennessy and David Patterson s: Computer Architecture,

More information

MIPS%Assembly% E155%

MIPS%Assembly% E155% MIPS%Assembly% E155% Outline MIPS Architecture ISA Instruction types Machine codes Procedure call Stack 2 The MIPS Register Set Name Register Number Usage $0 0 the constant value 0 $at 1 assembler temporary

More information

CS 351 Exam 2 Mon. 11/2/2015

CS 351 Exam 2 Mon. 11/2/2015 CS 351 Exam 2 Mon. 11/2/2015 Name: Rules and Hints The MIPS cheat sheet and datapath diagram are attached at the end of this exam for your reference. You may use one handwritten 8.5 11 cheat sheet (front

More information

Slide Set 5. for ENCM 369 Winter 2014 Lecture Section 01. Steve Norman, PhD, PEng

Slide Set 5. for ENCM 369 Winter 2014 Lecture Section 01. Steve Norman, PhD, PEng Slide Set 5 for ENCM 369 Winter 2014 Lecture Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Winter Term, 2014 ENCM 369 W14 Section

More information

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng. CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. CS 265 Midterm #1 Monday, Oct 18, 12:00pm-1:45pm, SCI 163 Questions on essential terms and concepts of Computer Architecture Mathematical questions on

More information

Midterm I October 6, 1999 CS152 Computer Architecture and Engineering

Midterm I October 6, 1999 CS152 Computer Architecture and Engineering 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

More information

RECITATION SECTION: YOUR CDA 3101 NUMBER:

RECITATION SECTION: YOUR CDA 3101 NUMBER: PRINT YOUR NAME: KEY UFID [5:8]: RECITATION SECTION: YOUR CDA 3101 NUMBER: I have not looked at anyone else s paper, and I have not obtained unauthorized help in completing this exam. Also, I have adhered

More information

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. 5 th. Edition. Chapter 4. The Processor

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. 5 th. Edition. Chapter 4. The Processor COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle

More information

EC-801 Advanced Computer Architecture

EC-801 Advanced Computer Architecture EC-801 Advanced Computer Architecture Lecture 5 Instruction Set Architecture I Dr Hashim Ali Fall 2018 Department of Computer Science and Engineering HITEC University Taxila!1 Instruction Set Architecture

More information