C SC 230 Computer Architecture and Assembly Language April 2000 Exam Sample Solutions

Similar documents
Programming the Motorola MC68HC11 Microcontroller

Table 1: Mnemonics Operations Dictionary. Add Accumulators Add B to Y. Add with carry to B. Add Memory to B. Add 16-bit to D And B with Memory

The Motorola 68HC11 Instruc5on Set

Timing Generation and Measurements

Ryerson University Department of Electrical and Computer Engineering ELE 538 Microprocessor Systems Final Examination December 8, 2003

ECE/CE 3720: Embedded System Design

Capstone Design Course. Lecture-2: The Timer

EE 3170 Microcontroller Applications

ECE331 Handout 3- ASM Instructions, Address Modes and Directives

Lecture 9 Subroutines

Sample Problem Set #1

Coe538 Final Study Guide 2016 (Questions & Answers)

COE538 Lecture Notes Week 3 (Week of Sept 17, 2012)

ME 6405 Introduction to Mechatronics

Lecture 6 Assembly Programming: Branch & Iteration

EE319K Final Fall 2005 Solution C. (3) Question 1. (3) Question 2. short function(const short in){ return in+5; } const

MACO Multiple Agent Climbing Organism

2) [ 2 marks] Both of the following statements cause the value $0300 to be stored in location $1000, but at different times. Explain the difference.

Using the stack and the stack pointer

68HC11 Opera,ng Modes

0b) [2] Can you name 2 people form technical support services (stockroom)?

Introduction to Mechatronics. Fall Instructor: Professor Charles Ume. Interrupts and Resets

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University

BRANCH IF REGISTER IS HIGHER/GREATHER/ THAN OPERAND e.g. CMPA #$D0

538 Lecture Notes Week 5

AN Kbyte Addressing with the M68HC11. Overview

SECTION 6 CENTRAL PROCESSING UNIT

EE319 K Lecture 3. Introduction to the 9S12 Lab 1 Discussion Using the TExaS simulator. University of Texas ECE

538 Lecture Notes Week 5

Outline. 2.8 Stack. 2.9 Subroutines

538 Lecture Notes Week 3

ECE 3120: Computer Systems Chapter 8: ECE-3120-A Musical

Module 1-G. Marcos and Structured Programming

Module 1-D. Control Structure Applications. Tim Rogers 2017 [1.D]-1

COSC345 Software Engineering. Basic Computer Architecture and The Stack

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

MC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes. Summary of HCS12 addressing modes ADDRESSING MODES

Addressing Mode Description Addressing Mode Source Format Abbrev. Description

Chapter 2: HCS12 Assembly Programming. EE383: Introduction to Embedded Systems University of Kentucky. Samir Rawashdeh

Exam 2 E2-1 Fall Name: Exam 2

538 Lecture Notes Week 3

Exam 2 E2-1 Fall Name: Exam 2

ECE/CE 3720: Embedded System Design

Cross Assembly and Program Development

* COMPILER CONSTANTS * ***********************************************************************************

Decimal, Hexadecimal and Binary Numbers Writing an assembly language program

Module 2.F. Buffered, Interrupt-Driven Printer Design Example. Tim Rogers 2017

Lab 7: Asynchronous Serial I/O

Introduction to Embedded Microcomputer Systems Lecture 10.1

Exam I Review February 2017

2. Arithmetic Instructions addition, subtraction, multiplication, divison (HCS12 Core Users Guide, Sections 4.3.4, and ).

CMPEN 472 Sample EXAM II

Assembly Language Development Process. ECE/CS 5780/6780: Embedded System Design. Assembly Language Listing. Assembly Language Syntax

ME4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 7

Disassembly of an HC12 Program It is sometimes useful to be able to convert HC12 op codes into mnemonics. For example, consider the hex code:

Motorola HC11. Fun with Microcontrollers and Embedded Systems

ECE/CS 5780/6780: Embedded System Design

Introduction to Programming the 9S12 in C Huang Sections 5.2 and 5.3. You will be able to use all of the Motorola data manuals on the exam.

CHAPTER 8. Solutions for Exercises

AN1064. Motorola Semiconductor Application Note. Use of Stack Simplifies M68HC11 Programming By Gordon Doughman. Introduction

LECTURE #21: G-CPU & Assembly Code EEL 3701: Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz

Administrivia. ECE/CS 5780/6780: Embedded System Design. Assembly Language Syntax. Assembly Language Development Process

EB193. Motorola Semiconductor Engineering Bulletin. Replacing 68HC11A Series MCUs with 68HC11E Series MCUs. Freescale Semiconductor, I.

Chapter 4: Advanced Assembly Programming. EE383: Introduction to Embedded Systems University of Kentucky. Samir Rawashdeh

Reading Assignment. 68HC12 Instruction Set. M68HC12 Instruction Set Categories. Some Tips. Endianness (Byte Order) Load and Store Instructions

Go Gators! Relax! May the Schwartz be with you!

ECE 367 -Experiment #1 Fall 2012

EE4390 Microprocessors

HC11 Instruction Set

EMCH 367 Fundamentals of Microcontrollers Example_Sort EXAMPLE SORT

COSC 243. Instruction Sets And Addressing Modes. Lecture 7&8 Instruction Sets and Addressing Modes. COSC 243 (Computer Architecture)

ECE3120: Computer Systems Hardware & Software Development Tools

Introduction to Microcontrollers

EE319K Fall 2007 Quiz 1A Page 1. (5) Question 2. What will be the value of the carry (C) bit after executing the following? ldab #210 subb #60

68HC11 PROGRAMMER'S MODEL

m 1 se 7 m 23 Introduction to Embedded Microcomputer Systems Lecture 16.1 Recap Finite State Machines Pointer implementation

Introduction to Microcontrollers II

1 Execution of main program is suspended. 2 All registers are pushed onto the stack. 3 The ISR, or background thread, is executed.

CET335 Microprocessor Interfacing Lab 5: LCD Interface (Bus Attached Peripheral)

HC11 Instruction Set Architecture

(5) Question 7. Simplified memory cycles (you may or may not need all 5 entries) R/W Addr Data

EE345L Spring 2006 May 10, 2006, 2-5pm Page 1 of 8

HC11 Instruction Set Architecture

Superscalar Processors

1. Memory Mapped Systems 2. Adding Unsigned Numbers

EEL 4744C: Microprocessor Applications. Lecture 7. Part 2. M68HC12 Interrupt. Dr. Tao Li 1

EE319K Fall 2003 Quiz 1 Page 1

ECE/CS 5780/6780: Embedded System Design

Introduction to Microcontrollers II

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-470/570: Microprocessor-Based System Design Fall 2014.

Exam 1 Feb. 23, 25, 27?

UNIVERSITY OF HONG KONG DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING. Principles of Computer Operation

Mark II Aiken Relay Calculator

CPU08RM/AD REV 3 8M68HC08M. CPU08 Central Processor Unit. Reference Manual

Chapter 2 HCS12 Assembly Language

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

EE319K Fall 2006 Quiz 1 Page 1

CENG3420 Lecture 03 Review

Interrupts. Interrupts Resets Low Power Modes. Resets Low Power Modes

Transcription:

C SC 230 Computer Architecture and Assembly Language April 2000 Exam Sample Solutions 1. (12 marks) Circle the correct answer for each of the following: The 8-bit two's complement representation of -15 10 is 11110001 2. True False Two s complement representation has different representations for +0 and 0. True False In two's complement addition, overflow can only occur when adding two positive numbers. True False Single bit parity allows for the detection and correction of single bit errors. True False On the 6811, the external address and data buses are asynchronous. True False The data bus to main memory must have the same number of bits as the word size. True False A processor must have a stack pointer register in order to support a jump to subroutine instruction. True False Program memory parameter passing can never be used if the program code is to be stored in ROM. True False On the 6811, on-processor memory can share addresses with off-processor IO devices. True False Unless explicitly forbidden by the user program, nested maskable interrupts are allowed on the 6811. True False Polling should never be used if an interrupt can be used instead. True False The PowerPC uses purely hardware supported branch prediction. True False 2. (10 marks) Explain how any two of the PowerPC, Pentium II/III and Crusoe processors handle the out of order execution of instructions. (5 marks each for any two) PowerPC: Instructions are held in an instruction execution pool. The hardware is capable of dispatching any of the bottom four instructions in the queue to the appropriate execution unit. Hence the out of order execution is at the instruction level where all instructions have fixed size. The hardware ensures that the reordering of the instructions will not affect the result i.e. it checks for dependencies. Pentium: Instructions are decomposed by the hardware into micro-ops which are placed in an instruction pool. Micro-ops can be dispatched from the pool to execution units out of order. A hardware retirement unit is used to piece back the micro-ops in order to ensure the result is the same as if the original instructions were executed in order. Crusoe: (not covered Fall 2001) The code morphing software decomposes X86 (Intel) instructions into fixed length instructions called atoms. The software packs these atoms into very long word instructions (molecules). The packing can be out of order. Molecules are

April Examinations 2000 C SC 230 S01 Page 1 of 6 executed in order with atoms executed in parallel. The hardware uses special holding registers to ensure the results reflect execution of the original X86 instructions. 3. (5 marks) Number the following steps from 1 to 5 in the order they are performed in processing an interrupt on the 6811 using the interrupt jump table technique correct answer 1 1 1 1 recognize the interrupt event and set the event flag 3 2 3 2 load the PC with the value from the appropriate interrupt vector 5 5 5 5 execute the first instruction of the interrupt handling routine 2 3 4 4 push the processor registers onto the stack 4 4 2 3 execute the appropriate jump instruction in the jump table 5 4 3 2 marks (the list shows the common responses) 4. (3 marks) What does it mean to say a processor is superscalar and what is the most fundamental property of a superscalar processor design? A processor is superscalar if it can execute more than one instruction per processor clock cycle. (1 mark) A superscalar design must have multiple execution units so that instructions can be executed in parallel. (2 marks) 5. (6 marks) What are the four basic stages in an instruction pipeline? Fetch and decode instruction Fetch operands (1 marl each) Execute instruction Store results Why does a pipeline help improve instruction throughput on a processor? A pipeline allows several instructions each at different stages of execution to be executed in parallel. (2 marks) 6. (4 marks) For the single precision IEEE floating point representation for 13.5 10

April Examinations 2000 C SC 230 S01 Page 2 of 6 What is the value of the sign bit: 0 (1 mark) What is the actual value stored for the exponent (in decimal): 130 (1 mark)_ What is the actual value stored for the mantissa (in binary): 1011 (2 marks) (do not show trailing 0 s) 7. (10 marks) Explain each of the following terms with respect to cache memory: associative cache: The memory address is held in a tag (1 mark) and all tags have to be searched to locate the address (1 mark). direct mapped cache: The cache is divided into slots and each line must be in a specific slot (1 mark). The cache checks one slot only and if the line is not found it is brought in from memory into that slot. (1 mark) set-associative cache: A combination of set associative and direct mapped. (1 mark) A line can appear in any one of a set of slots (1 mark). write back The data is written to the cache and is not written back to main memory until the line of the cache has to be swapped out. (2 marks) replacement policy (give one example): The policy by which the cache decides which line to swap out to make room for a needed line (1 mark). Example: one of random, FIFO, LRU or access count. 8. (10 marks) ; finds sum of numbers from 1 to 99 which are also integer ; multiples of 3 ; ; the answer is in IX ORG $C000 START LDX #0 LDAB #3 / SMALLEDT ODD NUMBER WHICH IS A MULTIPLE OF 3 LOOP ABX SKIP ADDB #6 / MULTIPLES OF 3 WHICH ARE ODD ARE 6 APART CMPB #99 BLS LOOP

April Examinations 2000 C SC 230 S01 Page 3 of 6 9. (15 marks) ; checks a list to see if it is ordered ; returns 0 if not ordered; +1 if ascending; -1 if descending ; ORDERED PSHB / SAVE REGISTERS PSHX PSHY TSX LDAA #0 / ASSUME UNORDERED LDAB 7,X LDX 8,X LOOP LDY 0,X CPY 2,X / COMPARE ADJACENT ELEMENTS BLT ASCEND BEQ NEXT / IGNORE PAIR IF EQUAL CMPA #1 / DESCENDING BEQ UN LDAA #-1 BRA NEXT ASCEND CMPA #-1 / ASCENDING BEQ UN LDAA #1 NEXT INX / MOVE DOWN LIST INX DECB / DEC COUNT CMPB #1 / CHECK FOR END BNE LOOP BRA DONE UN CLRA / UNORDERED DONE PULY / RESTORE REGISTERS PULX PULB RTS

April Examinations 2000 C SC 230 S01 Page 4 of 6 10. (25 marks) REGBASE EQU $1000 / USE THESE DEFINITIONS PORTA EQU $0 / YOU MAY NOT NEED THEM ALL TCNT EQU $0E / YOU CAN ADD ANY OTHERS TIC3 EQU $14 / YOU NEED TOC2 EQU $18 TCTL2 EQU $21 TMSK1 EQU $22 TMSK2 EQU $24 TFLG1 EQU $23 TFLG2 EQU $25 IC1 EQU $04 OC2 EQU $40 SLICE EQU 40000 MAX EQU 250 ORG $D000 TCOUNT RMB 2 EDGEPAR RMB 1 ORG $00E8 JMP IC1ISR ORG $00DC JMP OC2ISR ORG $C000 SEI LDX #REGBASE LDAA #IC1 STAA TMSK1,X LDX #REGBASE BSET TCTL2,X $30 / DETECT BOTH EDGES ON IC1 LDAA #IC1 / CLEAR FLAG CLR EDGEPAR CLI BRA * IC1ISR LDX #REGBASE LDAA #IC1 LDAA PORTA,X ANDA #IC1 BEQ IC1FE IC1RE LDAA EDGEPAR / FLIP EDGE PARITY EORA #1 STAA EDGEPAR BEQ IC12E IC11E BSET TMSK1,X OC2 / FIRST EDGE OF PAIR

April Examinations 2000 C SC 230 S01 Page 5 of 6 IC12E TIMING IC1FE DONE LDD TCNT,X / START TIMING ADDD #SLICE STD TOC2,X LDAA #OC2 CLR TCOUNT CLR TCOUNT+1 BRA DONE BCLR TMSK1,X OC2 / 2ND EDGE OF PAIR STOP LDD TCOUNT CPD #MAX BGT DONE BSET PORTA,X $40 / WITH TIME SO TURN LED ON BRA DONE BCLR PORTA,X $40 / TURN LED OFF RTI OC2ISR LDX #REGBASE LDAA #OC2 LDX TCOUNT INX STX TCOUNT RTI / CLEAR FLAG / INC TIME COUNT