Address Indirect Addressing with Index and Displacement – Mode 6 Opcode - 4dRn - 3dmd - 3sMS - 6 rt - 1xm - 3s -1und - 3 displacement - 8 rt – type of.

Slides:



Advertisements
Similar presentations
Machine Language and Assembly Language
Advertisements

Instruction Set Design
Branching Instruction OP (4-bit)Cond (4-bit)Displacement (8-bit or 16-bit) 0110CondDisplacement (8-bit) 0110Cond0000 Displacement (16-bit)
Assembly Language Programming
There are two types of addressing schemes:
Lect 3: Instruction Set and Addressing Modes. 386 Instruction Set (3.4) –Basic Instruction Set : 8086/8088 instruction set –Extended Instruction Set :
Addressing modes – 1 The way in which an operand is specified is called the Address Mode.
Machine-Dependent Assembler Features (SIC/XE Assembler) Instruction Formats, Addressing Modes, and Program Relocation.
Chapter 6: Machine dependent Assembler Features
S. Barua – CPSC 240 CHAPTER 5 THE LC-3 Topics Memory organization Registers Instruction set Opcodes.
Some thoughts: If it is too good to be true, it isn’t. Success is temporary. It is hard work to make it simple. Knowing you did it right is enough reward.
Chapter 5 The LC-3 LC-3 Computer Architecture Memory Map
Chap 4 & 5 LC-3 Computer LC-3 Instructions Chap 4 Homework – due Monday October 27 Chap 5 Homework – due Wednesday October 29 Project 2 Designs (Working.
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
Machine Dependent Assembler Features
Pentium Addressing Modes
Chapter 11 Instruction Sets: Addressing Modes and Formats HW: 11.4, 5, 13, 16 (Due 11/15)
Part II: Addressing Modes
Lecture 18 Last Lecture Today’s Topic Instruction formats
Module 10 Adapted By and Prepared James Tan © 2001.
Computer Architecture and the Fetch-Execute Cycle
Memory and Addressing How and Where Information is Stored.
COMPUTER ARCHITECURE INSTRUCTION SET ARCHITECTURE.
9/20/6Lecture 2 - Prog Model Architecture, Data Types and Addressing Modes.
Addressing Modes1 Addressing modes are concerned with how the CPU accesses the operands used by its instructions.
ECEG-3202 Computer Architecture and Organization Chapter 6 Instruction Sets: Addressing Modes and Formats.
In1210/01-PDS 1 TU-Delft Instructions and addressing.
INTRODUCTION Programming – process of composing several instructions to perform certain tasks. Program – product of programming which contains several.
Topics covered: Instruction Set Architecture CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
G.Umamaheswari Lect/IT R.M.D.EC system software
Addressing Modes. Register Addressing Immediate Addressing Base Addressing Indexed Addressing PC-Relative Addressing.
Indexed Addressing addition to implementing new instructions, the extended assembler implements a new addressing mode. This is indexed addressing, a mode.
Computer Organization Instructions Language of The Computer (MIPS) 2.
The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP
1 ADDRESSING MODES Addressing Modes: * Specifies a rule for interpreting or modifying the address field of the instruction (before the operand is actually.
ECE 511: Digital System & Microprocessor
Memory Access Instructions Load and Store Addressing Modes Memory Addressing. Base addressing mode. Load byte and store byte: lb, lbu, sb Address alignment.
M68k Addressing Modes ECE 511: Digital System & Microprocessor.
Instruction Set Architectures Continued. Expanding Opcodes & Instructions.
Machine dependent Assembler Features
Machine Code typically: word 1 words 2-3 words 4-5
Addressing Modes the addressing mode defines how data is accessed
Figure 8.1 of course package
Addressing Modes in Microprocessors
Chapter 11 Instruction Sets
ADDRESSING MODES.
A Closer Look at Instruction Set Architectures
8051 Addressing Modes The way, using which the data source or destination addresses are specified in the instruction mnemonic for moving the data, is.
ADDRESSING MODES.
Assembly Lang. – Intel 8086 Addressing modes – 1
EECE-276 Fall 2003 Microprocessors & Microcontrollers II
Lecture 3 - Instruction Set - Al
Single-Cycle CPU DataPath.
Topic 6 LC-3.
MIPS Instruction Encoding
MIPS Instruction Encoding
Computer Science 210 Computer Organization
Instruction Set Architectures Continued
Under Address Modes Source: under
68000 Architecture, Data Types and Addressing Modes
Fields in the FALCON-A Instruction
Figure 8.1 of course package
Introduction to Micro Controllers & Embedded System Design
Computer Science 210 Computer Organization
CNET 315 Microprocessor & Assembly Language
Under Address Modes Source: under
Assembly Language Programming
MIPS Coding Continued.
Instruction Set Summary
Presentation transcript:

Address Indirect Addressing with Index and Displacement – Mode 6 Opcode - 4dRn - 3dmd - 3sMS - 6 rt - 1xm - 3s -1und - 3 displacement - 8 rt – type of register used – address (1) or data (0) register xm – address of index register used (3-bits) s – index register defined as longword (1) or word (0) und – undefined Example: move $E(a5, a2.w), d1 Equivalent machine instruction: bits EA of source = a5 (32 bits) + a2 (16 low order bits – sign extended) + displacement (8 bits – sign extended )

Example of Mode 6 (with index and displacement Given an array of m x n 0123…..n 0(0,0)(0,1)(0,2)(0,3).. 1(1,0)(1,1)(1,2)..… …... m The elements are stored in the memory as follows X(0,0)x + a1 + a2 (0,1) (0,2) … (0,n) (1,0) (1,1) …. (1,n) (2,0) ….. a1 and a2 registers are initialized to a1 is used to point at rows a2 is used to point at columns X is just a reference point move X(a1, a2), d1 LOOP2 LOOP1Add #2, a2 … Do LOOP1 “n” times Add #2, a1 Do LOOP2 “m” times

Address Register Indirect Addressing with Post-increment – Mode 3 Example: move.w (a1)+, d2 This means – EA = [a1] a1  a1 + const; here const = 2 Increment (const) depends on the data size provided in opcode. It can take byte, word, or longword Suppose initially – a1 = d2 = 87C3 187A Mem. Loc = 320D = ???? ???? Then after move.w (a1)+, d2  a1 = d2 = 87C3 320D But after move.b (a1)+, d2  a1 = d2 = 87C And after move.l (a1)+, d2  a1 = d2 = 320D

Address Register Indirect Addressing with Pre-decrement – Mode 4 Example: move.w -(a1), d2 This means – a1  a1 - const; here const = 2 d0  M[a1] Increment (const) depends on the data size provided in opcode. It can take byte, word, or longword Suppose initially – a1 = d2 = 87C3 187A Mem. Loc C = ABCD = 320D 0005 Then after move.b -(a1), d2  a1 = F d2 = 87C But after move.w -(a1), d2  a1 = E d2 = 87C And after move.l -(a1), d2  a1 = C d2 = ABCD

Absolute Addressing (short or long) – Modes 70 and 71 Absolute Short – absolute address restricted to 16 bits, but is sign extended to 32 bits at run time Absolute Long – absolute address is 32 bits Example: move.b $14, d1  EA = const (sign-ext) move.b ($61234).w, d1  Absolute short – will consider $ as EA move.b ($61234).l, d1  Absolute long – will consider 24 bits $ as EA Displacement (16 bits) Displacement (16 bits)

PC Relative Addressing (with Displacement) – Mode 72 (with Index and Displacement) – Mode 73 Example:move.w $30(PC), d1 Displacement is a word EA = PC + displ + 2 Another Example: here we consider the case when a Relative Expression is used to specify the displacement move.w num(PC), d1 This means that the “word” at location “num” is moved to d1, where EA = “num”. However the calculation of Effective Address is made via PC-relative mode. Let, value of Symbol “num” is $ Suppose initially PC = $ where “move” instruction is. Then, EA = PC displ  = displ  displ = $FFFA This “relative expressions” is used to write Position-Independent code. numF ???? Move instr = PC displ = FFFA ….

Position-dependent vs Position-independent code Position-dependent code Location Object CodeSrcCode org$ C8suba0, a moveX(a0), d moveX+2, d CC5C1mulsd1,d E AmoveX+4, d E40trap# BXdc dc A0003dc Cend Position-independent code using PC-relative mode The program above will not execute as expected if it is loaded at any other location than $0000 Location Object CodeSrcCode org$ C8suba0, a B000EmoveX(pc,a0.l), d A000CmoveX+2(pc), d AC5C1mulsd1,d C303A0008moveX+4(pc), d E40trap# BXdc dc dc end The program above solves the problem. It can start from any location, and will execute as expected.

Immediate Addressing – Mode 74 Example: movei.w #1234,d1  d1 = ???? 04D2 When Immediate data is 8-bits When Immediate data is 16-bits When Immediate data is 32-bits IData (16 bits) Unused (8 bits)IData (8 bits) IData (16 bits)

Quick Data – no mode associated with this addressing By examining the 5-bit total opcode, it knows it is quick data. om (2-bits) specify if the data considered is to be extended to a byte (00), word (01) or longword (10). Example: addq #5, d1 moveq #$45, d1 If we need to move an 8-bit data to a data register, “moveq” instruction will occupy one word in memory, whereas “movei” instruction will occupy two words in memory. Opcode (4-bits)Qdata (3-bits)Opcode (1 bit)om (2-bits)dMS (6-bits) Data (3-bits)0Data (5-bits)Dn (3-bits)