SEMJUL08 - LECT09 - ARITHMETIC INSTRUCTIONS COMPLETED

# SEMJUL08 - LECT09 - ARITHMETIC INSTRUCTIONS COMPLETED -...

This preview shows pages 1–21. Sign up to view the full content.

M68k Arithmetic Instructions ECE 511: Digital System & Microprocessor

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
What we are going to learn in this session: M68k arithmetic instructions: Plus Minus Multiply Divide Compare Test Negate
Introduction

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Introduction M68k has instructions for simple arithmetic operations. Enhances ability to perform tasks: Perform calculations + control tasks. Can also do floating-point, but requires math co-processor: Not covered.
Some Basics

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
We have covered these addressing modes DRD D0 D7 ARD A0 A7 Dn and An ARI (An) ARI+PI (An)+ ARI+PD -(An) ARI+D D(An) ARI+I D(An,Dn/An.s) PC+D D(PC) PC+I D(PC,Dn/An.s) ALA \$001001 ASA \$FFAA IA CCR, SR, PC Effective Address: <ea> ID #(\$/%/@/’’) Immediate data: <id>

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Addressing Modes Dn : Data Register (D0 D7) 32-bit register (32-bit max). An : Address Register (A0 A7). 32-bit register (24-bit max). Don’t use A7.
Addressing Modes <ea> Effective address (24-bit value): \$000000 \$FFFFFF Also includes Address Register Indirect methods. Anything else: address error. <id> (Immediate Data): Preceded by #. Binary: %, Octal: @, Hex: \$, Decimal: no sign, Character: ‘ ‘.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Addressing Modes Example D1, D2, D3, D4, … \$123456 24(A0,D0.W) \$123(PC) (A4) A1, A2, A3, A4, … #1000 #\$1F34 [email protected] #\$00011011 #’ABCD’
2’s Complement

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2’s Complement Used by M68k to represent negative numbers . MSB as sign bit . If 0, positive number. If 1, negative number.
2’s Complement Example Converting 10 to -10: 10 (decimal) = 00001010 (binary) 1. Start with positive number 2. Invert all the bits 00001010 (invert) 11110101 3. Add 1 to inverted result 11110101 + 1 11110110 2’s Complement (-10)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2’s Complement Example Converting -5 to 5: -5 (decimal) = 11111011 (binary) 1. The 2’s complement representation: 2. Invert all the bits 11111011 (invert) 00000100 3. Add 1 to inverted result 00000100 + 1 00000101 Positive value (+5)
Condition Code Register

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Condition Code Register (CCR) Used to store status of evaluated conditions. Final 5-bits of SR. CCR = XNZVC X: rotate, multi-precision BCD operations. N: result is negative Z: result is zero V: overflow has occurred. C: carry/borrow has occurred.
X Example – Rotate 1 1 0 0 1 1 0 0 ROXL.B #1,D0 D0.B = 1 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 X X = 1 C = 1 *X keeps extra bit And moves it to the back… C set as well

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
N Example MOVE.B #0,D0 MOVE.B #100,D1 SUB.B D1,D0 D0 = \$00 (0) D1 = \$64 (100) D0 = 0 – 100 = \$9C (-100) \$9C = 1 1 0 0 1 1 0 0 MSB = 1, N = 1
Z Example MOVE.L #\$FFFFFFFF,D0 SUB .B #\$FF,D0 Z = 1 * Only B is tested, since .B was used Initial D0 = F F F F F F F F Final D0 = F F F F F F 0 0

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
V- Overflow Bit Set during arithmetic/divide overflow.
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/17/2011 for the course MCT 3235 taught by Professor Dr during the Spring '11 term at International Islamic University Malaysia.

### Page1 / 153

SEMJUL08 - LECT09 - ARITHMETIC INSTRUCTIONS COMPLETED -...

This preview shows document pages 1 - 21. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online