CS310, Computer Architecture - PowerPoint PPT Presentation

1 / 46
About This Presentation
Title:

CS310, Computer Architecture

Description:

Idempotent. Commutative. Associative. Distributive. Absorption. DeMorgan's. 15. Involution ... Idempotent. Any value AND (or OR) itself, is itself: x x = x. x ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 47
Provided by: cickovt
Category:

less

Transcript and Presenter's Notes

Title: CS310, Computer Architecture


1
Boolean Algebra and Logic Gates
  • CS310, Computer Architecture

2
Digital Logic Gates
  • Composed of one or a few transistors
  • Implement Boolean functions, such as
  • And
  • Or
  • Not
  • etc.
  • These, in turn, compose integrated circuits

3
Digital vs. Analog Circuits
  • Analog
  • Controls voltage
  • Controls current
  • Operates continuously
  • Digital
  • Controls boolean logic
  • Concerned with true/false values
  • Operates discretely

4
Types of Digital Circuits
  • Combinatorial The output at some time t is a
    function of the inputs at the same time t
  • Biggest point These cannot have cycles (i.e.
    signals cannot feedback into previous portions of
    the circuit)
  • So you can think of this as almost a snapshot
  • Sequential Outputs at time t are a function of
    inputs at the same time t and all previous inputs
  • This introduces the concept of memory
  • You can have cycles and feedback

5
Which are actually used?
  • Some parts of an IC are combinatorial
  • ALUs, buses, some I/O
  • Other parts of an IC are sequential
  • Registers, memory, some I/O
  • The circuit as a whole is __________ .

6
Gates
  • Currently the most cost effective way to build
    computers
  • Have one or two inputs, generate a single output
  • Operate conceptually as truth tables
  • Remember these?

7
The AND gate
8
The OR gate
9
The NOT gate
10
The NAND gate
  • Actually, its an AND and a NOT.
  • NOT is abbreviated with a circle before the
    output
  • So you first take the AND, then negate it

11
The NOR gate
  • Analogously, an OR and a NOT

12
The XOR gate
  • True if inputs are different
  • False if inputs are the same

13
NAND Equivalencies
Lets look at truth tables to see why!
14
NOR Equivalencies
Lets look at truth tables to see why!
15
Boolean Algebra Rules
  • Involution
  • Complement
  • Identity
  • Null
  • Idempotent
  • Commutative
  • Associative
  • Distributive
  • Absorption
  • DeMorgans

16
Involution
  • The easiest
  • Applying NOT twice to a boolean value, is the
    value
  • NOT(NOT x) x

17
Complement
  • A value OR its complement is 1
  • x OR (NOT x) 1
  • A value AND its complement is 0
  • x AND (NOT x) 0

18
Identity
  • Any value OR 0, or AND 1 is the value itself
  • x OR 0 x
  • x AND 1 x
  • For these reasons, OR is commonly represented by
    a PLUS (), and AND is commonly represented by a
    TIMES ()
  • Since any number plus zero is itself
  • And any number times one is itself
  • Well do this from now on

19
Null
  • Any value OR 1 is 1
  • x 1 1
  • Any value AND 0 is 0
  • x 0 0

20
Idempotent
  • Any value AND (or OR) itself, is itself
  • x x x
  • x x x

21
Commutative Law
  • Binary boolean operations AND, OR and XOR are
    commutative
  • x y y x
  • x y y x
  • x XOR y y XOR x
  • XOR is commonly represented by an encircled plus
    sign

22
Associative Law
  • These same binary operators are also associative
  • (x y) z x (y z)
  • (x y) z x (y z)
  • (x XOR y) XOR z x XOR (y XOR z)

23
Distributive Law
  • Works with AND and OR (not XOR)
  • (x y) z (x z) (y z)
  • (x y) z (x z) (y z)

24
Absorption Law
  • This ones more interesting, and used very often
    to simplify digital circuits
  • x (x y) x
  • x (x y) x
  • x (NOT x y) x y
  • x (NOT x y) x y
  • We can either remove
  • An input and two operations
  • A single operation and a NOT gate

25
DeMorgans Law
  • (NOT x) (NOT y) NOT (x y)
  • Replaces one AND and two NOT gates with a NOR
  • (NOT x) (NOT y) NOT (x y)
  • Replaces one OR and two NOT gates with a NAND

26
Combinatorial Circuits
  • Design a circuit that has three inputs and one
    output, such that if the three inputs have more
    ones than zero bits, the circuit output is one.
  • Actually has a name, the majority circuit
  • Steps
  • 1. Make a truth table (already know how to do
    this)
  • 2. Represent the output as a sum of minterms
    (dont know this yet)
  • 3. Construct the circuit using AND, NOR and NOT
    gates
  • We can get this easily from step 2.

27
Truth Table
  • Lets do this part together on the board.
  • Three inputs a, b, and c and output z.

28
Sum of Minterms
  • Take each record in the truth table which yields
    an output of 1.
  • Form a product of the inputs, where if their
    value is zero negate and if their value is one
    keep them as is.
  • Sum them.
  • So in this case

29
What does this mean?
  • Remember is AND and is OR
  • So essentially this says
  • z is 1 if
  • a is zero and b is one and c is one, or
  • a is one and b is zero and c is one, or
  • etc.

30
Building the circuit
  • The first step is to place the input signals on
    the left hand side

31
Building the circuit
  • Then, add NOT gates so we have signals for all
    input possibilities

32
Building the circuit
  • Use an AND gate to get the signal for the first
    minterm

33
Building the circuit
  • Get the rest of the minterms the same way

34
Building the circuit
  • Finally, OR all of the minterms together, and you
    have z.

35
You can also use maxterms
  • You can also construct the circuit using a
    product of the maxterms (complete reverse)
  • Maxterms are formed by finding input sequences
    that result in z0 instead of z1
  • Instead each term contains a sum of input values
  • And 0 inputs are left as is, while 1s are negated
  • And they are ANDed together (as opposed to OR)
  • So for the majority circuit
  • Why does this work? Lets view the truth table.

36
Circuit
  • What then does our circuit look like? Lets do
    it on the board.

37
When to use which?
  • Theres no rule as to which is better
  • People think one is easier than the other
  • Also may base the decision on how many records in
    the truth table generate 0 outputs and how many
    generate 1.
  • So if theres more 0s, a product of maxterms MAY
    be simpler, and if theres more 1s, a sum of
    minterms MAY be simpler
  • We say MAY, because as we saw there are ways to
    simplify Boolean expressions, which you can apply
    sometimes.
  • Also, you can simplify using Karnaugh Maps

38
Simplifying Example
  • Lets look at our minterm sum for the majority
    circuit again
  • We can group the last terms together using the
    distributive property
  • Then use the complement law to simplify
  • We now have a simpler circuit!

39
Karnaugh Maps
  • Karnaugh Maps are a graphical way to capitalize
    upon these simplifications
  • An alternative to using algebra
  • A two-dimensional table
  • Rows and columns represent input values
  • Key point each successive column or row can only
    differ from the previous by one value. Thus

40
Grouping
  • Simplify by grouping adjacent entries, i.e.
  • Represents ab
  • Represents ac
  • Represents bc

41
Why does this work?
  • What does this equate to?
  • So we eliminate the value that is different
    between the entries using the commutative property

42
The full picture
  • Sum all groupings, and you get the simplest form
    possible

43
Rules on Grouping
  • You can only form groups of powers of 2 elements
  • Thus you can group one entry (doesnt change
    anything)
  • These are called isolated cells. You just have
    to use the minterm sum, like usual.
  • You can group two entries, like we saw
  • You CANNOT group three entries
  • You can group four entries. Lets do an example.
  • You can group eight entries.
  • With three inputs (23 eight entries in the
    map), solution is trivial
  • With four inputs (sixteen), its more useful
  • Groups can also overlap across edges. Lets look
    at an example.

44
Other things with Karnaugh Maps
  • We used it with minterms and produce a minterm
    sum
  • Can also use it for a product of maxterms
  • One factor generated for each covering of 0s (not
    1s)
  • Group by 0s and not by 1s
  • Variables get complemented
  • Fewer coverings result in fewer terms
  • In general, a term with n 1s reduces the size of
    the term
  • by log n (i.e. a group of 2 will eliminate
    one input, a group of 4 will eliminate two, etc.)

45
The mysterious NAND
  • A NAND gate is interesting, since given any
    circuit you can represent the entire thing with
    just NANDs
  • Step 1 Apply the law of involution (double
    negative)

46
The mysterious NAND
  • 2. Migrate bubbles, changed NOT to NAND, and use
    DeMorgans to change OR
Write a Comment
User Comments (0)
About PowerShow.com