EECE.3170 Microprocessor Systems Design I

Slides:



Advertisements
Similar presentations
NEG Instruction Change operand content into two’s complement (negative value) and stored back into its operand mov bl, b neg bl; bl = mov.
Advertisements

1 x86’s instruction sets. 2 Instruction Set Classification  Transfer Move  Arithmetic Add / Subtract Mul / Div, etc.  Control Jump Call / Return, etc.
Department of Computer Science and Software Engineering
ACOE2511 Assembly Language Arithmetic and Logic Instructions.
Assembly Language Lecture 9
1 Multiplication, Division, and Numerical Conversions Chapter 6.
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, MUL Instruction The MUL (unsigned multiply) instruction.
1 Lecture 7 Integer Arithmetic Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 5 Arithmetic and Logic Instructions.
9-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL x86 Instructions Part.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may.
Shift and Rotate Instructions
Chapter 4 Basic Instructions. 4.1 Copying Data mov Instructions mov (“move”) instructions are really copy instructions, like simple assignment statements.
Microprocessor Systems Design I
Assembly Language for Intel-Based Computers
MUL Instruction (Unsigned Multiply) Multiplies an 8-, 16-, or 32-bit operand by either AL, AX or EAX. MUL r/m8 MUL r/m16 MUL r/m32.
Assembly Language – Lab 5
Khaled A. Al-Utaibi  Introduction  Arithmetic Instructions  Basic Logical Instructions  Shift Instructions  Rotate Instructions.
Chapter four – The 80x86 Instruction Set Principles of Microcomputers 2015年10月19日 2015年10月19日 2015年10月19日 2015年10月19日 2015年10月19日 2015年10月19日 1 Chapter.
Copyright 2000ELEC 242 Arithmetic Instructions1 Arithmetic Instructions Arithmetic and logical instructions modify the contents of the Flag (Status) register.
Arithmetic Flags and Instructions
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 4 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
1 IKI10230 Pengantar Organisasi Komputer Kuliah no. 05.b: Arithmetic Operations Sumber: 1. Paul Carter, PC Assembly Language 2. Hamacher. Computer Organization,
Integer Arithmetic Computer Organization and Assembly Languages Yung-Yu Chuang 2007/12/24 with slides by Kip Irvine.
Assembly Language for x86 Processors 6th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may modify and copy.
Arithmetic and Logic Instructions
Chapter 7: Integer Arithmetic. 2 Chapter Overview Shift and Rotate Instructions Shift and Rotate Applications Multiplication and Division Instructions.
Irvine, Kip R. Assembly Language for Intel-Based Computers. Chapter 7: Integer Arithmetic Slides to Accompany Assembly Language for Intel-Based Computers,
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may.
Introduction Arithmetic instructions are used to perform arithmetic operation such as Addition Subtraction Multiplication Division These operations can.
Microprocessor & Assembly Language Arithmetic and logical Instructions.
K.K. Leung Fall 2008Introductory Pentium Programming1 Pentium Architecture: Introductory Programming Kin K. Leung
Multiplication and Division instructions Dr.Hadi AL Saadi.
Microprocessor Systems Design I
Microprocessor Systems Design I
16.317: Microprocessor System Design I
Assembly Language for Intel-Based Computers, 5th Edition
Microprocessor Systems Design I
Microprocessor Systems Design I
Microprocessor Systems Design I
Microprocessor Systems Design I
EE3541 Introduction to Microprocessors
Basic Assembly Language
Multiplication and Division Instructions
CS-401 Computer Architecture & Assembly Language Programming
4.2 Arithmetic Instructions
INSTRUCTION SET OF 8086 PAWAN KUMAR SINGH.
Arithmetic Instructions
CS 301 Fall 2002 Assembly Instructions
X86’s instruction sets.
Chapter 4: Instructions
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Microprocessor and Assembly Language
EECE.3170 Microprocessor Systems Design I
Multiplication and Division Instructions
ADDITION Register Addition. ADD AX,BX AX=AX+BX 2. Immediate Addition.
Assembly Language for Intel-Based Computers, 4th Edition
More IA32 (AKA Pentium) Instructions
Assembly Language for Intel-Based Computers, 4th Edition
Assembly Language for Intel-Based Computers, 5th Edition
EECE.3170 Microprocessor Systems Design I
Chapter 5 Arithmetic and Logic Instructions
EECE.3170 Microprocessor Systems Design I
Chapter 5: Arithmetic and Logic Instructions
Multiplication and Division Instructions
Multiplication and Division Instructions
Division instruction.
Computer Architecture and System Programming Laboratory
Presentation transcript:

EECE.3170 Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2016 Lecture 8: Multiplication and division instructions Logical instructions

Microprocessors I: Lecture 8 Lecture outline Announcements/reminders HW 2 due 2:00 PM today HW 3 to be posted; due 2:00 PM, Wednesday, 9/28 No late submissions—solution to be posted that day Exam 1: Friday, 9/30 Allowed calculator, one double-sided 8.5” x 11” note sheet Will be given list of instructions covered so far Review Arithmetic instructions Today’s lecture Multiplication and division 4/6/2019 Microprocessors I: Lecture 8

Review: Addition instructions ADD D, S Operation: (D) = (D) + (S) ADC D, S Operation: (D) = (D) + (S) + (CF) INC D Operation: (D) = (D) + 1 4/6/2019 Microprocessors I: Lecture 8

Review: Subtraction instructions SUB D, S Operation: (D) = (D) – (S) SBB D, S Operation: (D) = (D) – (S) – (CF) DEC D Operation: (D) = (D) – 1 NEG D Operation: (D) = -(D) Two’s complement negation 4/6/2019 Microprocessors I: Lecture 8

Multiplication/division Both signed and unsigned integer versions Register A is always one of the sources Destination always same; size-dependent Exception: signed multiplication does allow for slightly different operation Easiest way to evaluate instructions: figure out decimal values of operands, do operation in decimal, then figure out binary/hex values of results 4/6/2019 Microprocessors I: Lecture 8

Microprocessors I: Lecture 8 MUL/IMUL MUL S  unsigned multiplication IMUL S  signed multiplication Byte: (AX) = (AL) * (S) Word: (DX,AX) = (AX) * (S) Double-word: (EDX,EAX) = (EAX) * (S) Only CF, OF updated If upper half of result = 0, CF & OF = 0 Otherwise, CF & OF = 1 4/6/2019 Microprocessors I: Lecture 8

Microprocessors I: Lecture 8 DIV/IDIV DIV S  unsigned division IDIV S  signed division Result split into quotient, remainder Byte: (AL) = (AX) / (S) (AH) = (AX) % (S) Word: (AX) = (DX,AX) / (S) (DX) = (DX,AX) % (S) Dword: (EAX) = (EDX,EAX) / (S) (EDX) = (EDX,EAX) % (S) Special “convert” instructions used to sign-extend value in register A before division Flags undefined Overflow causes exception 4/6/2019 Microprocessors I: Lecture 8

Microprocessors I: Lecture 8 Example Given EAX = 0x00000005 EBX = 0x0000FF02 What are the results of the following instructions? (Assume all instructions start with same values in registers above) MUL BL MUL BH IMUL BH DIV BL DIV BH IDIV BH 4/6/2019 Microprocessors I: Lecture 8

Microprocessors I: Lecture 8 Solution Consider that BH = 0xFF = 1111 11112 As unsigned value, 0xFF = 25510 As signed value, 0xFF = -110 MUL BL AX = AL * BL = 0x05 * 0x02 = 5 * 2 = 1010 = 0x000A MUL BH Unsigned multiplication AX = AL * BH = 0x05 * 0xFF = 5 * 255 = 127510 = 0x04FB IMUL BH Signed multiplication AX = AL * BH = 0x05 * 0xFF = 5 * -1 = -510 = 0xFFFB 4/6/2019 Microprocessors I: Lecture 8

Microprocessors I: Lecture 8 Solution (continued) Consider that BH = 0xFF = 1111 11112 As unsigned value, 0xFF = 25510 As signed value, 0xFF = -110 DIV BL AL = AX / BL = 0x0005 / 0x02 = 5 / 2 = 0x02 AH = AX % BL = 0x0005 % 0x02 = 5 % 2 = 0x01 DIV BH Unsigned division AL = AX / BH = 0x0005 / 0xFF = 5 / 255 = 0x00 AH = AX % BH = 0x0005 / 0xFF = 5 % 255 = 0x05 IDIV BH Signed division AL = AX / BH = 0x0005 / 0xFF = 5 / -1 = -5 = 0xFB AH = AX % BH = 0x0005 % 0xFF = 5 % -1 = 0x00 4/6/2019 Microprocessors I: Lecture 8

Microprocessors I: Lecture 8 Final notes Next time: Logical and shift instructions Reminders: HW 2 due 2:00 PM today HW 3 to be posted; due 2:00 PM, Wednesday, 9/28 No late submissions—solution to be posted that day Exam 1: Friday, 9/30 Allowed calculator, one double-sided 8.5” x 11” note sheet Will be given list of instructions covered so far 4/6/2019 Microprocessors I: Lecture 8