Addressing Modes & Instruction Set By: Prof. Mahendra B. Salunke Asst. Prof., Department of Computer Engg., SITS, Pune-41 URL:

Slides:



Advertisements
Similar presentations
H. Huang Transparency No.1-1 The HCS12/MC9S12 Microcontroller Copyright © 2010 Delmar Cengage Learning HCS12 Instruction Examples The LOAD and STORE Instructions.
Advertisements

Microprocessors.
EECC250 - Shaaban #1 Lec # 2 Winter Addressing Modes  Addressing modes are concerned with the way data is accessed  Addressing can be.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 2: Data types and addressing modes dr.ir. A.C. Verschueren.
9/20/6Lecture 3 - Instruction Set - Al Instruction Set.
Processor Function Topic 3.
EET 2261 Unit 5 Tables; Decision Trees & Logic Instructions
Revised: Aug 1, EE4390 Microprocessors Lesson 6,7 Instruction Set, Branch Instructions, Assembler Directives.
H. Huang Transparency No.1-1 The 68HC11 Microcontroller Chapter 1: Introduction to 68HC11 The 68HC11 Microcontroller.
TK 2633 Microprocessor & Interfacing
Execution of an instruction
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Chapter 1 Introduction to HCS12/MC9S12. Computer Hardware Organization What is a Computer? Software Hardware.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Programming the HC12 in C. Some Key Differences – Note that in C, the starting location of the program is defined when you compile the program, not in.
EET 2261 Unit 2 HCS12 Architecture
Unit-1 PREPARED BY: PROF. HARISH I RATHOD COMPUTER ENGINEERING DEPARTMENT GUJARAT POWER ENGINEERING & RESEARCH INSTITUTE Advance Processor.
Architecture of the MSP430 Processor. Central Processing Unit Program Counter (PC) - Contains the address of the next instruction to be executed. The.
Microcontroller Fundamentals & Programming
Rabel Talpur:12BME#025.  40-pin chip  Developed by Motorola in 1975  16 address lines and 8 data lines  Used only +5V.
© 2010 Kettering University, All rights reserved..
Lecture 18 Last Lecture Today’s Topic Instruction formats
The M68HC11 Basic Instruction Set Basic Arithmetic Instructions
Module 10 Adapted By and Prepared James Tan © 2001.
Machine Instruction Characteristics
ME4447/6405 The George W. Woodruff School of Mechanical Engineering ME4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics.
EECC250 - Shaaban #1 Lec # 20 Winter Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:
9/20/6Lecture 3 - Instruction Set - Al Instruction Set (2)
ECE 265 – LECTURE 8 The M68HC11 Basic Instruction Set The remaining instructions 10/20/ ECE265.
Execution of an instruction
ECE 447: Lecture 12 Logic, Arithmetic, Data Test and Control Instructions of MC68HC11.
ME4447/6405 The George W. Woodruff School of Mechanical Engineering ME4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Z80 Overview internal architecture and major elements of the Z80 CPU.
ECE 265 – LECTURE 5 The M68HC11 Basic Instruction Set 12/8/ ECE265.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Addressing Modes MTT CPU08 Core Motorola CPU08 ADDRESSING MODES.
1 ECE 372 – Microcontroller Design Assembly Programming HCS12 Assembly Programming Addressing Modes Stack Operations Subroutines.
1 Microcontroller Fundamentals & Programming Addressing Modes.
Microcontroller Fundamentals & Programming Arithmetic Instructions.
Advanced Assembly Language Programming
What is a program? A sequence of steps
ECE 447 Fall 2009 Lecture 4: TI MSP430 Architecture and Instruction Set.
ECE 447: Lecture 11 Introduction to Programming in Assembly Language.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Instruction Sets. Instruction set It is a list of all instructions that a processor can execute. It is a list of all instructions that a processor can.
Embedded Systems Lecture 5 January 25 th, 2016.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This training course provides additional details about the.
“ INSTRUCTIONS SET OF AVR MICROCONTROLLER ” SIGMA INSTITUTE OF ENGINEERING Prepared By: SR.NO NAME OF STUDENT ENROLLMENT 1 Abhishek Lakhara
Chapter 12 Processor Structure and Function. Central Processing Unit CPU architecture, Register organization, Instruction formats and addressing modes(Intel.
Addressing Modes in Microprocessors
Part of the Assembler Language Programmers Toolbox
HC11 Programming.
Classification of Instruction Set of 8051
Assembly Language Programming of 8085
ECE 3430 – Intro to Microcomputer Systems
Lecture Set 5 The 8051 Instruction Set.
ECE 3430 – Intro to Microcomputer Systems
Introduction to 8085 Instructions
Microcomputer Programming
68000 Arithmetic Instructions
SCHOOL OF ELECTRONICS ENGINEERING Electronics and Communication
ME4447/6405 Microprocessor Control of Manufacturing Systems and
Chapter 8 Central Processing Unit
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
Chapter 5 Arithmetic and Logic Instructions
Presentation transcript:

Addressing Modes & Instruction Set By: Prof. Mahendra B. Salunke Asst. Prof., Department of Computer Engg., SITS, Pune-41 URL: microsig.webs.com

Contents Addressing Modes Instruction Set

Introduction Addressing modes determine how the central processor unit (CPU) accesses memory locations to be operated upon.

Addressing Modes Summary Inherent Immediate Direct Extended Relative Indexed (5-bit offset) Indexed (pre-decrement) Indexed (pre-increment) Indexed (post-decrement) Indexed (post-increment) Indexed (accumulator offset) Indexed (9-bit offset) Indexed (16-bit offset) Indexed-Indirect (16-bit offset) Indexed-Indirect (D accumulator offset)

Effective Address Each addressing mode except inherent mode generates a 16-bit effective address which is used during the memory reference portion of the instruction. Effective address computations do not require extra execution cycles.

Inherent Addressing Mode Instructions that use this addressing mode either have no operands or all operands are in internal CPU registers. CPU does not need to access any memory locations –NOP ;this instruction has no operands –INX ;operand is a CPU register

Immediate Addressing Mode Operands for immediate mode instructions are included in the instruction stream The pound symbol (#) is used to indicate an immediate addressing mode operand. –LDAA #$55 –LDX #$1234 –LDY #$67

Direct Addressing Mode This addressing mode is sometimes called zero- page addressing because it is used to access operands in the address range $0000 through $00FF. Since these addresses always begin with $00, only the eight low-order bits of the address need to be included in the instruction, which saves program space and execution time. –LDAA $55 –LDX $20

Extended Addressing Mode In this addressing mode, the full 16-bit address of the memory location to be operated on is provided in the instruction. –LDAA $F03B

Relative Addressing Mode The relative addressing mode is used only by branch instructions. Short and long conditional branch instructions use relative addressing mode exclusively, but branching versions of bit manipulation instructions (branch if bits set (BRSET) and branch if bits cleared (BRCLR)) use multiple addressing modes, including relative mode

Indexed Addressing Modes The indexed addressing scheme uses a postbyte plus zero, one, or two extension bytes after the nstruction opcode. The postbyte and extensions do the following tasks: –Specify which index register is used –Determine whether a value in an accumulator is used as an offset –Enable automatic pre- or post-increment or pre- or post- decrement –Specify size of increment or decrement –Specify use of 5-, 9-, or 16-bit signed offsets

Advantages of indexed addressing The stack pointer can be used as an index register in all indexed operations. The program counter can be used as an index register in all but autoincrement and autodecrement modes. A, B, or D accumulators can be used for accumulator offsets. Automatic pre- or post-increment or pre- or post- decrement by –8 to +8 A choice of 5-, 9-, or 16-bit signed constant offsets Use of two new indexed-indirect modes: –Indexed-indirect mode with 16-bit offset –Indexed-indirect mode with accumulator D offset

5-Bit Constant Offset Indexed Addressing This indexed addressing mode uses a 5-bit signed offset which is included in the instruction postbyte. This short offset is added to the base index register (X, Y, SP, or PC) to form the effective address of the memory location that will be affected by the instruction. Range of –16 through +15 Examples: –LDAA 0,X –STAB –8,Y

9-Bit Constant Offset Indexed Addressing This indexed addressing mode uses a 9-bit signed offset which is added to the base index register (X, Y, SP, or PC) to form the effective address of the memory location affected by the instruction. This gives a range of –256 through +255 Examples: –LDAA $FF,X –LDAB –20,Y

16-Bit Constant Offset Indexed Addressing This indexed addressing mode uses a 16- bit offset which is added to the base index register (X, Y, SP, or PC) to form the effective address of the memory location affected by the instruction. This allows access to any address in the 64-Kbyte address space.

16-Bit Constant Indirect Indexed Addressing This indexed addressing mode adds a 16- bit instruction-supplied offset to the base index register to form the address of a memory location that contains a pointer to the memory location affected by the instruction. Example: –LDAA [10,X]

Auto Pre/Post Decrement/ Increment Indexed Addressing This indexed addressing mode provides four ways to automatically change the value in a base index register as a part of instruction execution. The index register can be incremented or decremented by an integer value either before or after indexing takes place. The base index register may be X, Y, or SP.

Continued… CPU12 allows the index register to be incremented or decremented by any integer value in the ranges –8 through –1 or 1 through 8. Examples: –STAA 1,–SP; Pre-decremented by 1 –STX 2,–SP; Pre-decremented by 2 –LDX 2,SP+; Post-incremented by 1 –LDAA 1,SP+; Post-incremented by 2 –MOVW 2,X+,4,+Y ;

Accumulator Offset Indexed Addressing The effective address is the sum of the values in the base index register and an unsigned offset in one of the accumulators. The index register can be X, Y, SP, or PC and the accumulator can be either of the 8-bit accumulators (A or B) or the 16-bit D accumulator. Example: –LDAA B,X

Accumulator D Indirect Indexed Addressing This indexed addressing mode adds the value in the D accumulator to the value in the base index register to form the address of a memory location that contains a pointer to the memory location affected by the instruction. Examples: –JMP [D,PC] –GO1 DC.W PLACE1 –GO2 DC.W PLACE2 –GO3 DC.W PLACE3

Instruction Set CPU12 instructions are a superset of the M68HC11 instruction set. All memory and input/output (I/O) are mapped in a common 64-Kbyte address space (memory-mapped I/O). This allows the same set of instructions to be used to access memory, I/O, and control registers. The CPU12 has a full set of 8-bit and 16-bit mathematical instructions. There are instructions for signed and unsigned arithmetic, division, and multiplication with 8-bit, 16-bit, and some larger operands.

Continued… Special arithmetic and logic instructions aid stacking operations, indexing, binary-coded decimal (BCD) calculation, and condition code register manipulation. There are also dedicated instructions for multiply and accumulate operations, table interpolation, and specialized fuzzy logic operations that involve mathematical calculations.

Load and Store Instructions Load instructions copy memory content into an accumulator or register. Memory content is not changed by the operation. Load instructions (but not LEA instructions) affect condition code bits so no separate test instructions are needed to check the loaded values for negative or 0 conditions. e.g. LDAA, STAA, LDS, STS etc.

Transfer and Exchange Instructions Transfer instructions copy the content of a register or accumulator into another register or accumulator. Source content is not changed by the operation. Sign extend 8-bit operand (SEX) instruction is used to sign extend 8-bit two’s complement numbers Exchange instructions exchange the contents of pairs of registers or accumulators. e.g. TAB, TAP, TSX, EXG, XGDX, XGDY, SEX

Move Instructions Move instructions move (copy) data bytes or words from a source (M 1 or M : M +1 1 ) to a destination(M 2 or M : M +1 2 ) in memory. Six combinations of immediate, extended, and indexed addressing are allowed to specify source and destination addresses (IMM → EXT, IMM→ IDX, EXT → EXT, EXT → IDX, IDX → EXT, IDX → IDX). e.g. MOVB, MOVW

Addition and Subtraction Instructions Signed and unsigned 8- and 16-bit addition/subtraction can be performed between registers or between registers and memory. Special instructions support index calculation. e.g. ABA, ABY, ADCB, SBA, SUBB etc.

Binary-Coded Decimal Instructions To add binary-coded decimal (BCD) operands, use addition instructions that set the half-carry bit in the CCR, then adjust the result with the decimal adjust A (DAA) instruction. e.g. ABA, ADCA, ADDB, DAA

Decrement and Increment Instructions The decrement and increment instructions are optimized 8- and 16-bit addition and subtraction operations. They are generally used to implement counters. Because they do not affect the carry bit in the CCR, they are particularly well suited for loop counters in multiple-precision computation routines. e.g. DEC, DECA, DES, INC, INX, INY etc.

Compare and Test Instructions Compare and test instructions perform subtraction between a pair of registers or between a register and memory. The result is not stored, but condition codes are set by the operation. e.g. CBA, CMPA, CPY, TST, TSTB etc.

Boolean Logic Instructions The Boolean logic instructions perform a logic operation between an 8-bit accumulator or the CCR and a memory value. AND, OR, and exclusive OR functions are supported. e.g. ANDA, ANDCC, EORB, ORAA etc.

Clear, Complement, and Negate Instructions Performs a specific binary operation on a value in an accumulator or in memory Clear operations clear the value to 0, complement operations replace the value with its one’s complement, and negate operations replace the value with its two’s complement. e.g. CLC, CLR, COMA, NEG etc.

Multiplication and Division Instructions There are instructions for signed and unsigned 8- and 16-bit multiplication. Eight-bit multiplication operations have a 16-bit product. Sixteen-bit multiplication operations have 32-bit products. Integer and fractional division instructions have 16-bit dividend, divisor, quotient, and remainder. Extended division instructions use a 32-bit dividend and a 16-bit divisor to produce a 16-bit quotient and a 16-bit remainder. e.g EMUL, EMULS, EDIV, EDIVS, FDIV etc.

Bit Test and Manipulation Instructions The bit test and manipulation operations use a mask value to test or change the value of individual bits in an accumulator or in memory. e.g. BCLR, BITA, BITB, BSET.

Shift and Rotate Instructions There are shifts and rotates for all accumulators and for memory bytes. All pass the shifted-out bit through the C status bit to facilitate multiple-byte operations. e.g. LSL, LSLD, LSRB, ASL, ASLB, ROLA, RORB etc.

Maximum and Minimum Instructions The maximum (MAX) and minimum (MIN) instructions are used to make comparisons between an accumulator and a memory location. These instructions can be used for linear programming operations, such as simplex- method optimization, or for fuzzification. e.g. EMIND, MINA, MINM, EMAXM etc.

Multiply and Accumulate Instruction The multiply and accumulate (EMACS) instruction multiplies two 16-bit operands stored in memory and accumulates the 32- bit result in a third memory location.

Branch Instructions Branch instructions cause a sequence to change when specific conditions exist CPU12 uses three kinds of branch instructions: –Short branches: BRA, BCS, BHI, BGE etc. –Long branches: LBRN, LBEQ, LBHS etc. –Bit condition branches: BRCLR, BRSET

Loop Primitive Instructions The loop primitives can also be thought of as counter branches. The instructions test a counter value in a register or accumulator (A, B, D, X, Y, or SP) for zero or non-zero value as a branch condition. There are predecrement, preincrement, and test- only versions of these instructions. e.g. DBEQ, IBNE, TBEQ

Jump and Subroutine Instructions Jump (JMP) instructions cause immediate changes in sequence. A short branch (BSR), a jump to subroutine (JSR), or an expanded-memory call (CALL) can be used to initiate subroutines. A return address is stacked, then execution begins at the subroutine address. Subroutines in the normal 64-Kbyte address space are terminated with a return-from-subroutine (RTS) instruction. RTS unstacks the return address so that execution resumes with the instruction after BSR or JSR.

Contact Details: URL: microsig.webs.com