13
CSCI 1412 Logic Gates Parminder Kang Email: [email protected] Home: www.cse.dmu.ac.uk/~pkang Phones OFF Please

CSCI 1412 Logic Gates Parminder Kang Email: [email protected] Home: pkang Phones OFF Please

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CSCI 1412 Logic Gates Parminder Kang Email: pkang@dmu.ac.uk Home: pkang Phones OFF Please

CSCI 1412

Logic Gates

Parminder Kang

Email: [email protected]

Home: www.cse.dmu.ac.uk/~pkang

Phones OFF Please

Page 2: CSCI 1412 Logic Gates Parminder Kang Email: pkang@dmu.ac.uk Home: pkang Phones OFF Please

1. Basic Gates

1.1 AND gate:

The AND operation is performed by the AND gate.

Definition:

For two integers A & B;

if A AND B are equal to 1 then the result is 1.

Otherwise the result is 0.

The AND operation is represented by '.' (dot), although the dot is

often omitted in logical expressions.

We write: T=A.B (or T=AB), and say, 'T equals A and B'

Page 3: CSCI 1412 Logic Gates Parminder Kang Email: pkang@dmu.ac.uk Home: pkang Phones OFF Please

The operation of the AND gate is described by the truth table:

A B T

0 0 0

0 1 0

1 0 0

1 1 1

Page 4: CSCI 1412 Logic Gates Parminder Kang Email: pkang@dmu.ac.uk Home: pkang Phones OFF Please

1.2 OR Gate:

The OR operation is performed by the OR gate:

Definition:

For two integers A & B;

if A OR B, OR both are equal to 1 then the result is 1.

Otherwise the result is 0.

The OR operation is represented by '+'

We write: T=A+B , and say, 'T equals A or B'

Page 5: CSCI 1412 Logic Gates Parminder Kang Email: pkang@dmu.ac.uk Home: pkang Phones OFF Please

The operation of the OR gate is described by the truth table:

A B T

0 0 0

0 1 1

1 0 1

1 1 1

Page 6: CSCI 1412 Logic Gates Parminder Kang Email: pkang@dmu.ac.uk Home: pkang Phones OFF Please

1.3 NOT Gate:

The NOT operation is performed by the INVERTER (or NOT gate).

The output of the inverter is the logical inverse of the input.

We write: T=/A, and say, 'T equals not A'.

The operation of the inverter is described by the truth table:

A T

0 1

1 0

Page 7: CSCI 1412 Logic Gates Parminder Kang Email: pkang@dmu.ac.uk Home: pkang Phones OFF Please

Inverters are often appended to AND and OR gates to produce NAND and NOR gates.

A

BT

NAND Gate

A

BT

NOR Gate

Page 8: CSCI 1412 Logic Gates Parminder Kang Email: pkang@dmu.ac.uk Home: pkang Phones OFF Please

1.4 EXCLUSIVE-OR

The EXCLUSIVE-OR operation is performed by the EXCLUSIVE-OR gate:

Definition: For two integers A & B; if A OR B are different then the result is 1.

Otherwise the result is 0.

T=A B ; 'T equals A exclusive or B'

A B T0 0 0

0 1 11 0 11 1 0

Page 9: CSCI 1412 Logic Gates Parminder Kang Email: pkang@dmu.ac.uk Home: pkang Phones OFF Please

A

BT

The EX-OR is a luxury as we don't really need it and we can make it anyway from the other gates. EX-OR is very common so someone decided that we need special symbols for it.

Page 10: CSCI 1412 Logic Gates Parminder Kang Email: pkang@dmu.ac.uk Home: pkang Phones OFF Please

2 Adder:

an adder is a digital circuit that performs addition of numbers.

In modern computers adders reside in the ALU where other operations are performed.

2.1 Half Adder:

A half adder has two inputs, generally labelled A and B, and two outputs, the sum S and carry C.

Page 11: CSCI 1412 Logic Gates Parminder Kang Email: pkang@dmu.ac.uk Home: pkang Phones OFF Please
Page 12: CSCI 1412 Logic Gates Parminder Kang Email: pkang@dmu.ac.uk Home: pkang Phones OFF Please

2.1 Full Adder:

A full adder is a logical circuit that performs an addition operation on three binary digits.

The full adder produces a sum and carry value, which are both binary digits.

Input Output

A B Cin Cout S

0

0

0

0

1

1

1

1

0

0

1

1

0

0

1

1

0

1

0

1

0

1

0

1

0

0

0

1

0

1

1

1

0

1

1

0

1

0

0

1