Documente Academic
Documente Profesional
Documente Cultură
6th Edition
Chapter 4
The Building Blocks:
Binary Numbers, Boolean
Logic, and Gates
Objectives
In this chapter, you will learn about:
The binary numbering system
Boolean logic and gates
Building computer circuits
Control circuits
Introduction
Computing agent
Abstract concept representing any object capable of
understanding and executing our instructions
Binary representation
Boolean logic
Gates
Circuits
Base-2
Built from ones and zeros
Each position is a power of 2
1101 = 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20
10
Signed Numbers
Sign/magnitude notation(old computer)
One of a number of different techniques for representing
p
11
Signed Numbers
1(sign bit) 110001 (total: 7 bits, computer A)
When it is a signed value, it is -49
When it is a unsigned value, it is 113
12
13
If A > 0
then do nothing
else
get complement value of each bit
a <- a+1
Eg: -3 (3bit): 3 -> 011 -> 100 -> 101
-3 (4bit): 3 -> 0011 -> 1100 -> 1101
The number of bit depends on computer (8bit, 16bit, 32bit, 64bit)
Easier method: Get complement value of each bit until before right most
1
Eg: -3 (3bit): 3-> 011 -> 101
-3 (4bit) : 3 -> 0011 -> 1101
No subtraction in twos complement notation. Convert to complement
value.
Eg 5 3 = 5 + (-3)
14
Bit pattern
001
+1
010
+2
011
+3
100
-4
101
-3
110
-2
111
-1
Decimal Value
15
Why different?
Eg. 3bit: -3 ~ +3
Because Sign/Magnitude notation has two zeros while
twos complement notation has only one zero.
16
Textual Information
Code mapping
Assigning each printable letter or symbol in our
alphabet a unique number
ASCII
International standard for representing textual
information in the majority of computers
Uses 8 bits to represent each character (256characters)
UNICODE
Uses a 16-bit representation for characters rather
than the 8-bit format of ASCII(655,36characters)
Invitation to Computer Science, 6th Edition
18
Analog representation
Objects can take on any value
Figure 4.4
Amplitude of the wave: measure of its loudness
Period of the wave (T): time it takes for the wave to
make one complete cycle
Frequency f: total number of cycles per unit time
Invitation to Computer Science, 6th Edition
19
20
Bit depth
Number of bits used to encode each sample
MP3
Most popular and widely used digital audio format
Scanning
Measuring the intensity values of distinct points
located at regular intervals across the images
surface
Invitation to Computer Science, 6th Edition
21
True Color
24-bit color-encoding scheme
23
Data Compression
Why we need data compression?
Because the original data need too much space.
Eg. 3,000,000 pixels/photograph * 24 bits/pixel = 72million bits.
24
Data Compression
Simple compression method - variable length code
sets - for text compress
Letter
A
I
H
W
4 bit encoding
0000
0001
0010
0100
25
26
Data Compression
Compression rate =
27
28
Bistable environment
Only two (rather than 10) stable states separated by
a huge energy barrier
29
Core
Small, magnetizable, iron oxide-coated doughnut,
about 1/50 of an inch in inner diameter, with wires
strung through its center hole
30
31
Circuit board
Interconnects all the different chips needed to run a
computer system
32
33
Figure 4.11
Control (base): used to open or close the switch
inside the transistor
ON state: current coming from the In line
(Collector) can flow directly to the Out line
(Emitter), and the associated voltage can be
detected by a measuring device
Invitation to Computer Science, 6th Edition
34
35
Boolean Logic
Boolean logic
Construction of computer circuits is based on this
Boolean expression
Constructed by combining together Boolean
operations
Example: (a AND b) OR ((NOT b) AND (NOT a))
Truth table
capture the output/value of a Boolean expression
A column for each input plus the output
A row for each combination of input values
Invitation to Computer Science, 6th Edition
36
37
Binary operators
Require two operands
Unary operator
Requires only one operand
NOT operation
Reverses, or complements, the value of a Boolean
expression
Invitation to Computer Science, 6th Edition
38
39
40
Gates
Gate
Hardware devices built from transistors to mimic
Boolean logic
AND gate
Two input lines, one output line
Outputs a 1 when both inputs are 1
41
Gates(continued)
OR gate
Two input lines, one output line
Outputs a 1 when either input is 1
NOT gate
One input line, one output line
Outputs a 1 when input is 0 and vice versa
42
43
Gates(continued)
Abstraction in hardware design
Map hardware devices to Boolean logic
Design more complex devices in terms of logic, not
electronics
Conversion from logic to hardware design can be
automated
44
45
46
47
48
49
50
Taking Snapshots
Step 3: Subexpression Combination Using OR
Gates
Take each of the subexpressions produced in step 2
and combine them, two at a time, using OR gates
51
52
53
54
55
56
An Addition Circuit
Full adder
Performs binary addition on two unsigned N-bit
integers
Figure 4.27
Shows the complete full adder circuit called ADD
Addition circuits
Found in every computer, workstation, and handheld
calculator in the marketplace
57
58
59
60
61
Control Circuits
Used to:
Determine the order in which operations are
carried out
Select the correct data values to be processed
Multiplexor
Circuit that has 2N input lines and 1 output line
Function: to select exactly one of its 2N input
lines and copy the binary value on that input line
onto its single output line
62
63
64
65
66
67
Summary
Digital computers
Use binary representations of data: numbers,
text, multimedia
Binary values
Create a bi-stable (two states) environment,
making computers reliable
Boolean logic
Maps easily onto electronic hardware
Invitation to Computer Science, 6th Edition
68
Summary (continued)
Circuits
Constructed using Boolean expressions as
an abstraction
69
Fractional Numbers
Fractional numbers (12.34 and 0.001275)
Can be represented in binary by using signed-integer
techniques
Scientific notation
M x BE
M is the mantissa, B is the exponent base (usually 2),
and E is the exponent
70