4. computer maths and logic 4.2 boolean logic 4.2.4 logic circuits

21
4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

Upload: byron-elliott

Post on 04-Jan-2016

226 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

4. Computer Maths and Logic

4.2 Boolean Logic

4.2.4 Logic Circuits

Page 2: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

Logic gates

Each logical operator is performed physically by a logic circuit (logic gate)

Page 3: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

NOT gate

Page 4: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

AND gate

Page 5: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

OR gate

Page 6: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

NAND gate

Page 7: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

NOR gate

Page 8: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

XOR gate

Page 9: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

Computers contain very large arrays of logic gates combined to form circuits such as adders, decoders or flip-flops.

Boolean expressions are reduced to their simplest form before building these circuits

Uses of logic gates

Page 10: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

A simple AND gate can be used as a switch, one input is the control, the other the data - when the control is 0, output is always 0 (switch is off), when the control is 1, output is always the same as the data:

Switches

Page 11: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

Switches

Page 12: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

A half adder takes two data inputs and adds them producing two outputs, the sum and the carry.

This represents what happens in binary addition: 1 plus 1 is 0 carry 1.

Half adder

Page 13: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

Half adder

1011

0101

0110

0000

CarrySumBA

OutputsInputs

Page 14: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

So in a half adder, the sum is A B and the carry is A • B

The logic circuit is:

Half adder

Page 15: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

Half adder

Page 16: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

When adding binary numbers, the carry must be added to the next column on the left

A full adder does this by putting together two half adders and an OR gate:

Full adder

Page 17: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

Full adder

Page 18: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

So a full adder takes three inputs (two data inputs and the previous carry input) and produces two outputs, the sum and the carry

These can be cascaded to make parallel adders (i.e. adds multiple-bit numbers e.g. bytes, etc.)

Full adder

Page 19: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

Parallel adder

Page 20: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

What does this do?

Page 21: 4. Computer Maths and Logic 4.2 Boolean Logic 4.2.4 Logic Circuits

A circuit that is stable in one state

until flipped into the other.

Can act as memory cells i.e. retain a

0 or 1 until changed.

Flip-flop