© 2010 Kettering University, All rights reserved..

Slides:



Advertisements
Similar presentations
© 2010 Kettering University, All rights reserved..
Advertisements

Floyd, Digital Fundamentals, 10 th ed EET 2261 Unit 7 Indexed Addressing Mode Read Mazidi, Chapter 6. Homework #7 and Lab #7 due next week. Quiz next week.
© 2010 Kettering University, All rights reserved..
CS/COE1541: Introduction to Computer Architecture Datapath and Control Review Sangyeun Cho Computer Science Department University of Pittsburgh.
H. Huang Transparency No.1-1 The HCS12/MC9S12 Microcontroller Copyright © 2010 Delmar Cengage Learning HCS12 Instruction Examples The LOAD and STORE Instructions.
EET 2261 Unit 3 Assembly Language; Load, Store, & Move Instructions  Read Almy, Chapters 5 and 6.  Homework #3 and Lab #3 due next week.  Quiz next.
Programming 68HC11.
2.3) Example of program execution 1. instruction  B25 8 Op-code B means to change the value of the program counter if the contents of the indicated register.
EE 362 Microprocessor Systems and Interfacing © 1-1 Lecture 1: Introduction to Microprocessor Based Systems Microprocessor Architecture Microprocessor.
© 2010 Kettering University, All rights reserved..
H. Huang Transparency No.1-1 The 68HC11 Microcontroller Chapter 1: Introduction to 68HC11 The 68HC11 Microcontroller.
© 2010 Kettering University, All rights reserved..
EET 2261 Unit 2 HCS12 Architecture
Part II: Addressing Modes
ECE 265 – LECTURE 4 The M68HC11 Address Modes 8/14/ ECE265.
© 2010 Kettering University, All rights reserved..
Lecture 18 Last Lecture Today’s Topic Instruction formats
© 2010 Kettering University, All rights reserved..
Physics 413 Chapter 1: Introduction to the HCS 12 Microcontroller.
© 2010 Kettering University, All rights reserved..
ME4447/6405 The George W. Woodruff School of Mechanical Engineering ME4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics.
BASIC COMPUTING CONCEPTS Part 3 Dr. Abdel-Rahman Al-Qawasmi INSIDE THE MACHINE by Jon Stokes.
Processor Design ELEC 418 Advanced Digital Systems Dr. Ron Hayne Images Courtesy of Thomson Engineering.
ECE 265 – LECTURE 8 The M68HC11 Basic Instruction Set The remaining instructions 10/20/ ECE265.
© 2010 Kettering University, All rights reserved..
ME4447/6405 The George W. Woodruff School of Mechanical Engineering ME4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics.
Parul Polytechnic Institute Subject Code : Name Of Subject : Microprocessor and assembly language programming Name of Unit : Instruction cycle.
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.
EE 345 Class Notes EE345 Midterm Review Dr. Jane Dong.
Topics covered: Instruction Set Architecture CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
1 Microcontroller Fundamentals & Programming Addressing Modes.
© 2010 Kettering University, All rights reserved..
HCS12 ARCHITECTURE Razvan Bogdan Embedded Systems.
ECE 447: Lecture 11 Introduction to Programming in Assembly Language.
MicroComputer Engineering BranchProcCall page Addiu$t1 $r0 3 Addiu$t1 $t1 5 Addiu$t1 $t1 7 Example.
Embedded Systems Lecture 5 January 25 th, 2016.
EE345 Chapter 2 Lecture 3 April 4. Quiz every Wednesday 1 quiz = 1% extra credit five quizzes before midterm  5% for midterm. five quizzes before final.
EE345 Chapter 2 Lecture 3 April Instruction and addressing modes 1.Extended Addressing 2.Direct Addressing 3.Inherent Addressing 4.Immediate Addressing.
EET 2261 Unit 3 Assembly Language; Load, Store, & Move Instructions
ELEC 418 Advanced Digital Systems Dr. Ron Hayne
ECE 3430 – Intro to Microcomputer Systems
Addressing Modes in Microprocessors
Example Addiu $t1 $r0 3 Addiu $t1 $t1 5 Addiu $t1 $t1 7.
ECE 3430 – Intro to Microcomputer Systems
ECE 3430 – Intro to Microcomputer Systems
ECE 3430 – Intro to Microcomputer Systems
ADDRESSING MODES.
ADDRESSING MODES.
Computer Science 210 Computer Organization
ME4447/6405 Microprocessor Control of Manufacturing Systems and
Computer Science 210 Computer Organization
CS149D Elements of Computer Science
Introduction to Micro Controllers & Embedded System Design Addressing Mode Department of Electrical & Computer Engineering Missouri University of Science.
MIPS Instruction Encoding
ECE 3430 – Intro to Microcomputer Systems
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
MIPS Instruction Encoding
Introduction to Micro Controllers & Embedded System Design
Classification of instructions
CNET 315 Microprocessor & Assembly Language
Physics 413 Chapter 2.
Under Address Modes Source: under
CPU has 6 special locations called registers
ECE 352 Digital System Fundamentals
The branch instruction
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
Instruction Set Summary
Presentation transcript:

© 2010 Kettering University, All rights reserved.

Microcomputers I – CE 320 Electrical and Computer Engineering Kettering University Jaerock Kwon, Ph.D.

Announcements No class on Monday. The first quiz on Wednesday! – Closed book and notes – No calculators are allowed – Topic: Number systems – Study Exercise 1!!

Lecture 4: Addressing Modes

Today’s Goals Understand addressing modes so figure out how to use them. – If you don’t get addressing modes, you will have a serious problem to complete this course. Learn how to use a program trace. Two major goals

Addressing Modes The operand of an instruction can use different methods for specifying data in the memory (=addressing modes). – If the data number is in registers (inside the microprocessor), a memory address is not needed. The HCS12 has six addressing modes Extended (EXT) Direct (DIR) Inherent (INH) Immediate (IMM) Index (IDX) Relative (REL) : Used only with branch instructions. Effective Address – The effective address is the location that holds the data to be used by the operation. – The operand is often used to construct the effective address. – An addressing mode tells the microprocessor the way of calculation to get the effective address. How to get effective addresses

Extended Addressing (EXT) Effective address: – No operation needed. – Extended addressing tells the full memory address. Format: – Two-byte hexadecimal number (4-digit) preceded with a $. Actually ‘$’ simply means that the number is a hexadecimal number. (A number could be followed by ‘h’ excluding ‘’. Example: – (Assuming the instruction is stored at $2000) – LDAA $3000 Load a byte value stored at address $3000 into the register A. LDAA opr16a (M)  A EXT B6 hh ll 98  A Also called Absolute Addressing B

Direct Addressing (DIR) Effective address: – This addressing mode only supplies the lower byte of the address. – Extend the one byte address to two-bytes by concatenating $00 to the beginning of the operand. Format: – One byte hexadecimal number (2-digit) preceded with a $. Example: – (Assuming the instruction is stored at $2000) – LDAA $80 00 Load a byte value stored at address $0080 into the register A. LDAA opr8a (M)  A DIR 96 dd 98  A Also called Zero-Paging Addressing B

Inherent Addressing (INH) Effective address: – No operation. Format: – No operand. Example: – (Assuming the instruction is stored at $2000) – INCA Increase register A by 1 INCA (A) + $01  A INH 42 Also called Implied Addressing

Immediate Addressing (IMM) Effective address: – No operation. The data itself is supplied as the operand. Format: – Number preceded with a #. ‘#’ is followed by a number that is a value instead of an address! Example: – (Assuming the instruction is stored at $2000) – LDAA #$80 Load a byte value(the operand itself) into the register A  A – LDD # is 03E8 16  D (meaning 03  A and E8  B) The size of an operand – Register A and B have one-byte immediate operands. – Register D, X, Y, SP, and PC have two-byte ones CC E8

Index Addressing (IDX, IDX1, IDX2) Effective Address – Add the operand as a signed number to the value in the X, Y, PC, or S registers. Format – Signed number, Register (X, Y, PC, or S) Example: – LDAA 0,X The effective address is the value(=address) in register X. (=X+0) – LDD -100,Y The effective address is 100 lower than the value in Y. (=Y-100) – LDX 1000, Y The effective address is 1000 higher than the value in Y. (=Y+1000) Notes: – The value in the specified register is not changed. – The smallest number of bits will be used to represent the address.

Index Addressing Postbytes An operand in the index addressing are called a postbyte. The postbyte tells the processor which two-byte register to be used as the base address, the size of the offset. Registerrr X00 Y01 SP10 PC11 Postbyte for 5-bit Offset: rr0nnnnn Postbytes for 9-bit Offset: 111rr00n nnnnnnnn Postbytes for 16-bit Offset: 111rr010 nnnnnnnn nnnnnnnn

Index Addressing Instruction Machine Code LDAA 4,YA LDD -100,XECE19C LDX -1000,YEEEAFC Examples Registerrr X00 Y01 SP10 PC11 Postbyte for 5-bit Offset: rr0nnnnn Postbytes for 9-bit Offset: 111rr00n nnnnnnnn Postbytes for 16-bit Offset: 111rr010 nnnnnnnn nnnnnnnn

Instruction Set Above is a portion of the entry for the LDAA instruction. Now, we can better understand information in the HCS12 instruction sets. Source FormOperation Addr. Mode Machine CodingAccess DetailS X H IN Z V C LDAA #opr8i LDAA opr8a LDAA opr16a LDAA oprx0_xysp LDAA oprx9,xysp LDAA oprx16,xysp (M)  A Load Acc. A IMM DIR EXT IDX IDX1 IDX2 86 ii 96 dd B6 hh ii A6 xb A6 xb ff A6 xb ee ff P rPf rPO rPf rPO frPP - -   1 0

Addressing Mode Summary How to Get an Effective Address INH Op Code IMM Op Code Data Op Code Data-high Data-low DIR Op Code Addr-low 00 Effective Address EXT Op Code Addr-high Addr-low Addr-high Effective Address Addr-low IDX Op Code Offset Effective Address Index Register REL Op Code Relative offset Effective Address Program Counter

Program Trace A diagram showing the contents of the HCS12 memory which contains a program. A program trace shows the contents of the processor’s registers as the program is executed. Very useful for debugging programs B C A LDAA 3000h LDAB #2 ABA STAA 3001h 3F 200A “Stop” FF 3001

Program Trace Trace Line AddressInstructionPCAB 12000LDAA 3000h LDAB # ABA20071B STAA 3001h200A1B A“stop”--- Example

Program Trace Trace Line AddressInstructionPCXAB 12000LDX #3001h LDD 1,X INCB A 42007STD -1,X A 52009“STOP”---- Another Example CE EC C 1F 3F LDX #3001H LDD 1,X STD -1,X “Stop” EC CLRA X requires a 2-byte operand with immediate addressing since it is a 2-byte register. Note that using indexed addressing to load/store register D does not change the value in register X. 45-9A What are the values in memory locations from 3000h to 3003h after the program is done executing? 45-9A-45-99

Questions?

Wrap-up Five addressing modes Program trace What we’ve learned

What to Come Unconditional branches Relative addressing mode