Computer Architecture

Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

Binary Addition

Addition of binary numbers is similar to the decimal addition.


The following points will help in understanding the rules of binary
addition:
–0+0=0
–0+1=1
–1+0=1
– 1 + 1 = 0 with a carry of 1 or = 102
Binary Subtraction

• It is also performed in a manner similar to that used in decimal


subtraction.
• Because binary system has only two digits, binary subtraction
requires more borrowing operations than decimal subtraction.
• The four rules for binary subtraction are as under:
Binary Subtraction

• 1. 0-0=0
• 2. 1-0=1
• 3. 1-1=0
• 4. 0-1=1 with a borrow of 1 from the next column of the
minuend or 10-1=1.
Binary Subtraction
• Example 1: Subtract 01012 from 11102
• Solution:
Complement of a number
• In digital work, two types of complements of a binary number
are used for complemental subtraction:
1’s complement
• The 1’s complement of a binary number is obtained by changing
its each 0 into a 1 and each 1 into a 0.
Example: Find the 1’s complement of 1002 and 11102
Solution: The 1’s complement of 1002 is 0112 and of 11102 is
00012.
Complement of a number
• 2’s complement
• The 2’s complement of a binary number is obtained by adding 1 to
its 1’s complement.
2’s complement = 1’s complement + 1

Example 1: Find the 2’s complement of 10112.


Solution: Its 1’s complement is 01002. Next, add 1 to get 01012.
Hence 2’s complement of 10112 is 01012.
LOGIC CIRCUITS

• Definition of a logic gate:


• A logic gate is an electronic circuit which makes logic decisions.
• It has one output and one or more inputs. The output signal appears
only for certain combinations of input signals.
• Logic gates serve as the basic building blocks from which most of the digital
systems are built up.
• They implement the hardware logic function based on the logical
algebra developed by George Boole which is called Boolean algebra.
• Variables used in Boolean algebra can only be one of the two values
i.e. either 0 or 1.
LOGIC CIRCUITS

• Digital circuits called logic gates can be constructed from diodes,


transistors, and resistors connected, so that the circuit output is
the result of a basic logic operation (OR, AND, NOT) performed
on the inputs.
Types of logic gate

• The three types of essential logic gate are:


– AND gate
– OR gate
– NOT gate
• With these three gates, any possible Boolean equation can be
implemented.
Truth table

• A truth table can be defined as a table which gives the output


state for all possible input combinations.
• In other words, a truth table is a means for describing how a
logic circuit’s output depends on the logic levels present at the
circuit’s inputs.
• Fig. 6.4 illustrates a truth table for one type of two-input logic
circuit.
Truth table
Truth table

• Note: There are 4 table entries for the two-input truth tables, 8
entries for a three-input truth table and 16 entries for the four-
input truth table.
• The number of input combinations will equal 2N for an N-input
truth table.
The OR gate

• The truth table for a two-input OR gate is shown in Fig. 6.5 (a)
and its equivalent symbol in Fig. 6.5 (b).
• The two inputs have been marked as A and B and the output as
A+B.
• The table shows that A+B is logic 1 for every combination of
input levels where one or more inputs are 1. The only case
where A+B is a 0 is when both inputs are 0.
The OR gate

• The OR gate logic operation


– The OR gate has an output of 1 when either A or B or both are 1 otherwise it is 0.

The Boolean expression for the OR operation is F= A+B


Note: In this expression, the + sign does not stand for ordinary addition, it
stands for the OR operation and F=A+B is read as “ F equals A OR B”.
The AND gate

• The truth table for a two-input AND gate is shown in Fig. 6.6
(a) and its equivalent symbol in Fig. 6.6 (b).
• The two inputs have been marked as A and B and the output as
A●B.
• The table shows that A●B is a logic 1 only when both A and B
are at the logic 1 state. For any case where one of the inputs is 0, the
output is 0.
The AND gate

• The AND gate logic operation


– The AND gate has an output of 1 only if all its inputs are 1. Its output
would be 0 if any of its inputs is 0.

The Boolean expression for the AND operation is F = A●B


Note: In this expression, the sign ● stands for the Boolean AND operation and
not the multiplication operation. Also note that, the expression F = A●B is read
as “ F equals A AND B”.
The NOT gate

• It is so called because its output is NOT the same as its input.


• It is also called an inverter because it inverts (compliments) the input
signal.
• All it does is to invert the input as shown in its Fig. 6.7 (a).
• It has one input and one output as shown in Fig. 6.7 (b)
• For example, if the variable A is subjected to the NOT operation, the
result F can be expressed as F = Ā
• Where the over bar represents the NOT operation.
• This expression is read as “F equals NOT A” or “F equals the inverse
of A” or “F equals the compliment of A” .
• Each of these is a common usage and all indicate that the logic value
F = Ā is opposite to the logic value of A.
The NOT gate

• The truth table in Fig. 6.7 (a) clarifies this for the two cases
and, that is
• because 0 is not 1
• because 1 is not 0
NOR Gates and NAND Gates

• Two other types of logic gates, NOR gates and NAND gates are widely
used in digital circuits.
• These gates actually combine the basic AND, OR, and NOT
operations, so it is a relatively very simple to write their Boolean
expressions.
The NOR Gate

• It is a NOT-OR gate. It can also be made out of an OR gate by


combining an inverter in its output.
• The symbol for a two-input NOR gate is shown in Fig. 6.8.
• It is the same as the OR gate symbol except that it has a small
circle on the output.
• The small circle represents the inversion operation.
• Thus, the NOR gate operates like an OR gate followed by an
INVERTER, so that the output expression for the NOR gate is
The NOR Gate
The NAND Gate

• It is a NOT-AND gate. It can be obtained by connecting a NOT


gate in the output of an AND gate.
• The symbol for a two-input NAND gate is shown in Fig. 6.9 (a).
• It is the same as the AND gate symbol except for the small
circle on its output.
• Once again, the small circle denotes the inversion operation.
• Thus, the NAND operates like an AND gate followed by an
INVERTER, so that the output expression for the NAND gate is
The NAND Gate
Types of Logic circuits

• Logic circuits can be classified into Combinational logic circuits and


Sequential logic circuits.
• These are the basic circuits used in most of the digital electronic
devices like Computers, Calculators, Mobile phones, etc.
Types of Logic circuits

• Combinational logic circuits:


– Combinational logic circuits are basically made up of digital logic gates like
AND gate, OR gate, NOT gate and universal gates (NAND gate and NOR gate)
– All these gates are combined together to form a complicated switching
circuit.
– In combinational logic circuit, the output at any instant of time depends
only on present input at that particular time.
– Combinational logic circuits do not have any memory elements.
– Combinational circuits are used in microprocessor and microcontroller for
designing the hardware and software components of a computer .
Combinational logic circuit
Types of Logic circuits…..

• Sequential logic circuits:


– In sequential circuit the output of the logic device is not only dependent
on the present inputs to the device, but also on past inputs.
– Unlike combinational circuits, the sequential circuits have memory devices
in order to store the past outputs.
– In fact sequential digital logic circuits are nothing but combinational
circuit with memory .
– Examples of sequential logic circuits are counters, flip flops, constructed
using digital logic gates and memory .
Sequential logic circuit
Combinational Logic Circuits

• Combinational logic circuits are the ones in which the logic level
at the output depends on the combination of logic levels present at
the inputs.
• A combinational circuit has no memory characteristic, so its
output depends only on the current value of its inputs.
• To simplify the combinational logic circuits, two methods will be
used; one uses Boolean algebra theorems; the other uses a mapping
technique.
Assignment

You might also like