SEMJUL08 - LECT09 - ARITHMETIC INSTRUCTIONS COMPLETED

SEMJUL08 - LECT09 - ARITHMETIC INSTRUCTIONS COMPLETED -...

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

View Full Document Right Arrow Icon
M68k Arithmetic Instructions ECE 511: Digital System & Microprocessor
Background image of page 1

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

View Full DocumentRight Arrow Icon
What we are going to learn in this session: M68k arithmetic instructions: Plus Minus Multiply Divide Compare Test Negate
Background image of page 2
Introduction
Background image of page 3

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

View Full DocumentRight Arrow Icon
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.
Background image of page 4
Some Basics
Background image of page 5

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

View Full DocumentRight Arrow Icon
Addressing Modes
Background image of page 6
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>
Background image of page 7

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

View Full DocumentRight Arrow Icon
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.
Background image of page 8
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: ‘ ‘.
Background image of page 9

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

View Full DocumentRight Arrow Icon
Addressing Modes Example D1, D2, D3, D4, … $123456 24(A0,D0.W) $123(PC) (A4) A1, A2, A3, A4, … #1000 #$1F34 #@4567 #$00011011 #’ABCD’
Background image of page 10
2’s Complement
Background image of page 11

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

View Full DocumentRight Arrow Icon
2’s Complement Used by M68k to represent negative numbers . MSB as sign bit . If 0, positive number. If 1, negative number.
Background image of page 12
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)
Background image of page 13

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

View Full DocumentRight Arrow Icon
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)
Background image of page 14
Condition Code Register
Background image of page 15

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

View Full DocumentRight Arrow Icon
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.
Background image of page 16
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
Background image of page 17

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

View Full DocumentRight Arrow Icon
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
Background image of page 18
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
Background image of page 19

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

View Full DocumentRight Arrow Icon
V- Overflow Bit Set during arithmetic/divide overflow.
Background image of page 20
Image of page 21
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 153

SEMJUL08 - LECT09 - ARITHMETIC INSTRUCTIONS COMPLETED -...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online