Lahore University Of Management Sciences School of Arts and Sciences

Similar documents
MICROPROCESSOR AND MICROCOMPUTER BASICS

MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS

CHAPTER 7: The CPU and Memory

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

MACHINE ARCHITECTURE & LANGUAGE

Chapter 1 Computer System Overview

Chapter 5 Instructor's Manual

Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:

PART B QUESTIONS AND ANSWERS UNIT I

Microprocessor & Assembly Language

A3 Computer Architecture

İSTANBUL AYDIN UNIVERSITY

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

PROBLEMS (Cap. 4 - Istruzioni macchina)

(Refer Slide Time: 00:01:16 min)

Instruction Set Architecture (ISA)

Computer Science 281 Binary and Hexadecimal Review

Management Challenge. Managing Hardware Assets. Central Processing Unit. What is a Computer System?

1 Classical Universal Computer 3

Memory Basics. SRAM/DRAM Basics

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Computer Systems Structure Main Memory Organization

RAM & ROM Based Digital Design. ECE 152A Winter 2012

Z80 Instruction Set. Z80 Assembly Language

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

================================================================

Traditional IBM Mainframe Operating Principles

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

CPU Organization and Assembly Language

Notes on Assembly Language

CHAPTER 4 MARIE: An Introduction to a Simple Computer

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8

Central Processing Unit

CSC 2405: Computer Systems II

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

The Central Processing Unit:

Computer Organization and Architecture

With respect to the way of data access we can classify memories as:

Price/performance Modern Memory Hierarchy

Here is a diagram of a simple computer system: (this diagram will be the one needed for exams) CPU. cache

LSN 2 Computer Processors

1. Computer System Structure and Components

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

We r e going to play Final (exam) Jeopardy! "Answers:" "Questions:" - 1 -

Computer Organization and Architecture. Characteristics of Memory Systems. Chapter 4 Cache Memory. Location CPU Registers and control unit memory

Central Processing Unit (CPU)

Chapter 2 Logic Gates and Introduction to Computer Architecture

CPU Organisation and Operation

Parts of a Computer. Preparation. Objectives. Standards. Materials Micron Technology Foundation, Inc. All Rights Reserved

1 The Java Virtual Machine

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1

Chapter 7D The Java Virtual Machine

Chapter 13. PIC Family Microcontroller

Homework # 2. Solutions. 4.1 What are the differences among sequential access, direct access, and random access?

Administrative Issues

An Introduction to the ARM 7 Architecture

Memory Systems. Static Random Access Memory (SRAM) Cell

The x86 PC: Assembly Language, Design, and Interfacing 5 th Edition

Faculty of Engineering Student Number:

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-17: Memory organisation, and types of memory

SECTION C [short essay] [Not to exceed 120 words, Answer any SIX questions. Each question carries FOUR marks] 6 x 4=24 marks

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

Let s put together a Manual Processor

M6800. Assembly Language Programming

Computer organization

A N. O N Output/Input-output connection

Chapter 8 Memory Units

LC-3 Assembly Language

B.Sc.(Computer Science) and. B.Sc.(IT) Effective From July 2011

Introduction. What is an Operating System?

361 Computer Architecture Lecture 14: Cache Memory

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

EE361: Digital Computer Organization Course Syllabus

Graded ARM assembly language Examples

Useful Number Systems

Module 2. Embedded Processors and Memory. Version 2 EE IIT, Kharagpur 1

8085 INSTRUCTION SET

CSE2102 Digital Design II - Topics CSE Digital Design II

Basic Computer Organization

Logical Operations. Control Unit. Contents. Arithmetic Operations. Objectives. The Central Processing Unit: Arithmetic / Logic Unit.

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 412, University of Maryland. Guest lecturer: David Hovemeyer.

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

Lecture 2. Binary and Hexadecimal Numbers

1 Computer hardware. Peripheral Bus device "B" Peripheral device. controller. Memory. Central Processing Unit (CPU)

TIMING DIAGRAM O 8085

10CS35: Data Structures Using C

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example

Exception and Interrupt Handling in ARM

ARM Cortex-M3 Assembly Language

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 OUTCOME 3 PART 1

Read this before starting!

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

MACHINE INSTRUCTIONS AND PROGRAMS

CHAPTER 2: HARDWARE BASICS: INSIDE THE BOX

Use of Simulator in Teaching Introductory Computer Engineering*

Microcontrollers A Brief History of Microprocessors

CSE 141L Computer Architecture Lab Fall Lecture 2

Transcription:

Lahore University Of Management Sciences School of Arts and Sciences Roll No : Course Title : Computer Organization & Assembly Language Total Pages: 16 (including this page) Quarter: Spring Academic Year: 2002 2003 Course Code : CS 223/ CMPE 221 Date: 12 th April, 2003 Instructors : Shahid Masud & Tariq Jadoon Time Allowed: 1½ hrs Exam: Mid Term Total Marks: 90 The instructions below must be followed strictly. Failure to do so can result in serious grade loss. DO NOT OPEN THIS EXAM UNTIL TOLD TO DO SO. Read all questions very carefully before answering them. Check the number of papers in the question sheet and make sure the paper is complete. Keep your eyes on your own paper. You may not talk to anyone once the exam begins. leave the examination room and then return. Specific instructions: Open book/notes, help sheet: Calculator usage: Write in pen/pencil: Closed Book/Closed Notes/ No Help Sheet Desirable Anything legible, but neatly please Any other instruction(s): Attempt all questions ON this questionnaire. Be concise and answer in accordance to the allocated marks. Try to avoid overwriting/ cutting, etc. 1 7 13 19 25 2 8 14 20 26 3 9 15 21 27 4 10 16 22 28 5 11 17 23 29 6 12 18 24 Page 1 of 16

The solution shows the marking scheme for section III only) Part A [20 marks] Please encircle the correct answers. Each question carries 1 mark 1. Which of the following is a memory that can only hold its charge for a short time and must be refreshed periodically? a. DRAM b. SRAM c. SDRAM d. EPROM e. EEROM 2. Which of the following non-volatile memory is electrically erasable and programmable at the block level (multiple bytes at a time)? a. EPROM b. SRAM c. SDRAM d. Flash e. EEPROM 3. Which of the following ranks highest (smallest, most expensive, fastest access, most frequently accessed) in the memory hierarchy? a. hard drive b. cache c. CD-ROM d. RAM e. registers 4. Which of the following ranks second in the memory hierarchy? a. hard drive b. cache c. CD-ROM d. RAM e. registers 5. Which of the following ranks third in the memory hierarchy? a. hard drive b. cache c. CD-ROM d. RAM e. registers 6. Which of the following ranks the lowest (largest, least expensive, slowest access, least frequently accessed) in the memory hierarchy? a. hard drive b. L1-cache c. L2-cache d. RAM e. registers Page 2 of 16

S. Masud & T. Jadoon Computer Organization & Assembly Language (Mid Term Exam) 12 th April 2003 7. The concentric set of rings on a disk platter are called: a. gaps b. heads c. sectors d. tracks e. worms 8. The conducting coils that read and write data on a disk platter are called: a. gaps b. heads c. sectors d. tracks e. worms 9. The block-size regions that typically hold about 512 bytes of data on a disk platter called: a. gaps b. heads c. sectors d. tracks e. worms 10. The areas of separation on a disk platter that break up the areas of physical data storage are called: a. gaps b. heads c. sectors d. tracks e. worms 11. Which member of the memory hierarchy is regarded as the lowest-cost, slowest speed media? a. magnetic disk b. CD-ROM c. DVD d. magnetic tape e. Zip Drive 12. This technology, popular for storing digitized video information, has a capacity of over 5 gigabytes: a. magnetic disk b. CD-ROM c. DVD d. magnetic tape e. Zip Drive 13. The time that it takes the read/write head of a disk drive to position under the desired sector once it is positioned on the right track is called the: a. access time Page 3 of 16 Page 3 of 17

S. Masud & T. Jadoon Computer Organization & Assembly Language (Mid Term Exam) 12 th April 2003 b. rotational delay c. seek time d. transfer time 14. This time is dependent on how many bytes of data will be transferred from the disk: a. access time b. rotational delay c. seek time d. transfer time 15. The time that is required to move the read/write head to the desired track is called the: a. access time b. rotational delay c. seek time d. transfer time 16. The time that it takes to move the read/write head to both the desired track and the desired sector is called the: a. access time b. rotational delay c. seek time d. transfer time Please answer briefly in the space provided 17. RAID is an acronym for Redundant Array of Independent Disks 18. The three principal I/O techniques are: i) Programmed I/O ii) iii) Interrupts DMA 19. Label the four main structural components of a computer system COMPUTER Input / Output Main Memory System Interconnection Central Processing Unit Page 4 of 16 Page 4 of 17

20. Briefly distinguish between memory access time and memory cycle time. The memory access time is the time it takes to perform a read or write operation (for RAM), i.e. the time from the instant that an address is presented to the memory to the instant that the data have been stored or made available for use. Memory cycle time consists of the access time plus any additional time before a second access can commence and concerned with the system bus Part B 21. [15 marks] Consider a 16-bit hypothetical machine Dino-Processor of the pre-cambrian era that contains a single data register, the accumulator (AC) with the following characteristics: 0 3 4 15 Opcode Address (a) Instruction Format Dino-processor used 16-bit instructions. Four bits (0-3) were used for the opcode. The remaining twelve bits (4-15) were used for the memory address. Both Instructions and data are 16 bits long. Dino-processor s registers included the following for the indicated purpose: Program Counter (PC) = Address of next Instruction Instruction Register (IR) = Instruction being executed Accumulator (AC) = Temporary storage Some of the Dino--processor s opcodes were: 0000 Load AC from memory 0001 Store AC to memory 0010 Add to AC from memory 0011 Multiply by AC from memory 0100 Jump statement - Load PC from memory 0111 Halt the program (b) Partial List of Opcodes Page 5 of 16

The initial state of the memory (in hexadecimal notation) is detailed on page 6. Suppose the program counter is initialized so that the instruction at location 100h is executed first. Step through the program, updating the appropriate registers and memory locations, until the Halt instruction is reached. Answer the questions using the table provided on the next page detailing the initial contents of memory. You may also use the reverse side for rough work if necessary. a) What is the value of memory location 11Ah? 0003 h b) What is the value of memory location 11Ch? 0008 h or 0005 h c) What is the value of memory location 11Eh? 0003 h d) What is the value of memory location 120h? 000A h e) What is the value of memory location 122h? 0002 h f) What is the value of memory location 124h? 0004 h PTO Page 6 of 16

Initial Contents of Memory in hex: Rough Work Location Contents 100 011C 102 3122 104 1120 106 011A 108 211E 10A 111A 10C 4112 10E 1120 110 1124 112 011C 114 211A 116 111C 118 7000 11A 0000 Step No: 1. AC= 0005 2. AC= 000A 3. location 120: 000A 4. AC= 0000 5. AC= 0003 6. location 11A: 0003 7. PC = 112 8. AC= 0005 9. AC= 0008 10. location 11C = 0008 OR Alternatively 7. PC = 11C 8. Can not continue, as we don t know the contents of location 005 11C 0005 11E 0003 120 0000 122 0002 124 0004 Page 7 of 16

Q22. [10 marks] An 8-bit microprocessor has a total addressable space of 64 kbytes. Organize the memory space so that the first 16 kbytes is ROM. The next 8 kbytes is empty for future expansion. This is followed by 16 kbytes RAM. The remaining space is once again empty for future expansion. (a) Label the starting and ending addresses of each region in hexadecimal. [4] 16 k Bytes (ROM) 8 k Bytes (free) 16 k Bytes (RAM) 0000 h 3FF F h 4000 h 5FFF h 6000 h 9FFF h A000 h free FFFF h Rough Work If the available ROM chips are (16k x 8) and RAM chips are (16k x 8). Draw a block diagram of a suitable memory design implementing the memory map described in part (a) on the reverse side of this sheet. Label the address, data, and control lines on the microprocessor and memory chips. You may use additional logic chips if required. [6] Page 8 of 16

OR Gate A15 A14 OR Gate A13 3X8 Decoder A0-A12 Read CS Read/ Write CS 16 K x 8 16 K x 8 ROM RAM D0-D7 Microprocessor Page 9 of 16

Q 23. [15 marks] A microprocessor has an on-chip 2-way set associative cache with a total capacity of 8 kbyte. Each line in cache can store sixteen 8-bit words. It has a total addressable space of 16 MBytes. Consider the following CPU instruction: Load AB1234h a) Which set number will this request be stored in cache? [2] Number of lines in a set (k) = 2 Total capacity of the cache = 8 k Byte Block size = 2 w = line size = sixteen 8 bit words = 16 bytes Number of sets (v) = 2 d = Total capacity /( k x line size) = 256 Total addressable space = = 2 s+w = 16 M bytes Address length = (s + w) bits = 24 bits Thus, in the main memory address: Size of set = d = 8 bits Size of a word = w = 4 bits Size of a tag = (s-d) bits = 12 bits Therefore, Load AB1234h will store the result in set number: 23 h b) What will be its corresponding tag number? [2] The corresponding tag number will be : AB1 h If the microprocessor had a direct mapped cache with half the capacity of the set associative cache. Then, c) Which line number would the request be saved in? [2] If a microprocessor had a direct mapped cache with half the capacity of the set of the two way set associative cache, then it would have a capacity of 4 kbytes and effectively the same number of lines as the number of sets in the set associative cache, i.e. Number of lines in cache = m = 2 r = 256 Thus, in the main memory address: Size of a line = r = 8 bits Size of a word = w = 4 bits Size of a tag = (s- r) bits = 12 bits Therefore, Load AB1234h will store the result inline number: 23 h Page 10 of 16

d) What will be the corresponding tag number [2] The corresponding tag number will once again be : AB1 h Now consider the case if the microprocessor had an associative cache with four times the capacity of the direct mapped cache. e) Which line number would the request be saved in? [1] In associative mapping any block can be stored in any line depending upon the current occupancy and replacement algorithms. Thus, we cannot say for sure which line number the request will be saved in. f) What will be the corresponding tag number? [2] Address length = (s + w) bits = 24 bits Thus, in the main memory address: Size of a word = w = 4 bits Size of a tag = s bits = 20 bits Therefore, Load AB1234h will store the result with a tag number: AB123 h g) Which of the above caches will have the fastest access time. Justify your answer. [2] The direct cache will have the fastest access time, given a hit, i.e. the presence of the requested block in cache as only one comparison of the tag will determine whether the requisite block is present or absent. Whereas, in associative memory one would have to compare the required tag with all tags in cache and in a set associative cache one would have to compare the required tag with all tags in the set. h) Which of the above caches has the best overall performance considering replacement. [2] Of the three schemes under consideration, the set-associative cache will have the best overall performance considering replacement. Access time from main memory is typical much larger than the access time from cache. Thus, if a situation where more than one block was alternatively required that mapped to the same line number. Direct mapping would require us to overwrite the blocks alternatively and this would be highly inefficient (thrashing). Associative mapping overcomes this but one has to go through the entire cache comparing tags to search for a block. Set-associative cache requires a relatively short time to access a block because one only checks for a required block by comparing tags within a set usually of size 2 or 4 whilst avoiding thrashing Page 11 of 16

24. [15 marks] a) Convert the binary number 1001011.101 to decimal [2] 1001011.101 = 1 2 3 + 1 2 + 1 2 + 1 2 + 1 2 = 0.125 + 0.5 + 1 + 2 + 8 + 64 = 75.625 b) Convert the hexadecimal number AC to decimal: [1] 1 0 1 3 + 1 2 6 AC = 12 16 = 172 0 + 10 16 1 What are the smallest and largest numbers that you can represent in a 10-bit register using: c) Unsigned notation [2] smallest number = 0 largest number = 2 10 1 = 1024 1= 1023 d) Two s complement notation (using the left-most bit as the sign-bit) [2] 9 smallest number = - 2 9 largest number = + 2 = 512 1 = + 511 e) Consider the following data definitions in a program: [2].data list WORD 13, 11o, 42h, 00101011b Fill out the corresponding values in HEX in the following table. The offsets are from the data segment. Offset Value 0000 00 h 0001 0D h Page 12 of 16

0002 00 h 0003 09 h 0004 00 h 0005 42 h 0006 00 h 0007 2B h Using the Little Endian format f) Under what conditions are the following flags set: i) overflow flag [1] Two positive operands were added and their sum is negative Two negative operands were added and their sum is positive ii) carry flag [1] If the result of an unsigned addition is too large (or too small) for the destination operand the carry flag is set. g) Would the following instruction set the zero flag? Explain. [1] MOV AX, 0000h ;clear the AX register This MOV instruction does not affect the zero flag. Flags are affected by ALU operations h) Is it possible for a NEG instruction to set the Overflow flag? [1] The NEG instruction can set the overflow flag if we try to negate the smallest signed integer in a register. The NEG instruction results in a positive integer, which cannot fit into the same register. For example moving 128 to AL and trying to negate it results in +128, which cannot fit in AL and consequently causes the overflow, flag to be set. Page 13 of 16

i) Consider the following code: mov ax, 0h mov cx, 0Ah doloop: dec ax loop doloop What is the value of the ax register after the completion of the doloop? [2] The value of the ax register after completion of the loop is: FFF6 h Rough Work Page 14 of 16

Part C [15 marks] 26. Which technique frees up the CPU by transferring data directly between the I/O device and memory: [1] a. Programmed I/O b. Interrupts c. I/O Channel d. I/O Registers e. I/O Processor f. DMA 27. In which technique, does the CPU issue an I/O command, continues to execute subsequent instructions, and is interrupted by the I/O module when the latter has completed its work: [1] a. Programmed I/O b. Interrupts c. I/O Channel d. I/O Registers e. I/O Processor f. DMA 28. When an interrupt occurs, arrange the following operations in their order of occurrence? [3] a) interrupt service routine executed b) the registers are restored by popping their values off of the stack c) the processor identifies the source of the interrupt d) the program counter and other registers' values are pushed onto the stack e) the address of the interrupt service routine is placed in the program counter Order of Occurrence: 1. c 2. d 3. e 4. a 5. b PTO Page 15 of 16

29. [10 marks] SP (Stack Pointer) Consider that an interrupt takes place when the microprocessor is executing an instruction stored at location N. The status flags at this instant contain the value ABCDh. The corresponding interrupt service routine (ISR) is stored in memory starting from location X and X + C (both inclusive) a) What is the address of the instruction that will be executed after the interrupt occurs. [2] X X start b) Where will the program branch to after the completion of the interrupt? [2] N + 1 c) How will the microprocessor know where to branch after the completion of the interrupt? [3] X+C end Prior to branching to the ISR the microprocessor stores the address of the current value of the Instruction pointer onto the stack. On completion of the subroutine it pops this address off the stack and loads this into the instruction pointer and thus branches back to the correct location. User Program N MAIN MEMORY d) What will happen if a second interrupt takes place while the first one is being serviced? [3] If a second interrupt took place, then if it were of higher priority and the interrupt process was enabled the microprocessor would once again push the current context onto the stack and branch to the new ISR and on completing it branch back and complete the first ISR by popping off the context from the stack. If the interrupt process was disabled or if the new interrupt was of a lower or the same priority as the current interrupt it would remain pending. Page 16 of 16