Hardware Implementations Gates and Circuits. Three Main Gates AND OR NOT.

26
Hardware Implementations Gates and Circuits
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    222
  • download

    2

Transcript of Hardware Implementations Gates and Circuits. Three Main Gates AND OR NOT.

Page 1: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Hardware Implementations

Gates and Circuits

Page 2: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Three Main Gates

AND OR NOT

Page 3: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Gate Diagrams

Example 1: [(today is Monday) AND (it is raining)] OR (it is snowing)

Page 4: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Gate Diagrams

Example: What does it represent?

Page 5: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Gate Diagrams

Example: {[(today is Monday) AND (it is raining)] OR (it is snowing)} AND {NOT [(it is raining) AND (it is snowing)]}

Page 6: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Truth Table to Gates

First, build the Boolean algebra expression that gives Z Z = AB + A’B’ Z = (A AND B) OR

(NOT A AND NOT B)

A B Z

T T T

T F F

F T F

F F T

Page 7: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Truth Table to Gates

Z = AB + A’B’ Next, build the

circuit that goes with the Boolean algebra expression Z

A B Z

T T T

T F F

F T F

F F T

Page 8: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Z = AB + A’B’

Page 9: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Binary Arithmetic

We can add binary numbers just like decimal numbers only using base two arithmetic.

For example:

5 101

1110

101

+ 7 + 111 + 111

12 1100 1100

Page 10: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Binary Addition

Notice in addition:

0 0 1 1

+ 0 + 1 + 0 + 1

0 1 1 10

False True True False

False False False True

Sum

Carry

A B Sum

(1) T (1) T (0) F

(1) T (0) F (1) T

(0) F (1) T (1) T

(0) F (0) F (0) F

Page 11: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Sum and Carry

A B Carry

1 1 1

1 0 0

0 1 0

0 0 0

A B Sum

1 1 0

1 0 1

0 1 1

0 0 0

Page 12: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Sum Circuit

A B Sum

1 1 0

1 0 1

0 1 1

0 0 0

Sum = AB’ + A’B

Page 13: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Carry Circuit

A B Carry

1 1 1

1 0 0

0 1 0

0 0 0

Carry = AB

Page 14: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Half Adder - Sum and Carry

Page 15: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Half Adder

The sum digit is 0 if the sum is even. The sum digit is 1 if the sum is odd. The carry is 1 if the sum is greater than 1. Handles the case where we add two binary

digits with no inward carry.

Page 16: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Full Adder

Takes a carry in and produces the result and carry out.

So, we have 3 inputs and two outputs. Combine two half-adders together with an OR gate

to get a full adder for each binary digit. How many half adders would we need to add two

8-digit binary numbers? How many gates?

Page 17: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Full Adder

Page 18: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Subtraction

A B Sub

1 1 0

1 0 1

0 1 1

0 0 0

A B Borrow

1 1 0

1 0 0

0 1 1

0 0 0

Page 19: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Binary Subtraction

We do binary subtraction like decimal subtraction only the borrowing is done in 2’s instead of 10’s.

122 01111010

- 7 - 00000111

115 01110011

Page 20: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Subtraction as Addition

If A = 01111010, B = 00000111, then using the twos-complement representation for –B, we have –B = 11111000 + 1 = 11111001 so

122 01111010

- 7 + 11111001

115 01110011

Page 21: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Binary Multiplication

Again, just like decimal except we add and multiply in binary.

* 0 1

0 0 0

1 0 1

5 101

x 7 x 111

35 100011

Page 22: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

NAND Gates and NOT

This gate represents (A NAND NOT B).

Page 23: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

NAND Truth Table

A B A NAND B

T T F

T F T

F T T

F F T

Page 24: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

NAND

Fact: All other gates (AND, OR, NOT) can be constructed using only NAND gates

Verification:

Page 25: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Exercises

Fill in a truth table and give a Boolean expression for the following circuits.

Page 26: Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.

Exercises

- How would you create a one binary digit multiplier? A two-digit by one-digit multiplier? A two-digit by two-digit multiplier? * 0 1

0 0 0

1 0 1