COMP3221: Microprocessors and Embedded Systems Final Exam Lecturer: Hui Wu Session 1, 2005.

Slides:



Advertisements
Similar presentations
Computer Architecture
Advertisements

COMP3221: Microprocessors and Embedded Systems
I/O Unit.
CSCI 4717/5717 Computer Architecture
(1) ICS 313: Programming Language Theory Chapter 10: Implementing Subprograms.
COMP3221: Microprocessors and Embedded Systems Lecture 12: Functions I Lecturer: Hui Wu Session 2, 2005.
Inline Assembly Section 1: Recitation 7. In the early days of computing, most programs were written in assembly code. –Unmanageable because No type checking,
Interrupts (contd..) Multiple I/O devices may be connected to the processor and the memory via a bus. Some or all of these devices may be capable of generating.
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
COMP3221: Microprocessors and Embedded Systems--Lecture 8 1 COMP3221: Microprocessors and Embedded Systems Lecture 8: Program Control Instructions
1 Lecture 2: Review of Computer Organization Operating System Spring 2007.
1 Homework Turn in HW2 at start of next class. Starting Chapter 2 K&R. Read ahead. HW3 is on line. –Due: class 9, but a lot to do! –You may want to get.
Arrays An array is a sequence of objects all of which have the same type. The objects are called the elements of the array and are numbered consecutively.
1 Chapter 7: Runtime Environments. int * larger (int a, int b) { if (a > b) return &a; //wrong else return &b; //wrong } int * larger (int *a, int *b)
COMP3221: Microprocessors and Embedded Systems Lecture 2: Instruction Set Architecture (ISA) Lecturer: Hui Wu Session.
1 Handling nested procedures Method 1 : static (access) links –Reference to the frame of the lexically enclosing procedure –Static chains of such links.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
6-1 I/O Methods I/O – Transfer of data between memory of the system and the I/O device Most devices operate asynchronously from the CPU Most methods involve.
EECE 344 – Microprocessors Quick Review. Information Representation Integer representation – whole numbers –Unsigned binary –2’s complement –Excess codes.
COMP3221: Microprocessors and Embedded Systems--Lecture 4 1 COMP3221: Microprocessors and Embedded Systems Lecture 4: Number Systems (II)
1 Interrupts INPUT/OUTPUT ORGANIZATION: Interrupts CS 147 JOKO SUTOMO.
Computer Organization and Assembly language
COMP3221: Microprocessors and Embedded Systems--Lecture 9 1 COMP3221: Microprocessors and Embedded Systems Lecture 9: Data Transfer Instructions
Architecture of the 8051 INTERNAL DATA BUS Oscillator & Timing Programmable I/O (32 Pins) 80C51 CPU 64K byte Expansion Control Serial I/O 4K Program Memory.
INPUT/OUTPUT ORGANIZATION INTERRUPTS CS147 Summer 2001 Professor: Sin-Min Lee Presented by: Jing Chen.
COMP3221: Microprocessors and Embedded Systems Lecture 13: Functions II Lecturer: Hui Wu Session 2, 2005.
The 8051 Microcontroller and Embedded Systems
Embedded Systems 7763B Mt Druitt College of TAFE
Chapter 1 Algorithm Analysis
COE Computer Organization & Assembly Language Talal Alkharobi.
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
Ch. 9 Interrupt Programming and Real-Time Sysstems From Valvano’s Introduction to Embedded Systems.
MICROPROCESSOR INPUT/OUTPUT
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
PIC16F877 ISR Points to note Interrupt Triggers –Individual interrupt flag bits are set, regardless of the status of their corresponding mask bit, PEIE.
Memory Management 3 Tanenbaum Ch. 3 Silberschatz Ch. 8,9.
Computer Science Department Data Structure & Algorithms Lecture 8 Recursion.
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
Interrupts general concepts interrupt systems. Interrupts - concepts 2/27 Interrupt - the event inside or outside of microprocessor system, requested.
Objective At the conclusion of this chapter you will be able to:
CSNB374: Microprocessor Systems Chapter 5: Procedures and Interrupts.
CS161 Topic #16 1 Today in CS161 Lecture #16 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for)
1 © Unitec New Zealand Interrupt Lecture 6 Date: - 20 Sept, 2011 Embedded Hardware ETEC 6416.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
Operating System 1 COMPUTER SYSTEM OVERVIEW Achmad Arwan, S.Kom.
6-1 Infineon 167 Interrupts The C167CS provides 56 separate interrupt sources that may be assigned to 16 priority levels. The C167CS uses a vectored interrupt.
Lecture 1: Review of Computer Organization
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
1 Notation and Specification of Concurrency n Concurrency Topics  1. Sequential programming notation  2. Expressing concurrency with co and process 
بسم الله الرحمن الرحيم MEMORY AND I/O.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
7-Nov Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Oct lecture23-24-hll-interrupts 1 High Level Language vs. Assembly.
COMP2121: Microprocessors and Interfacing
Microprocessor Systems Design I
Microprocessor and Assembly Language
COMP3221: Microprocessors and Embedded Systems
COMP2121: Microprocessors and Interfacing
Main Memory Background Swapping Contiguous Allocation Paging
COMP2121: Microprocessors and Interfacing
Interrupt Source: under
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
COMP3221: Microprocessors and Embedded Systems
COMP3221: Microprocessors and Embedded Systems
A Top-Level View Of Computer Function And Interconnection
Presentation transcript:

COMP3221: Microprocessors and Embedded Systems Final Exam Lecturer: Hui Wu Session 1, 2005

COMP3221/9221: Microprocessors and Embedded Systems 2 Final Exam 3 hours. Open book.  No calculator is allowed. 50% of the total marks.  Lab: 25%  Assignment1: 10%  Assignment 2: 15% Different exam papers for undergraduate and postgraduate students.

COMP3221/9221: Microprocessors and Embedded Systems 3 Scope of Final Exam Topics Covered: All topics, excluding Serial Communication and Memory Systems.

COMP3221/9221: Microprocessors and Embedded Systems 4 Structure of Final Exam Four Questions: Question 1: Basic Concepts (20 marks)  10 PARTs. Question 2: Miscellaneous Questions (20 marks)  7 PARTs. Question 3: AVR Assembly Programming (30 marks)  3 PARTs. Question 4: Interrupts and I/O (30 marks)  7 PARTs.

COMP3221/9221: Microprocessors and Embedded Systems 5 Sample PARTs in Question 1 Discuss the advantages of using macros versus functions. (2 marks)

COMP3221/9221: Microprocessors and Embedded Systems 6 Sample PARTs in Question 1 (Cont.) Describe how the prioritisation is achieved in daisy chain interrupts. (2 marks)

COMP3221/9221: Microprocessors and Embedded Systems 7 Sample PARTs in Question 2 Consider a two dimensional integer array A, where the array element A[x,y] is at row x ( x  0) and column y ( y  0). A is stored at 0x0200 in memory and has 100 rows and 50 columns. The size of each element is eight bytes. Assume that array A is stored in memory in row- major order i.e. in sequential order; the elements of row 0 first, row 1 second and so on. Give a formula for computing the address of the element A[i,j] (0  i  99 and 0  j  49). (3 marks)

COMP3221/9221: Microprocessors and Embedded Systems 8 Sample PARTs in Question 2 (Cont.) Consider two single precision floating point numbers x and y in IEEE 754 format, where x=0xC0EE8000 and y=0xC1AA4000. What is the hexadecimal value of the result of x+y in IEEE 754 format? (3 marks)

9 Sample PARTs in Question 2 (Cont.) Consider the following AVR assembly code..set x=pc ldi r20, low(x) ldi r21, high(x) ldi r30, low(pc) ldi r31, high(pc) Assume that the address of the instruction “ ldi r20, low(x)” is 0x0202. After the above sequence of code is executed, what are the contents in r20, r21, r30, and r31, respectively? (3 marks)

10 Sample PARTs in Question 2 (Cont.) A C program consists of five functions. Their calling relations are shown as follows (the arguments and irrelevant C statements are omitted). int main(void) { … func1(…); func2(…); … }

11 Sample PARTs in Question 2 (Cont.) int func1(…) { … func1(…); … } int func2(…) { … func3(…); func4(…); … }

12 Sample PARTs in Question 2 (Cont.) func1() is a recursive function and calls itself 15 times for the actual parameters given in main(). Both func3() and func4() do not call any function. The sizes of all stack frames are shown as follows. main(): 200 bytes. func1(): 100 bytes. func2(): 400 bytes. func3(): 1,400 bytes func4(): 300 bytes Draw the call tree of this program. (2 marks) How much stack space is needed to execute this program correctly? (3 marks)

COMP3221/9221: Microprocessors and Embedded Systems 13 Sample PARTs in Question 3 Write an AVR assembly program to find the minimum value of all array elements in the one-dimensional integer array A. Your program must satisfy the following requirements. Array A has 10 elements and each element is a 2-byte signed integer. Each element A[i] (i=0, 1, …, 9) has an initial value that is stored in the flash memory. You may choose any integer value for each element. Array A is stored contiguously in the SRAM. Your program must define and use at lease one MACRO. The minimum value found by your program is stored in registers r26:r25. (10 marks)

COMP3221/9221: Microprocessors and Embedded Systems 14 Sample PARTs in Question 3 (Cont.) Consider an embedded system using an AVR Mega64 microcontroller. Assume that Timer/Counter 0 Overflow Interrupt has been set to occur every 200 ms in the main program. Write an interrupt service routine ISR0 for Timer/Counter 0 Overflow Interrupt to count the number of hours that has passed since the embedded system started to operate. (10 marks)

15 Sample PARTs in Question 3 (Cont.) Write an AVR assembly program to implement the following C program. int sum(int n); int main(void) { int n=100; sum(n); return 0; }

16 Sample PARTs in Question 3 (Cont.) int sum(int n) { if (n<=0) return 0; else return (n+ sum(n-1)); } All local variables and parameters must be stored in the stack space. You need to choose a proper size for n and describe the stack frame structure using a diagram. (10 marks)

17 Sample PARTs in Question 4 Assume for a processor with a 700 MHz clock it takes 150 clock cycles for a polling operation (calling polling routine, accessing the device, and returning). The overhead for an interrupt operation is 200 clock cycles. Hard disk transfers data in 128-byte chunks and can transfer at 6 M bytes/second rate. If the processor uses software polling, what percentage of the processor time is tied up in polling the hard disk to achieve a data transfer rate of 6M bytes/second? (4 marks)

18 Sample PARTs in Question 4 (Cont.) If the processor uses interrupt technique and the interrupt rate is equal to software polling rate, what percentage of the processor time is tied up in servicing interrupt by the hard disk during the data transfer? (4 marks)

19 Sample PARTs in Question 4 (Cont.) Consider an embedded system using an AVR mega64 microcontroller. There are 5 interrupting sources, Int0, Int1, …, Int4. The size of the stack space needed by each interrupt service routine, denoted also by Inti (i=0, 1, …, 4) for simplicity, is shown as follows. Int0: 100 bytes Int1: 50 bytes Int2: 20 bytes Int3: 40 bytes Int4: 50 bytes If no interrupt occurs, the correct execution of the program needs 1K bytes of stack space in the worst case.

20 Sample PARTs in Question 4 (Cont.) If interrupts may occur at any time and each interrupt service routine does not enable the Global Interrupt Flag I in the Program Status Register, how much stack space is needed by the program in the worst case? (4 marks)

21 Sample PARTs in Question 4 (Cont.) Assume that an interrupting device generates a new interrupt request only if its last interrupt request has been processed i.e. its interrupt service routine has been finished. If interrupts may occur at any time and each interrupt service routine enables the Global Interrupt Flag I in the Program Status Register at the beginning of the interrupt service routine, how much stack space is needed by program in the worst case? (4 marks)

22 Sample PARTs in Question 4 (Cont.) Consider designing an electronic toy. It uses a 2*2 keypad to get the input from the user and requires that any decimal integer number and four directions (up, down, left and right) be input via 4 keys. If a straightforward key scanning approach like the one in our Lab 4 is used, only 4 symbols can be input to the electronic toy, which does not satisfy the requirement.

23 Sample PARTs in Question 4 (Cont.) Design an encoding scheme such that all the required symbols can be represented via 4 keys. (4 marks)

24 Sample PARTs in Question 4 (Cont.) Describe a key scanning procedure which implements your encoding scheme using a diagram or an algorithm. (6 marks)