Logical Operations In some applications it is necessary to manipulate other sizes of data, or perhaps only individual bits. There are instructions that.

Slides:



Advertisements
Similar presentations
Ch.3 Representation and Manipulation of Information From Introduction to Embedded Systems: Interfacing to the Freescale 9s12 by Valvano, published by CENGAGE.
Advertisements

EECC250 - Shaaban #1 Lec # 2 Winter Addressing Modes  Addressing modes are concerned with the way data is accessed  Addressing can be.
The family.
COMP3221 lec9-logical-I.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lecture 9: C/Assembler Logical and Shift - I
1 IKI10230 Pengantar Organisasi Komputer Kuliah no. 05.c: Logical Operations Sumber: 1. Paul Carter, PC Assembly Language 2. Hamacher. Computer Organization,
Datapath Functional Units. Outline  Comparators  Shifters  Multi-input Adders  Multipliers.
HCS12 Arithmetic Lecture HC12 Arithmetic Addition and Subtraction Shift and Rotate Instructions Multiplication Division.
1 Arithmetic and Logical Operations - Part I. Boolean Operations A boolean variable can only have one of the two values, i.e, can either be 1 or 0. Given.
80x86 Instruction Set Dr. Qiang Lin.
Logical, Shift, and Rotate Operations CS208. Logical, Shift and Rotate Operations  A particular bit, or set of bits, within the byte can be set to 1.
EECC250 - Shaaban #1 lec #16 Winter Estimation of Assembly Programs Execution Time For a CPU running at a constant clock rate: clock rate =
Logical and Shift operations A particular bit, or set of bits, within the byte is set to 1 or 0 depending on conditions encountered during the execution.
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell 68HC12 Arithmetic Chapter 3.
Binary Operations Math/Logical. Binary Math Decimal Addition Example ) Add = 15 Write down 5, carry ) Add 3 +
Datapath Functional Units Adapted from David Harris of Harvey Mudd College.
Introduction to Computer Engineering by Richard E. Haskell Shift and Rotate Instructions Module M16.2 Section 10.3.
Microcontroller Fundamentals & Programming
ECE 265 – LECTURE 7 The M68HC11 Basic Instruction Set Logical, Shift and Rotate, Data Testing 8/14/ ECE265.
Assembly Programming on the TI-89 Created By: Adrian Anderson Trevor Swanson.
Ch. 7 Logic, Shift and Rotate instr.
Khaled A. Al-Utaibi  Introduction  Arithmetic Instructions  Basic Logical Instructions  Shift Instructions  Rotate Instructions.
Microprocessors Monday, Apr. 13 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
BITWISE OPERATIONS – Microprocessor Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat.
REGISTER TRANSFER LANGUAGE MICROOPERATIONS. TODAY OUTLINES Logic Microoperations Shift Microoperations.
1 Logic, Shift, and Rotate Instructions Read Sections 6.2, 7.2 and 7.3 of textbook.
Arithmetic Operations
Logical and Bit Operations Chapter 9 S. Dandamudi.
Arithmetic and Logic Chapter 5
COMP3221: Microprocessors and Embedded Systems--Lecture 10 1 COMP3221: Microprocessors and Embedded Systems Lecture 10: Shift and Bit-set Instructions.
Chapter 7 Bit Manipulation. 7.1 Logical Operations.
1 Sec (2.4) Arithmetic / logic instruction:. 2 Logical operations: Ex: XOR OR AND
Microprocessor & Assembly Language
Computer and Information Sciences College / Computer Science Department CS 206 D Computer Organization and Assembly Language.
Chapter four – The 80x86 Instruction Set Principles of Microcomputers 2016年3月17日 2016年3月17日 2016年3月17日 2016年3月17日 2016年3月17日 2016年3月17日 1 Chapter Four.
Bitwise and Logical Manipulations Assembly Language Programming University of Akron Dr. Tim Margush.
ARM Shifts, Multiplies & Divide??. MVN Pseudo Instructions Pseudo Intruction: Supported by assembler, not be hardware.
Logical, Shift, Rotate & BCD. What we will learn in this session: Logical instructions. Shift & Rotate instructions. BCD operations. Bit operations.
Negative numbers: Week 10 Lesson 1
Status Register Status = system byte (supervisor only) + user byte = system status + condition code register usually, it is not important to know.
Programming in Machine Language
Chapter 3 Bit Operations
Register Transfer and Microoperations
More on logical instruction and
Arithmetic and Logic Chapter 5
UNIT: 2 INSTRUCTION SET OF 8086.
68000 Arithmetic Instructions
Control Unit.
ALU Design: Shifter Details
Chapter 14 Bitwise Operators Objectives
REGISTER TRANSFER LANGUAGE
Topic 6: Bitwise Instructions
CS-401 Computer Architecture & Assembly Language Programming
Shift & Rotate Instructions)
Logical Operations bitwise logical operations AND, OR, EOR, NOT
Shift & Rotate Instructions)
Arithmetic and Logic Chapter 5
The ARM Instruction Set
Comp Org & Assembly Lang
Branching instructions
Logical instructions And rd rs rt Nor rd rs rt Or rd rs rt
Microprocessor and Assembly Language
Computer Organization and Assembly Language
Logical Instructions And rd rs rt Nor rd rs rt Or rd rs rt
Instruction execution and ALU
Immediate data Immediate operands : ADD r3, r3, #1 valid ADD r3, #1,#2 invalid ADD #3, r1,r2 invalid ADD r3, r2, #&FF ( to represent hexadecimal immediate.
Shift and Rotate Instructions.
Bit Manipulations CS212.
CS-401 Computer Architecture & Assembly Language Programming
CS-401 Computer Architecture & Assembly Language Programming
Arithmetic and Logic Chapter 3
Presentation transcript:

Logical Operations In some applications it is necessary to manipulate other sizes of data, or perhaps only individual bits. There are instructions that perform logical AND, OR, XOR and NOT operations. The condition code register changes according to the result AND.w d1,d2 (logically ANDs individual bits of d1 and d2 regs) ANDi.w #$5FFF, sr (resets trace and supervisor bits) ANDi.w #$FFFC, d1 (resets two low order bits of d1) The operations can be extended to byte and longword in a similar way

Logical Operations cont. OR.w d1,d2 (logically ORs individual bits of d1 and d2 regs) ORi.l #$F000000F, d0 (sets first four and last four bits of d0) ORi.l #$80000001, d0 (sets bits 31 and 0 while retaining others) EORi.b #$35, d1 (selected bits are complemented) NOT.w d1 (each bit is complemented)

Shift and Rotate Operations Shift instructions – left or right shift (for bit lengths 8, 16, or 32) Arithmetic Shifts (asl, asr) If sign of data before shift and after shift are different, overflow bit is set otherwise reset. Logical Shifts (lsl, lsr) Overflow bit is always cleared Rotate instructions – left or right (bits not lost like in shift operations) Simple Rotation (rol, ror) Extended Rotation (roxl, roxr) Example: left logical shift by a count of 1 of the 64-bit string in d1 and d2 lsl.l #1, d2 roxl.l #1, d1