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

Post on 04-Jan-2016

226 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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)

NOT gate

AND gate

OR gate

NAND gate

NOR gate

XOR gate

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

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

Switches

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

Half adder

1011

0101

0110

0000

CarrySumBA

OutputsInputs

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

The logic circuit is:

Half adder

Half adder

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

Full adder

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

Parallel adder

What does this do?

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

top related