TI 1400 Computer Organization at TU Delft

advertisement
Digital Logic
http://www.pds.ewi.tudelft.nl/~iosup/Courses/2011_ti1400_1.ppt
1
Outline
1.
2.
3.
4.
5.
Basics of Boolean algebra and digital implementation
Sum of products form and digital implementation
Functional Units
Repeated Operations
Other Building Blocks
Unit of Information
• Computers consist of digital (binary) circuits
• Unit of information: bit (Binary digIT), e.g. 0 and 1
• There are two interpretations of 0 and 1:
• as data values
• as truth values (true and false)
3
TI1400/11-PDS
TU-Delft
Bit Strings
• By grouping bits together we obtain bit strings
• e.g <10001>
which can be given a specific meaning
• For instance, we can represent non-negative numbers by
bitstrings:
0
1
2
3
<00>
<01>
<10>
<11>
<10>
<00>
<01>
<11>
4
TI1400/11-PDS
TU-Delft
Boolean Logic
• We want a computer that can calculate, i.e transform
strings into other strings:
1 +2 = 3  <01>  <10> = <11>
• To calculate we need an algebra being able to use only two
values
• George Boole (1854) showed that logic (or symbolic
reasoning) can be reduced to a simple algebraic system
5
TI1400/11-PDS
TU-Delft

Boolean algebra
• Rules are the same as school algebra:
xyyx
x y  y x
Commutative Law
x(y  z)  x  y  x  z
Distributive Law
(x  y)  z  x  (y  z)
Associative Law
• There is, however, one exception:
!
x x  x
6
TI1400/11-PDS
TU-Delft
Boolean algebra
• To see this we have to find out what the operations “+”
and “.” mean in logic
• First the “.” operation: x.y (or x  y )
• Suppose x means “black” and y means “cows”.
Then, x.y means “black cows”
• Hence “.” implies the class of objects that has both
properties. Also called AND function.
7
TI1400/11-PDS
TU-Delft
Boolean algebra
• The “+” operation merges independent objects:
x + y (or x  y)
• Hence, if x means “man” and y means “woman”
• Then x+y means “man or woman”
• Also called OR function
8
TI1400/11-PDS
TU-Delft
Boolean algebra
• Now suppose both objects are identical, for example x
means “cows”
• Then x.x comprises no additional information
• Hence
x x  x  x
xxx
2
9
TI1400/11-PDS
TU-Delft
Boolean algebra
• Next, we select “0” and “1” as the symbols in the algebra
• This choice is not arbitrary, since these are the only
number symbols for which holds x2 = x
• What do these symbols mean in logic?
• “0” : Nothing
• “1” : Universe
• So 0.y = 0 and 1.y = y
10
TI1400/11-PDS
TU-Delft
Boolean algebra
• Also, if x is a class of objects, then 1-x is the complement
of that class
• It holds that x(1-x) = x -x2 = x-x =0
• Hence, a class and its complement have nothing in
common
• We denote 1-x as x
11
TI1400/11-PDS
TU-Delft


Boolean algebra
• A nice property of this system that we write any function
f(x) as
f (x)  a x  b(1 x)
• We can show this by observing that virtually every
mathematical function can be written in polynomial form,
i.e
f (x)  a0 x  a1 x  a2 x 2  ...
12
TI1400/11-PDS
TU-Delft
Boolean algebra
• Now
• Hence,
f (x)  a0 a1x
• Let b = a0 and a = a0 + a1
• Then we have f (x)  a
• From this it follows that
x  b(1 x)
f (1)  a
f (0)  b

13
TI1400/11-PDS
TU-Delft
Boolean algebra
• So
f (x)  f (1) x  f (0) x
• More dimensional functions can be derived in an identical
way:

TI1400/11-PDS
f (x, y)  f (1,1)  x  y  f (1,0)  x  y 
f (0,1)  x  y  f (0,0)  x  y
14
TU-Delft
Binary addition
• We apply this on the modulo-2 addition
x
y

0
1
0
1
0
0
1
1
0
1
1
0
x  y  x y  y x
15
TI1400/11-PDS
TU-Delft
Binary multiplication
• Same for modulo-2 multiplication
x  y  x y
x
y

0
1
0
1
0
0
1
1
0
0
0
1
16
TI1400/11-PDS
TU-Delft
Functions
• Let X denote bitstring, e.g., <x4 x3 x2 x1 >
• Any polynomial function Y=f(X) can be constructed using
Boolean logic
• Also holds for functions with more arguments
• Functions can be put in table form or in formula form
17
TI1400/11-PDS
TU-Delft
Gates
• We use basic components to represent primary logic
operations (called gates)
• Components are made from transistors
x
y
x+y
OR
x
x
y
AND
x
INVERT
TI1400/11-PDS
x.y
18
TU-Delft
Networks of gates
• We can make networks of gates
x
x y  x y
y

xy
EXOR
19
TI1400/11-PDS

TU-Delft
Outline
1.
2.
3.
4.
5.
Basics of Boolean algebra and digital implementation
Sum of products form and digital implementation
Functional Units
Repeated Operations
Other Building Blocks
TI1400/11-PDS
TU-Delft
Sum of product form
x
y
f
0
1
0
1
0
0
1
1
0
1
1

1
f  x y  x y  x y
simplify
f
x
y
21
TI1400/11-PDS
TU-Delft
Minimization of expressions
• Logic expressions can often be minimized
• Saves components
• Example:
f  x yz  x yz x yz x yz
f  x  y (z  z)  y  z(x  x)
f  x  y 1 y  z 1
f  x y  yz
22
TI1400/11-PDS
TU-Delft
Karnaugh maps (1)
• Alternative geometrical method
xy
00
01
11
10
1
1
0
1
01
1
1
0
1
11
0
0
0
0
10
1
1
1
0
vw
00
f v  x v w x v w y v  x y
23
TI1400/11-PDS
TU-Delft
Karnaugh maps (2)
Different drawing
y
w
v
x
24
TI1400/11-PDS
TU-Delft
Don’t Cares
• Some outputs are indifferent
• Can be used for minimization
x
y
f
0
1
0
1
0
0
1
1
0
1
d
1
25
TI1400/11-PDS
TU-Delft
NAND and NOR gates
• NAND and NOR gates are universal
• They are easy to realize
x y  x y
x y  x y
de Morgan’s Laws

TI1400/11-PDS

26
TU-Delft
Outline
1.
2.
3.
4.
5.
Basics of Boolean algebra and digital implementation
Sum of products form and digital implementation
Functional Units
Repeated Operations
Other Building Blocks
TI1400/11-PDS
TU-Delft
Delay
• Every network of gates has delays
transition time
1
input
0
1
output
propagation delay
time
0
28
TI1400/11-PDS
TU-Delft
Packaging
Vcc
Gnd
29
TI1400/11-PDS
TU-Delft
Making functions
nand gates
A
Y
ADD
B
A,B
Y

delay
time
30
TI1400/11-PDS
TU-Delft
Functional Units
• It would be very uneconomical to construct separate
combinatorial circuits for every function needed
• Hence, functional units are parameterized
• A specific function is activated by a special control string F
31
TI1400/11-PDS
TU-Delft
Arithmetic and Logic Unit
A
B
F
add
subtract
compare
or
f1 f0
0
0
1
1
Y
F
0
1
0
1
F
A
B
F
F
Y
32
TI1400/11-PDS
TU-Delft
Outline
1.
2.
3.
4.
5.
Basics of Boolean algebra and digital implementation
Sum of products form and digital implementation
Functional Units
Repeated Operations
Other Building Blocks
TI1400/11-PDS
TU-Delft
Repeated operations
• Y : = Y + Bi, i=1..n
• Repeated addition requires feedback
• Cannot be done without intermediate storage of results
B
F
Y
F
34
TI1400/11-PDS
TU-Delft
Registers
B
Y
F
F
= storage element
35
TI1400/11-PDS
TU-Delft
SR flip flop
• Storage elements are not transient and are able to hold a
logic value for a certain period of time
R
S
Qa
Qb
S
R Qa Qb
0
0
0
1
0
1
1
0
1
0
1
1
0
0
0/1 1/0
36
TI1400/11-PDS
TU-Delft
Clocks
• In many circuits it is very convenient to have the state
changed only at regular points in time
• This makes design of systems with memory elements easier
• Also, reasoning about the behavior of the system is easier
• This is done by a clock signal
clock period
37
TI1400/11-PDS
TU-Delft
D flip flop
• D flip flop samples at clock is high and stores if clock is low
Qn
C
D
D
Qn+1
0
0
1
1
Qn
38
TI1400/11-PDS
TU-Delft
Edge triggered flip flops
• In reality most systems are built such that the state only
changes at rising edge of the clock pulse
• We also need a control signal to enable a change
state change
39
TI1400/11-PDS
TU-Delft
Basic storage element
enables a state change
I
R/W
C
C
I
C
D
Q
O
R/W
O
time
40
TI1400/11-PDS
TU-Delft
Outline
1.
2.
3.
4.
5.
Basics of Boolean algebra and digital implementation
Sum of products form and digital implementation
Functional Units
Repeated Operations
Other Building Blocks
TI1400/11-PDS
TU-Delft
4-bit register
I
R/W
I
I
I
C
C
D
C
D
C
D
C
D
Q
Q
Q
Q
O
O
O
O
42
TI1400/11-PDS
TU-Delft
Some basic circuits
A
m
B
Y = A if m=1
Y = B if m=0
MPLEX
Y
Y
Decoder
Only output yA= 1, rest is 0
A
43
TI1400/11-PDS
TU-Delft
Decoder
Y
Decoder
Only output yA= 1, rest is 0
A
a1
3
2
1
a2
a1 a2 #y
0 0
0
0 1
1
1 0
2
1 1 3
0
44
TI1400/11-PDS
TU-Delft
Multiplexer
A
m
B
Y = A if m=1
Y = B if m=0
MPLEX
Y
b
y
a
m
45
TI1400/11-PDS
TU-Delft
End of Lecture
• Comments?
• Questions?
TI1400/11-PDS
TU-Delft
Memory
Din
REG1
decoder
Address
R/W
mplex
Dout
REG2
REG3
REG4
47
TI1400/11-PDS
TU-Delft
Counter
preset
R/W
MPLEX
REG
INC
0001
output
48
TI1400/11-PDS
TU-Delft
Sequential circuits
• The counter example shows that systems have state
• The state of such systems depend on the current inputs
and the sequence of previous inputs
• The state of a system is the union of the values of the
memory elements of that system
49
TI1400/11-PDS
TU-Delft
State diagrams
• We call the change from one state to another a state transition
• Can be represented as a state diagram
code
S0
S1
S2
0
0
1
0
0
1
0
0
state
S0
S1
S2
S0
50
TI1400/11-PDS
TU-Delft
Conditional Change
x=0
S0
x=1
Present
state
Next
x=0
State
x=1
S0
S1
S2
S1
S2
S2
S2
S0
S0
S1
S2
51
TI1400/11-PDS
TU-Delft
Coding of State
Present
state
yz
00
Next
x=0
YZ
01
State
x=1
YZ
10
01
10
10
10
00
00
52
TI1400/11-PDS
TU-Delft
Put in Karnaugh map
y
x
0
1
0
0
Y
d
d
Y  x y z
1
1

y
z
Z  x  y  z  (x  z)  y
x
1
0
0
0
Z
d
d
0
0
z
53
TI1400/11-PDS

TU-Delft
Scheme
x y
x
xz
y

Z

 z
x y z
Q D
Q D

(x  z)  y
Y
54
TI1400/11-PDS
TU-Delft
General scheme
Outputs
Inputs
Combinatorial Logic
Delay elements
55
TI1400/11-PDS
TU-Delft
Procedure FST
1.
2.
3.
4.
5.
Make State Diagram
Make State Table
Give States binary code
Put state update functions in Karnaugh Map
Make combinatorial circuit to realize functions
56
TI1400/11-PDS
TU-Delft
Download