ARM Bitwise Logic. Bitwise Logic Bitwise operations : Work on patterns of bits, not values represented by those bits.

Slides:



Advertisements
Similar presentations
1 ECE 5465 Advanced Microcomputers Group 11: Brian Knight Benjamin Moore Alex Williams.
Advertisements

7-5 Microoperation An elementary operations performed on data stored in registers or in memory. Transfer Arithmetic Logic: perform bit manipulation on.
COMP3221 lec9-logical-I.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lecture 9: C/Assembler Logical and Shift - I
Senem Kumova Metin CHAPTER 7 Bitwise Operators and Enumeration Types.
Binary Logic (review) Basic logical operators: (Chapter 7 expanded)
Thumb Data Processing Instructions and Breakpoint Instructions 02/18/2015 Mingliang Ge Yi (Leo) Wu Xinuo (Johnny) Zhao.
Number Systems Standard positional representation of numbers:
Review Two’s complement
Computer Architecture CPSC 321 E. J. Kim. Overview Logical Instructions Shifts.
Memory unit terminology memory contains series of bits, grouped into addressable units word - unit of memory access and/or size of data registers, 16/32/64.
ARM Instructions I Prof. Taeweon Suh Computer Science Education Korea University.
CS-280 Dr. Mark L. Hornick 1 ASCII table. 2 Displaying Numbers as Text Problem: display numerical values as text Consider the numerical value 0x5A held.
Bits and Bytes. BITWISE OPERATORS Recall boolean logical operators in Java… boolean logical operators: &, |, ^ not: ! Show truth tables.
ICS312 Set 9 Logic & Shift Instructions. Logic & Shift Instructions Logic and Shift Instructions can be used to change the bit values in an operand. The.
Bitwise operators. Representing integers We typically think in terms of decimal (base 10) numbers.  Why?  A decimal (or base 10) number consists of.
Bitwise operators. Representing integers We typically think in terms of decimal (base 10) numbers.  Why?  A decimal (or base 10) number consists of.
BITWISE OPERATIONS – Microprocessor Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat.
REGISTER TRANSFER LANGUAGE MICROOPERATIONS. TODAY OUTLINES Logic Microoperations Shift Microoperations.
Bitwise Operators in C. Bitwise operators are used to manipulate one or more bits from integral operands like char, int, short, long.
Bitwise Operators Fall 2008 Dr. David A. Gaitros
MIPS Logic & Shift. Bitwise Logic Bitwise operations : logical operations applied to each bit Bitwise OR:
Lecture 2: Advanced Instructions, Control, and Branching EEN 312: Processors: Hardware, Software, and Interfacing Department of Electrical and Computer.
20. LOW-LEVEL PROGRAMMING. Bitwise Shift Operators The bitwise shift operators are: > right shift The expression i
Assembly 05. Outline Bit mapping Boolean logic (review) Bitwise logic Bit masking Bit shifting Lookup table 1.
EET 4250 Instruction Representation & Formats Acknowledgements: Some slides and lecture notes for this course adapted from Prof. Mary Jane Penn.
CSE 351 Number Representation. Number Bases Any numerical value can be represented as a linear combination of powers of n, where n is an integer greater.
1 Sec (2.4) Arithmetic / logic instruction:. 2 Logical operations: Ex: XOR OR AND
Bit Manipulation in 'C' 'C' bit operators
©2000 Addison Wesley Little- and big-endian memory organizations.
Ch 5. ARM Instruction Set  Data Type: ARM processors supports six data types  8-bit signed and unsigned bytes  16-bit signed and unsigned half-words.
1 Manipulating Information (1). 2 Outline Bit-level operations Suggested reading –2.1.7~
Binary Logic (review) Basic logical operators:(Chapter 7 expanded) NOT AND – outputs 1 only if both inputs are 1 OR – outputs 1 if at lest one input is.
CompSci From bits to bytes to ints  At some level everything is stored as either a zero or a one  A bit is a binary digit a byte is a binary.
From bits to bytes to ints
COMPUTER ARCHITECTURE & OPERATIONS I
ARM Registers Register – internal CPU hardware device that stores binary data; can be accessed much more rapidly than a location in RAM ARM has.
Assembly Language Assembly Language
Bitfields and Logic Basics
Processor Instructions set. Learning Objectives
Bitwise Logic and Immediate Operands
How do you write 4.3 ÷ 104?.
ECE 3430 – Intro to Microcomputer Systems
March 2006 Saeid Nooshabadi
Arithmetic and Logic Chapter 5
بسم الله الرحمن الرحيم هل اختلف دور المعلم بعد تطبيق المنهج الحديث الذي ينادي بتوفير خبرات تعليمية مناسبة للطلبة ؟ هل اختلف دور المعلم ؟ ن.ن. ع.
Chapter 14 Bitwise Operators Objectives
REGISTER TRANSFER LANGUAGE
Computer Architecture & Operations I
Bitwise Operations and Bitfields
The University of Adelaide, School of Computer Science
Introduction to Programming
Bitwise Operations C includes operators that permit working with the bit-level representation of a value. You can: - shift the bits of a value to the left.
Bitwise Operators CS163 Fall 2018.
Topic 6: Bitwise Instructions
CS-401 Computer Architecture & Assembly Language Programming
Binary Lesson 3 Hexadecimal
How is 0.41  10 related to 0.41  100?.
The University of Adelaide, School of Computer Science
Homework Homework Continue Reading K&R Chapter 2 Questions?
CS 206D Computer Organization
Arithmetic and Logic Chapter 5
Branching instructions
ARM Bitwise Logic.
Bitwise Operators.
Logical instructions And rd rs rt Nor rd rs rt Or rd rs rt
Bitwise operators.
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.
Bit Manipulations CS212.
EECE.2160 ECE Application Programming
Arithmetic and Logic Chapter 3
Presentation transcript:

ARM Bitwise Logic

Bitwise Logic Bitwise operations : Work on patterns of bits, not values represented by those bits

Bitwise Logic Bitwise OR:

Binary Immediates #0b starts a binary immediate value – No spaces – Any 1’s must be in 8 consecutive bits 0b b b b

ORR ORR: Bitwise OR ORRrd, rs, #___ ORRrd, rs, rm

AND AND: Bitwise AND ANDrd, rs, #___ ANDrd, rs, rm

EOR EOR: Bitwise exclusive OR EORrd, rs, #___ EORrd, rs, rm

In Place Swap EOR can swap two values in place

NOT No NOT instruction – use MVN

Key Details A or 0 = A – Anything or'd with 0 is that thing A and 1 = A – Anything and'd with 1 is that thing A and 0 = 0 – Anything and'd with 0 is 0 A xor 1 = not(A) – Xoring with 1 flips bit A xor 0 = A – Xoring with 0 does nothing

High Level Code In C/C++

High Level Code

BIC BIC: Binary Clear BICrd, rs, #___ BICrd, rs, rm – Clear bits set in # or rm – AND with invers or bits in # or rm

Bit Isolation Getting particular bits out of pattern Strategy 1: – Shift to wipe out others Want to clear left 8 bits: Shift left 8 bits: Shift back right 8 bits:

Bit Isolation Getting particular bits out of pattern Strategy 1: – Shift to wipe out others Want to isolate green five bits Shift left 8 bits Shift right

Bit Isolation Getting particular bits out of pattern Strategy 2: – Mask : binary pattern showing bits to keep 0x00 : keep no bits 0x01 : keep bit 1 ( ) 0x04 : keep bit 3 ( ) 0x05 : keep bit 1 & 3 ( ) 0xF0 : keep bit 5-8 ( )

Using Masks AND with a mask 0's out unmasked portions: Mask Data AND result

Hex Mask F (1111) mask a whole hex digit 0x fMask0xfff x Data0x x AND result0x

Bit Isolation Getting particular bits out of pattern Strategy 2: – Masking : binary pattern showing bits to keep Want to keep just green bits Create mask… 0x01F AND

Mask Samples