UNIMPLEMENTED INSTRUCTIONS

Similar documents
SINE AND COSINE SUBROUTINES

CHECKOUT: There will be a scheduled checkout for this lab beginning November 13th in the Kern Lab. Schedules will be ed to you.

Computer Architecture 5.1. Computer Architecture. 5.2 Vector Address: Interrupt sources (IS) such as I/O, Timer 5.3. Computer Architecture

ECE232: Hardware Organization and Design

stack frame where register An is used as the argument pointer.

Programming Model 2 A. Introduction

ECE 109 Sections 602 to 605 Final exam Fall December, 2007

Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Review Topics. parameter passing, memory model)

Chapter 7 Subroutines. Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C

Design of Embedded Systems Using 68HC12/11 Microcontrollers

Assembly Language Programming of 8085

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

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

The von Neumann Architecture. IT 3123 Hardware and Software Concepts. The Instruction Cycle. Registers. LMC Executes a Store.

Shift and Rotate Instructions

PROGRAM CONTROL UNIT (PCU)

Subroutine. Chapter 8

LAB 1: MC68000 CPU PROGRAMMING DATA TRANSFER INSTRUCTIONS

CS401 - Computer Architecture and Assembly Language Programming Glossary By

Instruction : A command to the microprocessor to perform a given task on specified data. Each instruction has two parts

Computer Architecture Programming the Basic Computer

Introduction to CPU architecture using the M6800 microprocessor

SECTION 8 EXCEPTION PROCESSING

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

Tutorial 1: Programming Model 1

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

2) We have to agree with this legal disclaimer before using the software. This step is necessary to ensure that nothing unpleasant occurs.

Practical Malware Analysis

INSTRUCTION SET AND EXECUTION

SaM. 1. Introduction. 2. Stack Machine

That is, we branch to JUMP_HERE, do whatever we need to do, and then branch to JUMP_BACK, which is where we started.

Chapter 2A Instructions: Language of the Computer

Announcements HW1 is due on this Friday (Sept 12th) Appendix A is very helpful to HW1. Check out system calls

Lab Cover Page. Lab Date and Time: Teaching Assistant to whom you are submitting

Physics 116B Winter 2006: Problem Assignment 8

Microcontrollers. Microcontroller

Tutorial 1 Microcomputer Fundamentals

Getting Started with the HCS12 IDE

8051 Overview and Instruction Set

CDA 3103 Computer Organization Homework #7 Solution Set

Assembly Language Programming of 8085

Chapter. Computer Architecture

Its Assembly language programming

The MARIE Architecture

컴퓨터개념및실습. 기말고사 review

ME 4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 6

Chapter 4. MARIE: An Introduction to a Simple Computer

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

Subroutines. int main() { int i, j; i = 5; j = celtokel(i); i = j; return 0;}

SECTION 5 PROGRAM CONTROL UNIT

Accumulator and memory instructions 1. Loads, stores, and transfers 2. Arithmetic operations 3. Multiply and divide 4. Logical operations 5. Data test

ECE 331: PC Lab 3 Stack and Subroutines

MASSACHUSETTS. INSTITUTE OF TECHNOLOGY ARTIFICIAL INTELLIGENCE LABORATORY CONS

The terminal display function can be done using HexOut.

ORG ; TWO. Assembly Language Programming

Programming. A. Assembly Language Programming. A.1 Machine Code. Machine Code Example: Motorola ADD

C86 80C88 DS-186

Lab8: SAM Assembler and Simulator

Introduction to C. Why C? Difference between Python and C C compiler stages Basic syntax in C

8086 INTERNAL ARCHITECTURE

ET2640 Microprocessors

2.2 THE MARIE Instruction Set Architecture

CS356: Discussion #5 Debugging with GDB. Marco Paolieri

Assembly Language Programming

Libraries Guide. Arithmetic Libraries User Guide. Document #: Rev. *A

Lab 2 Use Traps. Lab 2 Input and Output 2 nd Semester. Lab 2 English. Lab 2 Pseudocode

E3940 Microprocessor Systems Laboratory. Introduction to the Z80

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

CSE351 Spring 2018, Midterm Exam April 27, 2018

Chapter 2 Data Manipulation

Assembly Language. Operand Size. The internal registers. Computers operate on chunks of data composed of a particular number of bits.

The Itanium Bit Microprocessor Report

Chapter 7 Central Processor Unit (S08CPUV2)

Before next weeks lab:

ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design

Program Development. Chapter 5

Introduction to Computer Science. Homework 1

Subroutines & Traps. Announcements. New due date for assignment 2 5pm Wednesday, 5May

We will begin our study of computer architecture From this perspective. Machine Language Control Unit

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

COMP4690 Assignment 1 Due: November 4, 2008

Project 3: RPN Calculator

Lab Reports. Program Description (separate page - ONLY IF REQUIRED)

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

TYPES OF INTERRUPTS: -

Module 8: Atmega32 Stack & Subroutine. Stack Pointer Subroutine Call function

S.R.M. INSTITUTE OF SCIENCE & TECHNOLOGY SCHOOL OF ELECTRONICS & COMMUNICATION ENGINEERING

PHYS 319. Things to do before next week's lab Whirlwind tour of the MSP430 CPU and its assembly language Activity 1.

A look at interrupts Dispatch_Tasks ( )

1. Internal Architecture of 8085 Microprocessor

Freescale Semiconductor, I SECTION 6 PROGRAM CONTROL UNIT

UNIT 2 PROCESSORS ORGANIZATION CONT.

Chapter 3 : Control Unit

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation


OSIAC Read OSIAC 5362 posted on the course website

CS401 Assembly Language Solved Subjective MAY 03,2012 From Midterm Papers. MC

Process Context & Interrupts. New process can mess up information in old process. (i.e. what if they both use the same register?)

Review Questions. 1 The DRAM problem [5 points] Suggest a solution. 2 Big versus Little Endian Addressing [5 points]

Transcription:

UNIMPLEMENTED INSTRUCTIONS OVERVIEW: This Programming Assignment will take the sine computation program you wrote for Programming Assignment #4 and implement it as a 68000 assembly language instruction. Reference: Leo J. Scanlon, The 68000: Principles and Programming The design specifications for the MC68000 included several instructions that were not implemented in the final commercial microprocessor. These instructions included string manipulation, floating-point arithmetic and others. Motorola reserved approximately 20% of the total microcode memory (the memory INSIDE the 68000 which contains the 68000's internal programs for instruction decoding and execution) for custom or special purpose versions of the 68000. If you carefully study your Programmer's Reference Card you will see that NO instructions begin with %1010 or %1111. These are known as the "unimplemented" op codes and would have belonged to the instructions (such as string manipulation and floating point arithmetic) which were not put into the 68000's final microcode. Rather than just ignore any instruction beginning with %1010 or %1111, the Motorola designers were clever and provided a mechanism for the programmer to use these codes as his/her own instructions in the 68000 instruction set. Specifically, Motorola provided a unique vector number in the exception map (the vector table) for each of these unimplemented op codes. To use either of these op codes, simple insert a word value in your program that has a most significant hex digit of $A (%1010) or $F (%1111). You can do this very easily by using the define constant directive, such as DC $Axxx or DC $Fxxx, where x can be any hex digit. When the 68000 fetches this constant and attempts to decode it, the 68000 will recognize this constant as an unimplemented instruction (since it begins with $A or $F) and will trap to the unimplemented instruction routine via address $28 (for %1010) or $2C (for %1111). This means that the address of your unimplemented instruction routine must be placed in address $28 or $2C by YOU - the programmer - not Motorola. Example: Emulate a set of floating point instructions using the op code 10102. Four such routines will be implemented: FPADD - floating point add FPSUB - floating point subtract FPMUL - floating point multiply FPDIV - floating point divide which are defined by appropriate labels to each routine. These instructions are data register to data register only with the following machine code format.

Note that the instruction is only a single word long since only data registers are allowed as source or destination registers. Example program: * This exception routine is executed if the 68000 encounters a "1010" instruction. It decodes the operation field of the instruction (bits 3 and 4) and, using this number as an index, jumps to a floating point add, subtract, multiply or divide routine elsewhere in memory. Registers A1 and D1 are affected. * Initialize the 1010 vector. ORG $28 DC.L FLTP ;1010 vector now points to FLTP ORG $1000 FLTP MOVEA.L 2(SP),A1 ;get PC address of NEXT instruction MOVE -2(A1),D1 ;fetch 1010 instruction and put into D1 MOVE D1,-(SP) ;save instruction in stack ANDI #$0018 ;mask out all BUT operation field LSR #1,D1 ;calculate index (op field 4) LEA OPADDR, A1 ;put jump table addresses into A1 MOVEA.L 0(A1,D1.W),A1 ;change to jump table address JMP (A1) ;jump to appropriate routine * The floating point routines can be put anywhere in memory. OPADDR DC.L FPADD, FPSUB, FPMUL, FPDIV ORG $ address of floating point add routine FPADD... ORG $ address of floating point subtract routine FPSUB... ORG $ address of floating point multiply routine FPMUL... ORG $ address of floating point divide routine FPDIV... Your programming assignment: Your program should decode the following instruction word format %1010xxxADDDDSSSS where %1010 is the op code, xxx are don't cares (i.e. we don't use them),%a identifies the operation to be performed, %DDDD designates the source, and %DDDD designates the destination. All of these are specified in binary. A=0 indicates that a sine operation should be performed, A=1 indicates that a cosine operation is to be performed. The destination can be either a memory location or a data register. A Data register destination would be specified in the form %x000 indicates destination to be put in D0, %x001

indicates destination to be put in D1, etc. up to %x111 indicating destination to be put in D7. A memory location destination is specified by %1xxx. The address of the memory location will then follow in an extension word. The source can only be a data register and is indicated in a manner similar to a data register destination, i.e., %x000 indicates source in D0, %x001 indicates source in D1, etc. up to %x111 indicating source in D7. This instruction will compute the sine or cosine of a binary angle given in the format of Programming Assignment #4 and #5. The source effective address must be a data register and the destination effective address must be a data register or a memory location. General comments: Your program must pass parameters to the subroutine through the stack, values returned must be passed on the stack, i.e. push arguements jsr subroutine pop results Also, include an instruction after your last subroutine call to show that your program properly returns to the main program. The way that the program can be internally organized is up to you but you might want to examine the use of jump tables, see Section 10.1 of your textbook. IMPORTANT NOTE: You have to set an option in the debugger. At the command line type: Debugger Options General Exceptions Normal or Debugger Options General Exceptions Report The default is Debugger Options General Exceptions Stop This command deals with what the debugger does on an exception. As one would guess it defaults to Stop which will simply display a message in the journal window and NOT process your exception. I would recommend the Report option, it flashes a message in the journal window and processes the exception just as you would expect. The Normal option processes the exception the same way the Report option does without the message to the journal window. This info is in the debugger manual on page 4-2. A problem with working with exceptions and interrups is that the TRAP #0 which you were using to stop your programs no longer works. This is because you now have the exceptions properly activated and the debugger will no longer halt when an exception occurs. You can single step the program but cannot stop the program when running it using a Program Run. The best solution is to use the debugger to set a breakpoint. This can be done by Breakpoint Instruction <address> where address is the address of the instruction at which to wish to stop. HINT: Remember about User and System Stack Pointer

This lab must be checked out and will receive a grade of 0 or 1 which will be assigned at the time of the checkout. The formal lab writeup will consist of the following: 1. title page in the normal format 2. detailed listing of the capabilities of your code, i.e. can you do both source and destination for any data register, can you decode a destination memory location, etc. 3. a detailed picture of the stack after it has been called. This should be AFTER any movem's or other instructions which put stuff on the stack have occurred. 4. a commented program listing and will be turned in at the time of the checkout. Formal checkout times will be announced later.