The Design of Survivable Networks
Download
Report
Transcript The Design of Survivable Networks
ECEN 248: INTRODUCTION TO
DIGITAL SYSTEMS DESIGN
Lecture 3
Dr. Shi
Dept. of Electrical and Computer Engineering
Understanding Decimal Numbers
Decimal numbers are made of decimal digits:
(0,1,2,3,4,5,6,7,8,9)
Number representation:
8653 = 8x103 + 6x102 + 5x101 + 3x100
What about fractions?
97654.35 = 9x104 + 7x103 + 6x102 + 5x101 + 4x100 +
3x10-1 + 5x10-2
Informal notation (97654.35)10
Understanding Binary Numbers
Binary numbers are made of binary digits (bits):
Number representation:
(1011)2 = 1x23 + 0x22 + 1x21 + 1x20 = (11)10
What about fractions?
0 and 1
(110.10)2 = 1x22 + 1x21 + 0x20 + 1x2-1 + 0x2-2
Groups of eight bits are called a byte (B)
(11001001) 2
Convert an Integer from Decimal to Another
Base
For each digit position:
1. Divide decimal number by the base (e.g. 2)
2. The remainder is the lowest-order digit
3. Repeat first two steps until no divisor
remains.
Example for (13)10:
Integer Remainder Coefficient
Quotient
13/2 =
6/2 =
3/2 =
1/2 =
6
3
1
0
1
0
1
1
a0 = 1
a1 = 0
a2 = 1
a3 = 1
Answer (13)10 = (a3 a2 a1 a0)2 = (1101)2
Convert a Fraction from Decimal to Another Base
For each digit position:
1. Multiply decimal number by the base (e.g. 2)
2. The integer is the highest-order digit
3. Repeat first two steps until fraction
becomes zero.
Example for (0.625)10:
Integer
0.625 x 2 =
0.250 x 2 =
0.500 x 2 =
1
0
1
Fraction
+
+
+
0.25
0.50
0
Coefficient
a-1 = 1
a-2 = 0
a-3 = 1
Answer (0.625)10 = (0.a-1 a-2 a-3 )2 = (0.101)2
The Growth of Binary Numbers
n
2n
n
2n
0
20=1
8
28=256
1
21=2
9
29=512
2
22=4
10
210=1024
3
23=8
11
211=2048
4
24=16
12
212=4096
5
25=32
20
220=1M
6
26=64
30
230=1G
Giga
7
27=128
40
240=1T
Tera
Kilo
Mega
250=Peta
Binary Addition
Binary addition is very simple.
This is best shown in an example of adding two binary
numbers…
Procedure easy to implement by circuits
1 1 1 1
1 1 1 0 1
+
1 0 1 1 1
--------------------1 0 1 0 1 0 0
1
1
1
carries
Binary Subtraction
° We can also perform subtraction (with borrows in place
of carries).
° Let’s subtract (10111)2 from (1001101)2…
° Procedure hard to implement by circuit
1
0 10 10
1
0
10
0 0 10
0 1 1 0 1
1 0 1 1 1
-----------------------1 1 0 1 1 0
borrows
Binary Multiplication
Binary multiplication is much the same as decimal multiplication,
except that the multiplication operations are much simpler…
1
0 1 1 1
X
1 0 1 0
----------------------0 0 0 0 0
1 0 1 1 1
0 0 0 0 0
1 0 1 1 1
----------------------1 1 1 0 0 1 1 0
Binary Data Storage & Representation
•
Binary cells store individual bits of data
•
Multiple cells form a register.
•
Data in registers can indicate different values
•
Hexadecimal: (41)16=(65)10
•
BCD (Binary Coded Decimal): (41)10
•
ASCII (American Standard Code for
Information Interchange): letter “A”
0
Binary Cell
1
0
0
0
0 0
1
Register Transfer
Data can move from register to register.
Digital logic used to process data.
We will learn to design this logic.
Register A
Register B
Digital Logic
Circuits
Register C
Digital Systems
Analysis problem:
Inputs
·
·
Logic
Circuit
·
·
Outputs
Determine binary outputs for each combination of inputs
Design problem: given a task, develop a circuit that
accomplishes the task
Many possible implementations.
Try to develop “best” circuit based on some criterion (size, power,
performance, etc.)
Boolean Algebra
George Boole 1815-1864
English
mathematician
Boolean algebra or Boolean logic
Sound
In
and complete system
Everything is either true or false, and can proven
Nothing is unknown
Case closed
contrast, mathematics about integers are incomplete
Many things can NOT be proven true nor false
Godel’s incomplete theorem
Endless effort …
Boolean Algebra
A Boolean algebra is defined as a closed
algebraic system containing a set of elements
Every
variable can take only two values 0 or 1
Only two operators, * and +
Identity elements
a
+0=a
a * 1 = a
0 is the identity element for the + operation·
1 is the identity element for the * operation·
Commutativity and Associativity of
the Operators
The Commutative Property: For every a and b
a
+b=b+a
a * b = b * a
The Associative Property: For every a, b, and c
a
+ (b + c) = (a + b) + c
a * (b * c) = (a * b) * c
The Distributive Property
The Distributive Property:
For every a, b, and c,
a+(b*c)=(a+b)*(a+c)
a*(b+c)=(a*b)+(a*c)
Distributivity of the Operators
and Complements
The Existence of the Complement:
For every a there exists a unique element called
a’ (complement of a) such that,
a + a’ = 1
a * a’ = 0
To simplify notation, the * operator is frequently
omitted. When two elements are written next to
each other, the AND (*) operator is implied…
a+b*c=(a+b)*(a+c)
a + bc = ( a + b )( a + c )
Claude Shannon 1916-2001
American mathematician
Father of information theory and
cryptography
In 1937, at age 21, he was a master
student at MIT
Noticed engineers were messing
around with logic circuits without a
sound foundation
Wrote the “most important master’s
thesis of all time” to demonstrate
Boolean algebra could be used to
resolve any logical relationship
Since then, Boolean algebra becomes
widely used
Describing Circuit Functionality:
Inverter
Truth Table
A
Y
A
Y
0
1
1
0
Symbol
Input
Basic logic functions have symbols.
The same functionality can be represented with truth
tables·
Output
Truth table completely specifies outputs for all input
combinations.
The above circuit is an inverter.
An input of 0 is inverted to a 1.
An input of 1 is inverted to a 0.
The AND Gate
A
B
This is an AND gate
Logic operation Y= A* B
So, if the two inputs signals
are asserted (high) the
output will also be asserted.
Otherwise, the output will
be deasserted (low).
Y
Truth Table
A
B
Y
0
0
0
0
1
0
1
0
0
1
1
1
The OR Gate
A
B
This is an OR gate.
Logic operation Y = A+B
So, if either of the two
input signals are
asserted, or both of
them are, the output
will be asserted.
Note: If there are n inputs, then the truth
table will have 2n rows. Since we
can fill any of the entries on output
with 0 or 1, there are 2^2^n ways to
fill a truth table of n input.
Therefore, there are 2^2^n gates of
n input
Y
A
B
Y
0
0
0
0
1
1
1
0
1
1
1
1
The NAND Gate
This is a NAND gate. It
is a combination of an
AND gate followed by
an inverter. Its truth
table shows this.
A
B
Y
A
B
Y
0
0
1
0
1
1
1
0
1
1
1
0
The NOR Gate
A
B
Y
This is a NOR gate. It is a combination of an OR
gate followed by an inverter. It’s truth table
A
B
shows this
Y
0
0
1
0
1
0
1
0
0
1
1
0
The XOR Gate (Exclusive-OR)
A
B
This is a XOR gate.
XOR gates assert their output
when exactly one of the inputs
is asserted, hence the name.
The switching algebra symbol
for this operation is , i.e.
1 1 = 0 and 1 0 = 1.
Y
A
B
Y
0
0
0
0
1
1
1
0
1
1
1
0
Describing Circuit Functionality:
Waveforms
AND Gate
A
B
Y
0
0
0
0
1
0
1
0
0
1
1
1
Waveforms provide another approach for representing
functionality.
Values are either high (logic 1) or low (logic 0).
Can you create a truth table from the waveforms?
Consider three-input gates
3 Input OR Gate
Ordering Boolean
Functions
How to interpret A · B+C?
Is it A · B ORed with C ?
Is it A ANDed with B+C ?
Order of precedence for Boolean algebra: AND before
OR.
Note that parentheses are needed here :
Toll Booth Controller
Consider the design of a toll booth controller.
Inputs: quarter, car sensor.
Outputs: gate lift signal, gate close signal
$0.25?
Car?
Logic
Circuit
Raise gate
Close gate
If driver pitches in quarter, raise gate.
When car has cleared gate, close gate.
Call quarter detector signal Q, car detector C
Call raise gate signal R=Q*C, and lower gate signal L=C’
Boolean Algebra
Boolean Algebra
A Boolean algebra is defined with:
A
set of elements S={0,1}
A set of operators
A number of unproved axioms or postulates
Boolean Algebra (cont.)
A binary operator:
Defined
on a set S of elements
A rule that assigns to each pair of elements from S a
unique element from S
Example a*b=c
aS and bS it must hold that a*bS
A set S is closed with respect to a binary operator
if for every two elements of S, the binary
operator specifies a unique element of S
Definition of Boolean Algebra
Boolean algebra is an algebraic structure,
defined by a set of elements S and two binary
operators, +, and ·, with the following postulates:
The structure is closed with respect to + and *
Element 0 is an identity element for +
Element 1 is an identify element for *
1.
2.
x+0=0+x=x
x · 1=1 · x=x
Definition of Boolean Algebra (cont.)
3.
The structure is commutative with respect to + and · :
a
+b=b+a
a·b=b·a
4.
The operator · is distributive over +
The operation + is distributive over ·
a
·(b+c)=(a·b)+(a·c)
a+(b·c)=(a+b)·(a+c)