csci 3 chapter 1 data storage. bits today’s computer information is encoded as patterns of 0s and...
Post on 21-Dec-2015
219 views
TRANSCRIPT
CSCI 3CSCI 3
Chapter 1 Data StorageChapter 1 Data Storage
BitsBits
Today’s computer information is Today’s computer information is encoded as patterns of 0s and 1s.encoded as patterns of 0s and 1s.
These digits are called “bits” (binary These digits are called “bits” (binary digits)digits)
BitsBits
The bit 0 represents the value of The bit 0 represents the value of falsefalse
The bit 1 represents the value of The bit 1 represents the value of truetrue
Boolean OperationsBoolean Operations
The operations that manipulate The operations that manipulate true/false value are called true/false value are called ““Boolean Boolean operations.”operations.”
Four of the basic BooleanFour of the basic Boolean operations operations are are • ANDAND• OROR• XOR (exclusive or)XOR (exclusive or)• NOT {has only one input}NOT {has only one input}
Operation ANDOperation AND
Is designed to reflect the truth or Is designed to reflect the truth or falseness of a statement formed by falseness of a statement formed by two statements with operation AND.two statements with operation AND.
P P ANDAND Q Q
This AND statement output is true onlyThis AND statement output is true only
when both of its components are true.when both of its components are true.
Boolean OperationsBoolean Operations
The AND operationThe AND operation
AA BB A AND BA AND B
00 00 00
00 11 00
11 00 00
11 11 11
Boolean OperationsBoolean Operations
The OR operationThe OR operation
AA BB A OR BA OR B
00 00 00
00 11 11
00 11 11
11 11 11
Boolean OperationsBoolean Operations
The XOR operationThe XOR operation• P P XORXOR Q means “either P or Q but not Q means “either P or Q but not
both.”both.”
AA BB A XOR BA XOR B
00 00 00
00 11 11
11 00 11
11 11 00
Boolean OperationsBoolean Operations
The NOT operationThe NOT operation• It is different from AND, OR, and XOR It is different from AND, OR, and XOR
operationoperation• It has only one inputIt has only one input
AA NOT ANOT A
00 11
11 00
ExerciseExercise
Please write down the answers of the Please write down the answers of the questions on the screen. Write down questions on the screen. Write down how you get the answers too, without how you get the answers too, without this part, you won’t get the credit for this part, you won’t get the credit for the question.the question.
NOTE, it will include AND, OR, XOR, NOTE, it will include AND, OR, XOR, NOTNOT
Homework #2Homework #2
A=1, B=1, C=0, D=0A=1, B=1, C=0, D=01.1. NOTNOT A A
2.2. A A ANDAND B B
3.3. B B ANDAND C C
4.4. D D XORXOR C C
5.5. A A XORXOR B B
6.6. C C ANDAND A A
7.7. A A OROR D D
Homework #2Homework #2 (cont.)(cont.)
8.8. B B ANDAND (C (C OROR D) D)
9.9. ((NOTNOT A) A)XORXOR((NOTNOT B) B)
10.10. A A ANDAND ( (NOTNOT D) D)
11.11. B B XORXOR ( (NOTNOT D) D)
12.12. C C OROR (( ((NOTNOT A) A) ANDAND (B (B OROR C)) C))
13.13. NOTNOT ((A ((A ANDAND B) B) OROR (C (C ANDAND D)) D))
14.14. ((NOTNOT C) C) ANDAND ((B ((B ANDAND D) D) ANDAND (C (C ANDAND D)) D))
Gates and Flip-FlopsGates and Flip-Flops
A device that produces the output of A device that produces the output of a Boolean operation when given the a Boolean operation when given the operation’s input values is called a operation’s input values is called a “gate.”“gate.”
Gates can be constructed from a Gates can be constructed from a variety of technologies such as variety of technologies such as gears, relays, etc.gears, relays, etc.
Gates and Flip-FlopsGates and Flip-Flops
A flip-flop is a circuit A flip-flop is a circuit that produces that produces an output value of 0 or 1, which an output value of 0 or 1, which remains constant until a temporary remains constant until a temporary pulse from another circuit causes it pulse from another circuit causes it to shift to the other value.to shift to the other value.
Gates and Flip-FlopsGates and Flip-Flops
AND gates:AND gates:
Gates and Flip-FlopsGates and Flip-Flops
OR gates:OR gates:
Gates and Flip-FlopsGates and Flip-Flops
XOR gates:XOR gates:
Gates and Flip-FlopsGates and Flip-Flops
NOT gates:NOT gates:
A simple circuitA simple circuit
How it works.How it works.
A simple circuitA simple circuit
How it works.How it works.
A simple circuitA simple circuit
How it works.How it works.
A simple circuitA simple circuit
How it works.How it works.
A simple circuitA simple circuit
How it works.How it works.
Another way of constructing a flip-flopAnother way of constructing a flip-flop
Homework #3 (cont.)Homework #3 (cont.)
Question #1 on Page 24Question #1 on Page 24• What input bit patterns will cause the What input bit patterns will cause the
following circuit to produce an output of following circuit to produce an output of 1?1?