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

Similar documents
ECE Exam I February 19 th, :00 pm 4:25pm

ECE 3056: Architecture, Concurrency and Energy of Computation. Single and Multi-Cycle Datapaths: Practice Problems

Chapter 5 Solutions: For More Practice

Points available Your marks Total 100

CSE 2021 COMPUTER ORGANIZATION

ELEC 5200/6200 Computer Architecture and Design Spring 2017 Lecture 4: Datapath and Control

RISC Processor Design

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

ECE Sample Final Examination

CSEN 601: Computer System Architecture Summer 2014

Processor: Multi- Cycle Datapath & Control

CSE 2021: Computer Organization Fall 2010 Solution to Assignment # 3: Multicycle Implementation

Inf2C - Computer Systems Lecture 12 Processor Design Multi-Cycle

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

LECTURE 6. Multi-Cycle Datapath and Control

CPE 335. Basic MIPS Architecture Part II

LECTURE 5. Single-Cycle Datapath and Control

Topic #6. Processor Design

CC 311- Computer Architecture. The Processor - Control

CSE 2021 COMPUTER ORGANIZATION

ECE 3056: Architecture, Concurrency, and Energy of Computation. Sample Problem Sets: Pipelining

EE457. Note: Parts of the solutions are extracted from the solutions manual accompanying the text book.

Processor (I) - datapath & control. Hwansoo Han

ENE 334 Microprocessors

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

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization

Systems Architecture

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

The MIPS Processor Datapath

CS232 Final Exam May 5, 2001

Lecture 5 and 6. ICS 152 Computer Systems Architecture. Prof. Juan Luis Aragón

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

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

Single vs. Multi-cycle Implementation

RISC Architecture: Multi-Cycle Implementation

Design of the MIPS Processor

RISC Architecture: Multi-Cycle Implementation

Project Description EEC 483 Computer Organization, Spring 2019

Adding Support for jal to Single Cycle Datapath (For More Practice Exercise 5.20)

Design of the MIPS Processor (contd)

CS 351 Exam 2, Fall 2012

ﻪﺘﻓﺮﺸﻴﭘ ﺮﺗﻮﻴﭙﻣﺎﻛ يرﺎﻤﻌﻣ MIPS يرﺎﻤﻌﻣ data path and ontrol control

ECE369. Chapter 5 ECE369

Multi-cycle Approach. Single cycle CPU. Multi-cycle CPU. Requires state elements to hold intermediate values. one clock cycle or instruction

Mapping Control to Hardware

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

Digital Design & Computer Architecture (E85) D. Money Harris Fall 2007

For More Practice FMP

Systems Architecture I

Major CPU Design Steps

Processor (multi-cycle)

Chapter 5: The Processor: Datapath and Control

Single Cycle CPU Design. Mehran Rezaei

CPU Organization (Design)

EECS150 - Digital Design Lecture 10- CPU Microarchitecture. Processor Microarchitecture Introduction

CS 351 Exam 2 Mon. 11/2/2015

The Processor: Datapath & Control

Lets Build a Processor

Computer Architecture, IFE CS and T&CS, 4 th sem. Single-Cycle Architecture

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Data Paths and Microprogramming

ECE232: Hardware Organization and Design

ALUOut. Registers A. I + D Memory IR. combinatorial block. combinatorial block. combinatorial block MDR

CS3350B Computer Architecture Quiz 3 March 15, 2018

CSc 256 Midterm 2 Fall 2011

Machine Organization & Assembly Language

EECS150 - Digital Design Lecture 9- CPU Microarchitecture. Watson: Jeopardy-playing Computer

RISC Design: Multi-Cycle Implementation

EE380 Spring 2014 Exam 1 Answer Key

CENG 3420 Lecture 06: Datapath

Note- E~ S. \3 \S U\e. ~ ~s ~. 4. \\ o~ (fw' \i<.t. (~e., 3\0)

COMP2611: Computer Organization. The Pipelined Processor

Winter 2002 FINAL EXAMINATION

Design of Digital Circuits 2017 Srdjan Capkun Onur Mutlu (Guest starring: Frank K. Gürkaynak and Aanjhan Ranganathan)

ECE 313 Computer Organization FINAL EXAM December 11, Multicycle Processor Design 30 Points

Final Project: MIPS-like Microprocessor

Lecture 8: Control COS / ELE 375. Computer Architecture and Organization. Princeton University Fall Prof. David August

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

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

Computer Science 141 Computing Hardware

CSc 256 Midterm 2 Spring 2012

MIPS Coding Continued

CSEE W3827 Fundamentals of Computer Systems Homework Assignment 3 Solutions

CENG 3420 Computer Organization and Design. Lecture 06: MIPS Processor - I. Bei Yu

EECS 151/251A Fall 2017 Digital Design and Integrated Circuits. Instructor: John Wawrzynek and Nicholas Weaver. Lecture 13 EE141

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

Initial Representation Finite State Diagram. Logic Representation Logic Equations

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

Winter 2009 FINAL EXAMINATION Location: Engineering A Block, Room 201 Saturday, April 25 noon to 3:00pm

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

Review: Abstract Implementation View

Lab 4 Report. Single Cycle Design BAOTUNG C. TRAN EEL4713C

Single Cycle Datapath

ECE 30 Introduction to Computer Engineering

CS232 Final Exam May 5, 2001

NATIONAL UNIVERSITY OF SINGAPORE

The Processor. Z. Jerry Shi Department of Computer Science and Engineering University of Connecticut. CSE3666: Introduction to Computer Architecture

University of Jordan Computer Engineering Department CPE439: Computer Design Lab

Using a Hardware Description Language to Design and Simulate a Processor 5.8

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

Transcription:

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 first:.word 1,0,1,0,1,0,1, last:.word 0.text.globl main main: la $t0, first #load start address of array la $t1, last #load end address of the array addi $t1, $t1, 4 #point to first word after the array li $t2, 0 #initialize count using immediate add $t3, $zero, $zero #initialize sum using another approach loop: lw $t4, 0($t0) #fetch array element add $t3, $t3, $t4 #update sum addi $t0, $t0, 4 #point to next word addi $t2, $t2, 1 #increment count bne $t1, $t0, loop #if not done, start next iteration li $v0, 10 syscall a) (10 pts) Provide the hexadecimal encodings of the following lw $t4, 0($t0) bne $t1, $t0, loop 8d0c0000 1528fffc

b. (5 pts) Is the above code relocatable? Explain. Yes. None of the instructions depend on the absolute address of another instruction. c. (10 pts) The following is the binary representation of a block of assembled SPIM code. Disassemble the program producing the original SPIM instructions. Use the opcode map at the end of this exam. Assembled Binary MIPS Instruction 0x21080004 addi $8, $8, 4 0x2129ffff addi $9, $9, -1 0x1520fffc bne $9, $0, -4 (words) d. (6 pts) Consider a jal instruction stored at address 0x00400028. Determine whether each of the following addresses can be a target of this instruction, i.e., the starting location of the procedure. You must justify your answer to receive credit. i. 0x20020040 The jal instruction provides the lower 28 bits of the target byte address. The upper 4 bits comes from the PC to produce a full 32-bit address. For this instruction the upper four bits of its PC are 0x0. Therefore, the target produced from the jal instruction cannot have the value 0x2 in the upper four bits. The target is not in the same 256Mbyte segment as the jal instruction. Hence, this address cannot be a target of the jal instruction. ii. 0x04040044 Following the reasoning cited above, this address can be a target of the jal instruction. e. (4 pts) What will be contained in the symbol table after assembly? The symbol main which is declared as globl.

2. (10 pts) Consider the 32-bit ALU design discussed in class and shown below. Note that it supports the beq instruction. Now suppose that we wished to similarly add hardware support for ble $t0, $t1, loop the branch-on-lessthan-or-equal-to instruction. Clearly show i) the necessary changes to the ALU hardware, ii) list the corresponding values of the ALU control signals for this instruction, and iii) describe briefly (in a sentence or two) how the single cycle datapath would operate with these changes. Instruction Binvert Operation ble 1 10 The ALU is set to perform $t0-$t1 (110). Add a 2-input OR gate to form the logical OR of the Zero signal and the MSB to produce a new ble signal. At the datapath level, the branch address multiplexor is now driven by a logical OR condition. The branch is taken if i) it is a beq instruction and the zero signal =1, or ii) it is a ble instruction and the ble signal = 1. The ble instruction can use the same ALU opcode as beq.

3. (25 pts) Consider the single cycle SPIM datapath shown overleaf. You wish to add a new instruction - dcb $t0, loop decrement-and-branch-on-zero. This instruction will first decrement the register $t0 by 1 and then branch to the label loop if the result is 0. Register $t0 is updated with the decremented value. a. (10 pts) Clearly show the hardware modifications on the datapath. [To receive any credit your modifications must be legible] You can use the implementation of the beq which already performs a subtract operation. Add the value -1 as an input to the ALUSrc mux (now it is a two bit control). Write the result of the ALU operation (which is the decrement) back to the rs register expand the RegDst mux to include rs as an input while RegDst becomes a 2-bit control signal. b. (10 pts) Fill in the truth table below for the single cycle data path including any changes to accommodate the new instruction Instr. RegDst AluSrc MemToReg RegWrite MemRead MemWrite Branch AluOp R- 01 00 0 1 0 0 0 10 format lw 00 01 1 1 1 0 0 00 sw X 01 X 0 0 1 0 00 beq X 00 X 0 0 0 1 01 DCB 10 10 0 1 0 0 1 01 c. (5 pts) Assuming the opcode for the new instruction is 100111, show the modifications required to the controller hardware below for the new instruction. Make and state any assumptions you need.

4. (30 pts) Consider the execution of the following block of SPIM code on a multicycle datapath. Assume that the fetch cycle for the first instruction is cycle number 0. Assume that i) all immediate instructions require the same number of states as an add instruction, ii) all branch instructions require the same number of states as a beq instruction. Text starts at 0x00400000 and the data segment starts at 0x10010000. # a simple counting for loop and a conditional if-then-else statement.data L1:.word 0x44,22,33,55 main: loop:.text.globl main lui $t0, 0x1001 li $t1, 4 add $t2, $t2, $zero lw $t3, 0($t0) add $t2, $t2, $t3 addi $t0, $t0, 4 addi $t1, $t1, -1 bne $t1, $zero, loop bgt $t2, $0, then move $s0, $t2 j exit then: move $s1, $t2 exit: li $v0, 10 syscall a. (5 pts) What is the contents of ALUOut after cycle number 14 completes? Why? 0x1001000. Cycle 14 is the address calculation cycle of the lw instruction. The address calculation is $t0 + 0. The contents of $t0 are 0x10010000. b. (15 pts) Fill in the following values during the requested cycle (remember the first cycle is cycle number 0!). Cycle ALUOp ALUSrcB IRWrite RegWrite MemToReg PCSource 10 10 00 0 0 X XX 18 00 11 0 0 X XX Cycle number 10 corresponds to the addition operation for the add $t2, $t2, $zero instruction. Cycle number 18 corresponds to the decode state for the add $t2, $t2, $t3 instruction.

c. (10 pts) Consider the multi-cycle data path and assume each state consumes the same amount of energy E joules, and that the bne instruction takes the same number of cycles as the beq instruction. Now consider that the data path executes at 1 GHZ. Compare the power dissipation of each loop. Your answer must include the computation of the power executed by each loop. Loop1: lw $t3, 0($t0) add $t2, $t2, $t3 addi $t0, $t0, 4 addi $t1, $t1, -1 bne $t1, $zero, Loop1 Loop2: lw $t3, 0($t0) add $t2, $t2, $t3 addi $t0, $t0, 4 bne $t1, $t4, Loop2 Note that each state dissipates the same amount of energy. States are executed at the rate of 1 GHz for both loops. Therefore the execution of both loops expends energy at the same rate E joules per nanosecond. Power is the rate of expenditure of energy. Power dissipation is the same for both loops.