End Semester Examination CSE, III Yr. (I Sem), 30002: Computer Organization

Similar documents
Elementary Educational Computer

UNIVERSITY OF MORATUWA

Chapter 5: Processor Design Advanced Topics. Microprogramming: Basic Idea

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 4. The Processor. Part A Datapath Design

CSC 220: Computer Organization Unit 11 Basic Computer Organization and Design

CIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13

Chapter 4 The Datapath

top() Applications of Stacks

Computer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria.

Computer Architecture. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

APPLICATION NOTE PACE1750AE BUILT-IN FUNCTIONS

University of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures

1. SWITCHING FUNDAMENTALS

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 4. The Processor. Single-Cycle Disadvantages & Advantages

Data diverse software fault tolerance techniques

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions:

EE University of Minnesota. Midterm Exam #1. Prof. Matthew O'Keefe TA: Eric Seppanen. Department of Electrical and Computer Engineering

Appendix D. Controller Implementation

CMSC Computer Architecture Lecture 2: ISA. Prof. Yanjing Li Department of Computer Science University of Chicago

Description of Single Cycle Computer (SCC)

Lecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions

CMSC Computer Architecture Lecture 12: Virtual Memory. Prof. Yanjing Li University of Chicago

Morgan Kaufmann Publishers 26 February, COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 5.

CMPT 125 Assignment 2 Solutions

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 13 Control and Sequencing: Hardwired and Microprogrammed Control

CMSC Computer Architecture Lecture 5: Pipelining. Prof. Yanjing Li University of Chicago

Lecture 3. RTL Design Methodology. Transition from Pseudocode & Interface to a Corresponding Block Diagram

EE260: Digital Design, Spring /16/18. n Example: m 0 (=x 1 x 2 ) is adjacent to m 1 (=x 1 x 2 ) and m 2 (=x 1 x 2 ) but NOT m 3 (=x 1 x 2 )

CMSC Computer Architecture Lecture 3: ISA and Introduction to Microarchitecture. Prof. Yanjing Li University of Chicago

. Written in factored form it is easy to see that the roots are 2, 2, i,

Lecture 2. RTL Design Methodology. Transition from Pseudocode & Interface to a Corresponding Block Diagram

K-NET bus. When several turrets are connected to the K-Bus, the structure of the system is as showns

Review: The ACID properties

Chapter 3. Floating Point Arithmetic

Threads and Concurrency in Java: Part 1

Threads and Concurrency in Java: Part 1

Python Programming: An Introduction to Computer Science

CIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19

The Magma Database file formats

Major CSL Write your name and entry no on every sheet of the answer script. Time 2 Hrs Max Marks 70

The isoperimetric problem on the hypercube

Lecture 28: Data Link Layer

Lecture 1: Introduction and Strassen s Algorithm

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Weston Anniversary Fund

Chapter 3 Classification of FFT Processor Algorithms

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 4. The Processor Advanced Issues

CMSC Computer Architecture Lecture 10: Caches. Prof. Yanjing Li University of Chicago

Basic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000.

1 Enterprise Modeler

Chapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Structuring Redundancy for Fault Tolerance. CSE 598D: Fault Tolerant Software

Alpha Individual Solutions MAΘ National Convention 2013

1 Graph Sparsfication

CSC165H1 Worksheet: Tutorial 8 Algorithm analysis (SOLUTIONS)

n n B. How many subsets of C are there of cardinality n. We are selecting elements for such a

Introduction to Computing Systems: From Bits and Gates to C and Beyond 2 nd Edition

Lecture 5. Counting Sort / Radix Sort

CS252 Spring 2017 Graduate Computer Architecture. Lecture 6: Out-of-Order Processors

A collection of open-sourced RISC-V processors

Examples and Applications of Binary Search

Multiprocessors. HPC Prof. Robert van Engelen

DESIGN AND ANALYSIS OF LDPC DECODERS FOR SOFTWARE DEFINED RADIO

GE FUNDAMENTALS OF COMPUTING AND PROGRAMMING UNIT III

Python Programming: An Introduction to Computer Science

the beginning of the program in order for it to work correctly. Similarly, a Confirm

On (K t e)-saturated Graphs

Algorithm Design Techniques. Divide and conquer Problem

EE123 Digital Signal Processing

Homework 1 Solutions MA 522 Fall 2017

Multi-Threading. Hyper-, Multi-, and Simultaneous Thread Execution

Guide to Applying Online

Bluespec-3: Modules & Interfaces. Bluespec: State and Rules organized into modules

COSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:

Getting Started. Getting Started - 1

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Course Site: Copyright 2012, Elsevier Inc. All rights reserved.

Behavioral Modeling in Verilog

Pseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance

Octahedral Graph Scaling

ALU Augmentation for MPEG-4 Repetitive Padding

SCI Reflective Memory

Breakpoints and Breakpoint Detection in Source Level Emulation

Analysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis

Mathematical Stat I: solutions of homework 1

CS 683: Advanced Design and Analysis of Algorithms

One advantage that SONAR has over any other music-sequencing product I ve worked

DATA STRUCTURES. amortized analysis binomial heaps Fibonacci heaps union-find. Data structures. Appetizer. Appetizer

Computer Architecture ELEC3441

Guaranteeing Hard Real Time End-to-End Communications Deadlines

Master Informatics Eng. 2017/18. A.J.Proença. Memory Hierarchy. (most slides are borrowed) AJProença, Advanced Architectures, MiEI, UMinho, 2017/18 1

Massachusetts Institute of Technology Lecture : Theory of Parallel Systems Feb. 25, Lecture 6: List contraction, tree contraction, and

Module Instantiation. Finite State Machines. Two Types of FSMs. Finite State Machines. Given submodule mux32two: Instantiation of mux32two

Solutions to Final COMS W4115 Programming Languages and Translators Monday, May 4, :10-5:25pm, 309 Havemeyer

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Running Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments

Heaps. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015

WYSE Academic Challenge Sectional Computer Science 2005 SOLUTION SET

Hash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.

Transcription:

Ed Semester Examiatio 2013-14 CSE, III Yr. (I Sem), 30002: Computer Orgaizatio Istructios: GROUP -A 1. Write the questio paper group (A, B, C, D), o frot page top of aswer book, as per what is metioed i the questio paper. 2. Attempt all questios. 3. Write thecorrect choice a, b, c, or diaswer book, formultiple choice questios (MCQs). 4. Wrog aswer for a MCQ carries 1 4 of its full weightage. 5. Except MCQs, give the detailed aswer/solutio for each questio. Max. Marks=40 Time= 3 Hrs. 1. (a) The ALU, S, T, the bus ad all the registers i the data path are of idetical size. All operatios icludig icremetatio of the PC ad the GPRs (geeral purpose registers) are to be carried out i the ALU. Two clock cycles are eeded for memory read operatio the first oe for loadig address i the MAR ad the ext oe for loadig data from the memory bus ito the MDR. (ext two questios) MAR MDR S T IR PC GPRs ALU i. The istructio add R0, R1 has the register trasfer iterpretatio R0 R0 + R1. The miimum umber of clock cycles eeded for executio cycle of this istructio is: (2) (a) 2 (b) 3 (c) 4 (d) 5 Aswer: (b) 3. Oe cycle to load R0 i accumulator register S, oe cycle to add, oe cycle to store value i register R0. ii. The istructio call R, sub is a two word istructio. Assumig that PC is icremeted durig the fetch cycle of the first word of the istructio, its register trasfer iterpretatio is R <= PC +1; PC <= M[PC]; 1

The miimum umber of CPU clock cycles eeded durig the executio cycle of this istructio is: (2) (a) 2 (b) 3 (c) 4 (d) 5 Aswer: (b) 3. Oe cycle to icremet PC, oe cycle to load PC ito MAR, oe cycle to fetch memory cotet ad load ito PC. (b) i. A CPU has 24-bit istructios. A program starts at address 300 (i decimal). Which oe of the followig is a legal program couter (all values i aswers are i decimal)? Assume that each memory locatio is of oe byte size. (2) (a) 400 (b) 500 (c) 600 (d) 700 Aswer: (c) 600. Sice each istructio is 3 byte (24 bit) log ad memory locatios are oe byte each, the legal PC values are address, where address mode 3 == 0. ii. Which oe of the followig is true for a CPU havig a sigle iterrupt request lie ad a sigle iterrupt grat lie? (1) (a) Neither vectored iterrupt or multiple iterruptig devices are possible (b) Vectored iterrupts are ot possible but multiple iterruptig devices are possible. (c) Vectored iterrupts ad multiple iterruptig devices are both possible (d) Vectored iterrupt is possible but multiple iterruptig devices are ot possible Aswer (b). Because the vectored iterrupts requires separate iterrupts. iii. For the elemets of sets {A,B,C,D} ad {1,2,3,4} (1) (A) DMA I/O (1) High speed RAM (B) Cache (2) Disk (C) Iterrupt I/O (3) Priter (D) Coditio code Register (4) ALU followig is the correct matchig: (a) A-4 B-3 C-1 D-2 (b) A-2 B-1 C-3 D-4 (c) A-4 B-3 C-2 D-1 (d) A-2 B-3 C-4 D-1 Aswer (b) iv. Purpose of start-bit i RS232C serial commuicatio protocol is: (1) (a) to sychroize receiver for receivig every byte (b) to sychroize receiver for receivig a sequece of bytes (c) a parity bit (d) to sychroize receiver for receivig the last byte Aswer (a) v. I serial commuicatio employig 8-data bits, a parity bit ad 2 stop bits, the miimum baud rate required to sustai a trasfer rate of 300 characters per secods is: (1) (a) 2400 baud (b) 19200 baud (c) 4800 baud (d) 1200 baud Total bits per characters = 8+2+1=11, bits for 300 characters/sec = 300*11 = 3300 (baud). So miimum speed out of the give speeds is Aswer: (c) 4800 baud vi. A hard disk with a trasfer rate of Mbytes/secod is costatly trasferrig data to memory usig DMA. The processor rus at 600 MHz, ad takes 300 ad 900 clock cycles to iitiate ad complete DMA trasfer respectively. If the size of the trasfer is 20 Kbytes, what is the percetage of processor time cosumed for the trasfer operatio? (3) (A) 5.0% (B) 1.0% (c) 0.5% (D) 0.1% Aswer:(D) 0.1% Time for trasfer of 20kbytes= 20 3 6 2 = 3 sec. This is because for a oe word trasfer, the address is set o bus i oe clock ad 2

other cycle for memory read. No. of cycles for trasfer = 3 600 6 = 6 5 cycles. Total cycles 900+300+6 12 5 6 5. The fractio of time of cpu spet = 6 5 0 = 0.1% 600 6 vii. The followig code is to ru o a pipelied processor with oe brach delay slot: I1 : ADD R2 <- R7 + R8 I2 : SUB R4 <- R5 R6 I3 : ADD R1 <- R2 + R3 I4 : STORE Memory [R4] <- R1 BRANCH to Label if R1 == 0 Which of the istructios I1, I2, I3 or I4 ca legitimately occupy the delay slot without ay other program modificatio? (2) (a) I1 (b) I2 (c) I3 (d) I4 Aswer: (D) I4: sice R1 is oly read i I4, ad its value will remai as it is while BRANCH is executed ad after BRANCH get executed, sice i BRANCH R1 is oly read. 2. Suppose a stack represetatio supports, i additio to PUSH ad POP, a operatio REVERSE, which reverses the order of the elemets o the stack. (a) To implemet a queue usig the above stack implemetatio, show how to implemet ENQUEUE usig a sigle operatio ad DEQUEUE usig a sequece of three operatios. (3) For Queue, we keep TOS (top of stack) as rear of the queue, ad BOS (bottom of stack) as frot of the queue. Thus, to add i queue from back, there is oly istructio: PUSH. To remove from the frot of queue, the three istructios i order are: REVERSE, POP, REVERSE. (b) The followig postfix expressio, cotaiig sigle digit operads ad arithmetic operators + ad *, is evaluated usig a stack. (3) show the cotets of stack: 5 2 3 4 5 2 + i after evaluatio of 5 2 * 3 4 * the steps are as follows: i. 5 is read from iput ad pushed oto stack ii. 2 is read from iput ad pushed oto stack iii. * is read ad result pop*pop = is pushed oto stack iv. 3 is read from iput ad pushed oto stack v. 4 is read from iput ad pushed oto stack vi. * is read ad result pop*pop =12 is pushed oto stack The resultat stack is as show below: 12 ii after evaluatio of 5 2 * 3 4 * 5 2 The resultat stack is: 2 5 12 3

iii at the ed of evaluatio. The resultat stack is: 12 120 130 3. Aew microprocessor is beig desiged with a covetioal architecture employig sigleaddress istructios ad 8-bit words. Due to physical size costraits, oly eight distict 3-bit opcodes are allowed. The use of modifiers or the address field to exted the opcode is forbidde. (a) What eight istructios would you implemet? specify the operatios performed by each istructio as well as the locatio of its operads. (3) Aswer The followig eight Istructios are sufficiet: add, load, stor, ad, or, cma, jmp, hlt. Followig is explaatio: i. CMA is complemet accumulator, jp is jump. All istructios, except cma, have two operads, o is explicit ad other is implicit, which is accumulator. cma has o operad, ad takes accumulator as oe implicit operad. ii. The remaiig five bits (d 0...d 4 ) are for operad. d 4 = 0 idicates that operad is i ay oe of the 16 registers, whose umber is represeted by d 3...d 0. iii. whe d 4 = 1, it idicates that operad is i memory, whose address is idicated by the register d 3...d 0. iv. Each of these registers d 0...d 15 is 16 bit, hece total memory of 64 k ca be addressed. v. The register r 0 is accumulator register (8 bits) ad status register to hold status flag for zero/o-zero. jmp is ucoditioal jump istructio. (b) Demostrate that your istructio set is fuctioally complete i some reasoable sese; or if it is ot, describe a operatio caot be programmed usig your istructio set. (3) Aswer It is possible to do ay arithmetic usig add, cma. For example, for subtractio, we do 2 s complemet additio. 2 s complemet is cma, followed with add 1. This 1 ca be kept i a register. The remaiig justificatio is as follows: i. The jump ca be made coditioal subject to the cotet of a register, say r1. If r1=0, the jumps else ot. For ucoditioal jump, keep r1=0. ii. loop ad brachig are thus implemeted, which are ecessary for cotrol. iii. all the logical operatios are possible by ad, or, ot. iv. memory store, ad load from it, are possible by load ad store istructios. v. The RR, RM, MR, MM based istructios are possible. The idirect addressig is ot provided. But that is ot compulsory, as may HLLs have o provisio. vi. You caot do the rotate accumulator. 4. It is required to desig a hardwired cotroller to hadle the fetch cycle of a sigle address of a istructio. The operad should be delivered i the fetch cycle itself. Assume that lower 8-bits of a istructio costitute the operad field. 4

(a) Draw the logic schematic of the hardwired cotroller icludig the data paths. (4) Aswer. The aswer is similar to the cotets of slide 9, page 8. The istructio op-code part goes ito IR, ad operad part goes to ay register or accumulator. The cotrol sigals are geerated as give i slide 9 page. The data bus is 16 bits. (b) Give the micro-operatios to realize the above istructio s fetch cycle. (3) Aswer. The aswer ca be foud i slide set 9, page 8. 5. A istructio pipelie has five stages, each stage takes 2 aosecods ad all istructios use all five stages. Brach istructios are ot overlapped, i.e., the istructio after the brach is ot fetched till the brach istructio is completed. Uder ideal coditios, (a) calculate the average istructio executio time assumig that 20% of all istructios executed are brach istructios. Igore the fact that some brach istructios are may be coditioal. (3) Aswer: The five stages are say: FI, DI, FO, EI, WO. After first five istructios, every 2 sec, oe istructio is executed, provided that there is o brach istructio. A brach istructio will take oly 4 states, as there is o WO. So cosumig 4 * 2 = 8 sec. Average time = 1 * 2 + 0.2 * 8 = 3.6 sec. Note: Because the brach istructios are ot overlapped. Explaatio: Avg,time = 0.2 (5 2) +0.8 ((5 2)+( 1) 2) = 2+ 0.8(+( 1)2) = 2+ 8 + 2 0.8 1.6 lim = 2+1.6 = 3.6sec (b) If a brach istructio is a coditioal brach istructio, the brach eed ot be take. If brach is ot take, the istructio followig to that istructio ca be overlapped. Whe 80% of all brach brach istructios are coditioal brach istructios, ad 50% of the coditioal brach istructios are such that the brach is take, calculate the average istructio executio time. (3) Aswer 1: Tavg = (1+stall frequecy*stall pealty)*clock time 20% are brach istructios out of which 20% ucoditioal ad 80%coditioal 50% of coditioal are take, we have to cosider oly take brach coditios: so Tavg=(1+0.2(0.2 + 0.8 * 0.5)*(5-1) ) *2 =2.96 s (cosiderig 80% as fractio of origial 20%). The detailed explaatio is as follows: Out of 20%, 80% ae coditioal brach istructios. Thus, coditioal brach istructios are=0.8 0.2=0.16. The co-coditioal istructios are 0.04. For 50% of coditioal brach istructios, there is brach, = 0.16 2 =0.08. Thus total time is= 2(5+0.8 1)+(0.08 )+(0.04 )+(0.08 1+5) 2 = 2(4+0.8)+0.8+0.4+(0.08+4) 2 = lim = 2.96sec Aswer 2: (1+0.8*(0.5*(5-1)))*2 =5.2; here 0.5 correspods to 50% brach istructios where brach has take. (cosiderig 80% as fractio of 0) 5

Cosiderig 80% total brach istructios: 0.8(0.5( )+0.5(+( 1)2))+0.2(+( 1)2) Avg.time = = 0.8(5+(5+( 1)))+0.2(8+2) = 0.8(5+(4+))+1.6+0.4 = 4+ 3.2 1.6 +0.8+ +0.4 = lim = 4+0.8+0.4 = 5.2sec. 6