ECE 382 Lesson 4 Lesson Outline Readings

Slides:



Advertisements
Similar presentations
Instruction Clock Cycles Generally, 1 cycle per memory access: – 1 cycle to fetch instruction word – +1 cycle if or #Imm – +2 cycles.
Advertisements

CSULB -- CECS 440–Examples of Addressing Modes © R.W. Allison 1.
UBI >> Contents Chapter 15 Advanced Laboratories MSP430 assembly language tutorial: MSP430X CPU MSP430 Teaching Materials Texas Instruments Incorporated.
MSP430 Assembly Paul Roper
S04: MSP430 Microarchitecture
ECE 382 Lesson 6 Lesson Outline Example Assembly Code In class programming Debugging Assembly Code Lesson 6, 7, and 8 notes Admin CompEx1CompEx1  due.
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson slides3.ppt Modification date: March 16, Addressing Modes The methods used in machine instructions.
Microprocessor Fundamentals Week 5 Mount Druitt College of TAFE Dept. Electrical Engineering 2008.
Execution of an instruction
Pentium Addressing Modes
ECE 382 Lesson 2 Readings Lesson Outline Admin Assembler Linker
Chapter 11 Instruction Sets: Addressing Modes and Formats HW: 11.4, 5, 13, 16 (Due 11/15)
Chapter 6 – MSP430 Micro-Architecture
The MSP430xxxx Department of Electrical and Computer Engineering
Architecture of the MSP430 Processor. Central Processing Unit Program Counter (PC) - Contains the address of the next instruction to be executed. The.
Part II: Addressing Modes
Required:PM: Ch 8.1-3, pgs Recommended:Wiki: Microarchitecture Wiki: Addressing_mode Wiki: Three-state logicWiki: Microarchitecture Wiki: Addressing_mode.
MICROCONTROLLER INSTRUCTION SET
CEG 320/520: Computer Organization and Assembly Language ProgrammingIntel Assembly 1 Intel IA-32 vs Motorola
COMPUTER ARCHITECURE INSTRUCTION SET ARCHITECTURE.
The x86 Instruction Set Lecture 16 Mon, Mar 14, 2005.
ECE 447 Fall 2009 Lecture 4: TI MSP430 Architecture and Instruction Set.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Chapter 3 – Instruction Set Architecture. Instruction Length and Cycles.
Type of addressing mode
Instruction Set Architectures Continued. Expanding Opcodes & Instructions.
1 Contents: 3.1 Instruction format and Addressing Modes 3.2 Instruction Introduction Chapter 3 Instruction system.
Microprocessors I 8051 Addressing Modes CS Prof. Msc. Ivan A. Escobar
מבוסס על שקפים מאת יאן ציטרין
Programmable System on Chip
Displacement (Indexed) Stack
ECE 3430 – Intro to Microcomputer Systems
ECE 382 Lesson 8 Lesson Outline Miniquiz Assignment 3
Data Transfers, Addressing, and Arithmetic
Immediate Addressing Mode
ECE 382 Lesson 3 ECE 382Website:
ECE 382 Lesson 6 Lesson Outline Status Register Flow of Control
Assembly Language Programming of 8085
Chapter 11 Instruction Sets
S04: MSP430 Microarchitecture
ELE2MIC Friday Lecture Venue Change
Assembly Language Assembly Language
The Cortex-M3/m4 Embedded Systems: Cortex-M3/M4 Instruction Sets
COMP2121: Microprocessors and Interfacing
Quiz 4.1 Four LEDs are attached to Port 4, bits 0 thru 3. Indicate which LEDs are ON/OFF after each instruction is executed. P4.7 P4.6 P4.5 P4.4 P4.3.
16.317: Microprocessor System Design I
Microprocessor Systems Design I
Chapter 4 Addressing modes
8051 Addressing Modes The way, using which the data source or destination addresses are specified in the instruction mnemonic for moving the data, is.
Assembly Lang. – Intel 8086 Addressing modes – 1
Chapter 3 Addressing Modes
Morgan Kaufmann Publishers Computer Organization and Assembly Language
ECE 445 CS1251 Computer Organization Carl Hamacher
SCHOOL OF ELECTRONICS ENGINEERING Electronics and Communication
Introduction to Micro Controllers & Embedded System Design Addressing Mode Department of Electrical & Computer Engineering Missouri University of Science.
(Array and Addressing Modes)
ADDRESSING MODES AND INSTRUCTION SET
Stack Relative Deferred (sf) Indexed (x) Stack Indexed (sx)
Instruction Set Architectures Continued
Under Address Modes Source: under
68000 Architecture, Data Types and Addressing Modes
Introduction to Micro Controllers & Embedded System Design
(Array and Addressing Modes)
Stack Relative Deferred (sf) Indexed (x) Stack Indexed (sx)
CNET 315 Microprocessor & Assembly Language
Under Address Modes Source: under
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Instruction Set Summary
Addressing Modes in 8051 MC S. Lourduraj Asst. Prof. of Physics
(Array and Addressing Modes)
Presentation transcript:

ECE 382 Lesson 4 Lesson Outline Readings Barrett 2.8-2.11 (pp47-54) MSP430 Family Users Guide pp47-55 MSP430 Addressing Modes Lesson Outline Addressing Modes CompEx1  due lesson 6 Admin Assignment 1 due today uCorrupt1 due today Assignment 2 due next lesson

What does this program do? Where’s the BEEF? ; first thing's first - how do we create a comment? mov.w #0x0200, r5 mov.w #0xbeef, r6 fill mov.w r6, 0(r5) ; anyone know what this syntax means? incd r5 cmp.w #0x0400, r5 ; what does this instruction do? jne fill forever jmp forever

Relative Jump Instruction Doesn’t use addressing mode. forever JMP forever ; what does this do? All instructions are 16 bits long. Their binary format looks like this: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 Condition PC offset (10 bit) Figure 3-12 Family User Guide 3.4.5 pp62 Blue Book pp19 : : _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Family User Guide 3.4.5 pp59 Blue Book pp18

MSP430 addressing modes As/Ad Addressing Mode Description Example 00/0 Rn Register direct mov r8, r9 01/1 offset(Rn) Register Indexed mov 2(r8), r9 10/- @Rn Register indirect mov @r8, r9 11/- @Rn+ Register indirect with post-increment mov @r8+, r9 ADDR Symbolic (PC relative) mov LoopCtr, r6 &ADDR Absolute mov r5, &0x0200 #N Immediate mov #0x2006, r6

Basic addressing modes As/Ad Addressing Mode Description Example 00/0 Rn Register direct mov r8, r9 01/1 offset(Rn) Register Indexed mov 2(r8), r9 10/- @Rn Register indirect mov @r8, r9 11/- @Rn+ Register indirect with post-increment mov @r8+, r9 memory registers 203 56 202 78 201 12 200 34 r8 0200 r9 0000

Basic addressing modes As/Ad Addressing Mode Description Example 00/0 Rn Register direct mov r8, r9 01/1 offset(Rn) Register Indexed mov 2(r8), r9 10/- @Rn Register indirect mov @r8, r9 11/- @Rn+ Register indirect with post-increment mov @r8+, r9 memory registers 203 56 202 78 201 12 200 34 r8 0200 r9

Register Direct

Basic addressing modes As/Ad Addressing Mode Description Example 00/0 Rn Register direct mov r8, r9 01/1 offset(Rn) Register Indexed mov 2(r8), r9 10/- @Rn Register indirect mov @r8, r9 11/- @Rn+ Register indirect with post-increment mov @r8+, r9 memory registers 203 56 202 78 201 12 200 34 r8 0200 r9 0000

Basic addressing modes As/Ad Addressing Mode Description Example 00/0 Rn Register direct mov r8, r9 01/1 offset(Rn) Register Indexed mov 2(r8), r9 10/- @Rn Register indirect mov @r8, r9 11/- @Rn+ Register indirect with post-increment mov @r8+, r9 memory registers 0200 + 2 0202 203 56 202 78 201 12 200 34 r8 0200 r9 5678 How about: mov.w 2(r6), 6(r5) ???

What is the last instruction doing mov.w #0x200, r6 mov.w #0xbeef, 2(r6) ;places 0xbeef at address 0x0202 mov.w r6, r5 mov.w 2(r6), 6(r5) Disassembled: c01c: 36 40 00 02 mov #512, r6 ;#0x0200 c020: b6 40 ef be mov #-16657,2(r6) ;#0xbeef, 0x0002(r6) c024: 02 00 c026: 05 46 mov r6, r5 c028: 95 46 02 00 mov 2(r6), 6(r5) ;0x0002(r6), 0x0006(r5) c02c: 06 00

Source or Destination 15:0 Hand assembly no .b indexed register mode mov.w 2(r6), 6(r5) indexed register mode 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 Two Operand Opcode Source reg Ad W=0/B=1 As Dest reg Source or Destination 15:0 Destination 15:0 Figure 3-12 Family User Guide 3.4.5 pp62 Blue Book pp19 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Indexed

Basic addressing modes As/Ad Addressing Mode Description Example 00/0 Rn Register direct mov r8, r9 01/1 offset(Rn) Register indexed mov 2(r8), r9 10/- @Rn Register indirect mov @r8, r9 11/- @Rn+ Register indirect with post-increment mov @r8+, r9 memory registers 203 56 202 78 201 12 200 34 r8 0200 r9 0000

Basic addressing modes As/Ad Addressing Mode Description Example 00/0 Rn Register direct mov r8, r9 01/1 offset(Rn) Register Indexed mov 2(r8), r9 10/- @Rn Register indirect mov @r8, r9 11/- @Rn+ Register indirect with post-increment mov @r8+, r9 memory registers 203 56 202 78 201 12 200 34 r8 0200 r9 1234 Like a pointer Is this the same as: move 0(r8), r9 ???

Register Indirect

Hand assembly mov @r7, r8 no .b register mode indirect register mode 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 Two Operand Opcode Source reg Ad W=0/B=1 As Dest reg Figure 3-12 Family User Guide 3.4.5 pp62 Blue Book pp19 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Basic addressing modes As/Ad Addressing Mode Description Example 00/0 Rn Register direct mov r8, r9 01/1 offset(Rn) Register Indexed mov 2(r8), r9 10/- @Rn Register indirect mov @r8, r9 11/- @Rn+ Register indirect with post-increment mov @r8+, r9 memory registers 203 56 202 78 201 12 200 34 r8 0200 r9 0000

Basic addressing modes As/Ad Addressing Mode Description Example 00/0 Rn Register direct mov r8, r9 01/1 offset(Rn) Register Indexed mov 2(r8), r9 10/- @Rn Register indirect mov @r8, r9 11/- @Rn+ Register indirect with post-increment mov @r8+, r9 memory registers 203 56 202 78 201 12 200 34 r8 0202 r9 1234

Other Addressing Modes Immediate: mov.w #BEEF, r6 Symbolic/PC Relative: mov.w magic_number, r7 magic_number .word 0xafaf becomes mov.w xxxx(PC), r7 Absolute: mov.w &0200, r6 mov.w #0xff, &P1OUT mov.w #0xff, P1OUT ????

Immediate

Absolute

Values of Constant Generators CG1, CG2 Family User Guide 3.4.5 pp122

Hand assembly rrc r6 no .b register mode _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Figure 3-12 Family User Guide 3.4.5 pp62 Blue Book pp19

Example Program Where’s the BEEF? ; example program to fill memory with BEEF -- what are the addressing modes used? mov.w #0x200, r5 mov.w #0xBEEF,r6 fill: mov.w r6, 0(r5) incd r5 cmp.w #0x0400, r5 jne fill forever: jmp forever

In class programming exercise ; write an example program to add the numbers 0x06 through 0x15