Sei sulla pagina 1di 47

Digital Logic

Computer Architecture CS 215

Boolean Algebra
AND OR NOT NAND NOR Exclusive-OR (XOR) Exclusive-NOR (XNOR)

AND/OR
AB = F
A 0 0 1 1 B 0 1 0 1 F 0 0 0 1

Truth Tables (George Boole)

A + B = F
A 0 0 1 1 B 0 1 0 1 F 0 1 1 1

NOT
A = F
A 0 1 F 1 0

NAND/NOR
AB = F
A 0 0 1 1 B 0 1 0 1 F 1 1 1 0

A + B = F
A 0 0 1 1 B 0 1 0 1 F 1 0 0 0

Exclusive-OR (XOR) Exclusive-NOR (XNOR)


A B = F
A 0 0 1 1 B 0 1 0 1 F 0 1 1 0

A xnor B = F
A 0 0 1 1 B 0 1 0 1 F 1 0 0 1

Types of Logic
Combinational Logic Sequential Logic

Combinational Logic
Logical decisions based only on
combinations of inputs Maps inputs to outputs No feedback Inputs/outputs have two states

High (generally +5 Volts) Low (0 Volts)

Combinational Logic
Analog

Continuum of values

Digital Optical Circuits

Use phase or polarization


More than two states

Multi-valued circuits

Logic Gates
Boolean operations can also be
represented as Boolean logic functions AND

AB
A+B A

OR

Compliment

Logic Gates
AND
A B F OR A B F

Buffer A F

Inverter A F

Logic Gates
NAND
A B F NOR A B F

Exclusive-OR (XOR)

Exclusive-NOR (XNOR)

A
B

A
B

Transistors
Control strong electrical signal with a
weak signal Support the process of amplification Threshold

Only voltages within the low and high ranges will work Forbidden Zone

Electronics: Inverter
VCC = +5 V RL A A Vin

VCC

Vout
Collector Emitter

GND = 0 V Schematic symbol Transistor circuit

Properties of Boolean Algebra


Commutative

AB = BA A+B=B+A A(B + C) = AB + AC A + BC = (A + B)(A + C) 1A = A 0+A=A

Distributive

Identity

Properties of Boolean Algebra


Compliment

Logical inverse

Associative

A(BC) = (AB)C A + (B + C) = (A + B) + C AA = A A+A=A

Idempotence

Multimedia Logic

Try this
Draw logic diagrams for the following:

A+B+C=F ABC = F AB + C = F A(B + C) = F

A+B+C=F (A + B)(A + C)(B + C) = F

Create a truth table & a circuit diagram for each of the previous equations Implement your diagrams and test them

DeMorgans Laws
A + B AB
=AB =A+B

Try drawing truth tables to prove this is true.

Standard Circuits
Multiplexer/Demultiplexer Encoder/Decoder Full adder

Multiplexer/Demultiplexer
Multiplexer

2n inputs share a communication channel using n control bits

Demultiplexer

Single input connects to one of 2n outputs using n control bits

Try this
Create a truth table for a 2-input
multiplexer Use this truth table to create a corresponding circuit

Encoder/Decoder
Encoder

2n inputs / n outputs Output is binary code for which input had a 1 n inputs / 2n outputs Output that gets 1 determined by inputs; all others get 0

Decoder

Try this
Create a truth table for a 4x2 encoder? Use this truth table to create a
corresponding circuit

Full adder
Adds three one-bit
binary numbers (C A B) and outputs two one-bit binary numbers, a sum (S) and a carry (C1) Usually a component in a cascade of adders The carry-in for one full-adder circuit is from the carry-out from the previous circuit

1 1 1 1 + 0 1 1 0 0

Try this
Create a truth table for a Full Adder Use this truth table to create a
corresponding circuit

Does it look like this?

Sequential Logic
Decisions based on combinations of
current inputs as well as past history of outputs

S-R Flip-Flop
What would
the truth table look like for this? Is Q an input? Whats the purpose of this circuit?
S

Reduction
Algebraic Method K-Map Method Tabular Method

Algebraic Method
F = AB + A = A(B + 1) = A(1) =A
distributive property identity identity

Algebraic Method
F = ABC + ABC + ABC + ABC
How would you reduce this? Give it a try! Did you get F = BC + AC + AB ? How did you get it?

Algebraic Method
Try these

F = A(B+C) + AB F = A(B+C) + B(A+C) + C(A+B)

Try this
Create a circuit diagram based on the
following 4 inputs, 1 output Output is 1 whenever exactly two of the inputs are 1

K-Map Method
F = ABC + ABC + ABC + ABC
AB

C
0 1

00

01

11 1

10

Try this
AB
CD 00 01 11 10 1 00 1 01 11 1 10 1 1 1

And this
AB
CD 00 01 11 10 1 1 1 1 00 01 1 11 1 1 1 10

And this
AB
CD 00 01 11 10 1 00 01 1 1 1 1 1 1 1 11 10

And this
AB
CD 00 01 11 10 00 1 1 1 1 1 1 1 01 11 10 1

Dont Cares
Can be 0 or 1

AB
CD 00 01 11 10 d 00 1 1 1 1 1 01 11 10 d

Try this
AB
CD 00 01 11 10 d 1 1 1 1 1 d 00 01 11 10 d

Try this
Design a circuit with three inputs and
two outputs, such that the outputs represent the binary encoding of the three inputs added together.

Tabular Method
(Quine-McClusky)
A 0 0 B 0 0 0 C 0 0 1 D 0 1 0 F A 0 B 0 C 0 D 0

d
1 0

0 0
0

0 0
1 1 0 1 0 1 1

0 1
0 1 1 1 1 0 1

1 1
1 0 0 1 1 1 1

A.

0
0 0 0 0 1 1 1 1 1 1 1 1

0
1 1 1 1 0 0 0 0 1 1 1 1

1
0 0 1 1 0 0 1 1 0 0 1 1

1
0 1 0 1 0 1 0 1 0 1 0 1

1
0 1 1 1 0 0 1

B.

0 1 0 1 1 1

A. Start with a truth table that lists all input combinations and their outputs B. Eliminate rows that have a 0 output

d
0 1 0

Note how the above rows are ordered

Note: a d output is interpreted as 1

Tabular Method
(Quine-McClusky)
A 0 B 0 C 0 D 0 A B 0 C 0 D _

0 0
0 0 1 0 1 1 1

0 0
1 1 0 1 0 1 1

0 1
0 1 1 1 1 0 1

1 1
1 0 0 1 1 1 1

0 _
_ 0 1 1 1 0 1 _

_ 0
1 1 _ 0 1 1 1 1

1 1
1 1 1 1 _ _ 1 1

C.

0
0 _ 0 _ 0 1 _ 1

C. Find all combinations of rows where only one bit is different and replace the bit with a blank D. Repeat this process until no additional pairings are possible

Tabular Method
(Quine-McClusky)
A 0 B 0 C 0 D _ A B _ C _ D 1

0 0
0 _ 0 _ 0 1 _ 1

0 _
_ 0 1 1 1 0 1 _

_ 0
1 1 _ 0 1 1 1 1

1 1
1 1 1 1 _ _ 1 1



* *

_ _

_ 1

1 _

1 1

* *

These rows cannot be combined with any other row

Tabular Method
(Quine-McClusky)
A 0 B 0 C 0 D _ A B _ C _ D 1

0 0
0 _ 0 _ 0 1 _ 1

0 _
_ 0 1 1 1 0 1 _

_ 0
1 1 _ 0 1 1 1 1

1 1
1 1 1 1 _ _ 1 1



* *

_ _

_ 1

1 _

1 1

* *

These are the rows we will turn into terms in our equation

Try this!
Create a circuit consisting of 2, 1-bit
inputs (A and B), 2 control bits (C1, C0), and one output (F), that will perform the following operations

F = A < B (C=01) F = A = B (C=10) F = A > B (C=11)

Potrebbero piacerti anche