DOC PREVIEW
RU CS 208 - Logic Gates

This preview shows page 1-2-3-4-5 out of 14 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Logical and Shift operationsLogical operationsSlide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Shift and Rotate operationsSlide 11Slide 12Slide 13Slide 14Logical and Shift operationsA particular bit, or set of bits, within the byte is set to 1 or 0 depending on conditions encountered during the execution of a program. When so used, these bits are often called "flags". Frequently, the programmer must manipulate these individual bits - an activity sometimes known as "bit twiddling". The logical and shift operations provide the means for manipulating the bits.Logical operationsOR OperationsOR Results in 1 if either or both of the operands are 1.  OR Table0 OR 0 = 00 OR 1 = 11 OR 0 = 11 OR 1 = 1Logical operationsTo perform the OR operation, take one column at a time and perform the OR operation using the OR table.Ex 1: 10010011OR 00001111 10011111Logical operationsEx 2: 11001001 OR 00001010 11001011Ex 3: 0111 OR 0010 0111Logical operationsXOR Operations The exclusive OR. Similar to OR except that it gives 0 when both its operands are 1. Rules.0 XOR 0 = 00 XOR 1 = 11 XOR 0 = 11 XOR 1 = 0Logical operationsEx 1: 10011001 XOR 00001111 10010110 Ex 2: 0111 XOR 0010 0101Logical operationsNOT OperationsNOT is a separate operator for flipping all bits. Rules.NOT 0 = 1NOT 1 = 0 Example. NOT 1010 0101Logical operationsAND OperationsAND yields 1 only if both its operands are 1.Rules.0 AND 0 = 00 AND 1 = 01 AND 0 = 01 AND 1 = 1Logical operations Ex 1: 11010011 AND 00001111 00000011 Ex 2: 0111 AND 1001 0001Shift and Rotate operations Where as logical operations allow the changing of bit values in place, shift and rotate operations allow bits to be moved left or right without changing their values.Shift and Rotate operations SHL SHL (shift left) shifts each bit one place to the left. The original leftmost bit is lost and a 0 is shifted into the rightmost position.Ex 1. SHL 1101 1 1010 Ex 2. SHL 11001000Shift and Rotate operationsSHRSHR (shift right) shifts each bit one place to the right. The original rightmost bit is lost and a 0 is shifted into the leftmost position.Ex 1. SHR 10110101 1Ex 2. SHR 00110001Shift and Rotate operations ROLROL (rotate left) shifts each bit one place to the left. The original leftmost bit is shifted into the rightmost position. No bits are lost. Ex 1. ROL 11011011ROL 11001001Shift and Rotate operations ROR ROR (rotate right) shifts each bit one place to the right. The original rightmost bit is shifted into the leftmost position. No bits are lost.Ex 1. ROR 10111101Ex 2. ROR


View Full Document

RU CS 208 - Logic Gates

Download Logic Gates
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Logic Gates and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Logic Gates 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?