Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Digital Logic Circuits

• A computer is built from simple gates that represent the basic


logical connectives. A computer cannot even do arithmetic in
an abstract sense - it simulates arithmetic by using logical
gates.
• This allows us to see the value of logical equivalences - we can
use it to simplify digital circuits
Logic of Compound Statements -
Hardware and Circuits
Long Hall Problem
• Design a circuit with a switch at each end of the hall. (called a
3-way, by the way. Any electricians out there? We’ll see why)
Long Hall Problem
• Design a circuit with a switch at each end of the hall

Why is it called a three-way?


Long Hall Problem
• Design a circuit with a switch at each end of the hall

Why is it called a three-way?

It is single pole, double throw, and has three terminals, as opposed to


two for a “normal” switch.
Digital Circuits

● LHS shows a circuit that is closed when P and Q are closed - it


represents the logical expression P ∧ Q
● Similarly, the RHS shows a circuit that is closed when at least
one of P or Q is closed - representing the logical expression
P∨Q
● On, T, 1, high voltage …
● Off, F, 0, low voltage …
● Series, parallel concept represented
NOT

AND

Inclusive OR
How to build an “implication” circuit

¬p ∨ q is logically equivalent to implication! So we can build


reasoning into hardware!
How about an exclusive-or circuit?
● p ⊕ q ≡ (p ∨ q) ∧ ∼ (p ∧ q)

● “p or q but not p and q”


Arithmetic
● Computers do not “calculate” by thinking about quantities.
Rather, the basic arithmetical operations are performed by
simulating them with logic.
● Start with 1-bit arithmetic. We want to build a circuit that will
add two numbers p, q each of which may be 0 or 1.
● We can add 0 and 0, and 0 and 1, and 1 and 0, and stay in the
binary number system, but if we add 1 and 1 we get 2. Not a
binary number. But, we write 2 in base 2 as 10. So we can
write that the “sum” of 1 and 1 is 0, but the carry out (because
it is in a different position) is 1. (All the other sums have a
zero carry.
Arithmetic - addition visualized

0 0 1 1
+ 0 + 1 + 0 + 1
0 0 0 1 0 1 1 0
C S C S C S C S

Notice a pattern for the Carry?


Notice a pattern for the Sum?
Patterns?
Patterns
● The carry bit has exactly the same true table as and ∧
● The sum bit has the same truth table as exclusive or ⊕, which is
equivalent to (p ∨ q) ∧ ∼ (p ∧ q)

See notes or text for a full solution (this does not manage a carry-in.)
Full adder (1)
This is a slightly different take on the full adder from the text.
(Which, by the way, used to be wrong until a previous student
found the error!)

The way I like to think of it is imagine a gate with a CARRY-IN,


two input bits, P, Q, and two outputs, SUM and CARRY-OUT.

The first bit (in a multi-bit adder) will have a default CARRY-IN
of 0, but we can’t count on it always being zero.
Full adder (2)
This is a slightly different take on the full adder from the text.
(Which, by the way, used to be wrong until a previous student
found the error!)

The way I like to think of it is imagine a gate with a CARRY-IN,


two input bits, P, Q, and two outputs, SUM and CARRY-OUT.

The first bit (in a multi-bit adder) will have a default CARRY-IN
of 0, but we can’t count on it always being zero. The text has a
half adder in the first position, amounts to the same thing.

You might also like