0% found this document useful (0 votes)
35 views50 pages

CSC 303 Lecture Note-1

The document discusses data representation in computers, explaining that all data must be converted to machine language, specifically binary, for processing. It outlines various number systems (binary, octal, decimal, hexadecimal), the concepts of bits and bytes, and text coding systems such as ASCII and Unicode. Additionally, it covers the conversion processes between different number systems and the representation of signed and unsigned binary numbers.

Uploaded by

Cornelius
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views50 pages

CSC 303 Lecture Note-1

The document discusses data representation in computers, explaining that all data must be converted to machine language, specifically binary, for processing. It outlines various number systems (binary, octal, decimal, hexadecimal), the concepts of bits and bytes, and text coding systems such as ASCII and Unicode. Additionally, it covers the conversion processes between different number systems and the representation of signed and unsigned binary numbers.

Uploaded by

Cornelius
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 50

DATA REPRESENTATION

Computer does not understand human language. Any data, viz., letters, symbols, pictures, audio, videos,
etc., fed to computer should be converted to machine language first, which is a sequence of zeros and
ones.

Computers not only process numbers, letters and special symbols but also complex types of data such as
sound and pictures. However, these complex types of data take a lot of memory and processor time
when coded in binary form. This limitation necessitates the need to develop better ways of handling
long streams of binary digits. Higher number systems are used in computing to reduce these streams of
binary digits into manageable form. This helps to improve the processing speed and optimize memory
usage.

Number System Representation

To a computer, everything is a number, i.e., alphabets, pictures, sounds, etc., are numbers. A number
system is a set of symbols used to represent values derived from a common base or radix. Number
systems can be classified into four major categories:

 Binary number system consists of only two values, either 0 or 1


 Octal number system represents values in 8 digits.
 Decimal number system represents values in 10 digits.
 Hexadecimal number system represents values in 16 digits.
Number System

System Base Digits

Binary 2 01

Octal 8 01234567

Decimal 10 0123456789

Hexadecimal 16 0123456789ABCDEF

Bits and Bytes

1
Bits − A bit is a smallest possible unit of data that a computer can recognize or use. Computer usually
uses bits in groups.

Bytes − group of eight bits is called a byte. Half a byte is called a nibble.

The following table shows conversion of Bits and Bytes −

Byte Value Bit Value

1 Byte 8 Bits

1024 Bytes 1 Kilobyte

1024 Kilobytes 1 Megabyte

1024 Megabytes 1 Gigabyte

1024 Gigabytes 1 Terabyte

1024 Terabytes 1 Petabyte

1024 Petabytes 1 Exabyte

1024 Exabytes 1 Zettabyte

1024 Zettabytes 1 Yottabyte

1024 Yottabytes 1 Brontobyte

1024 Brontobytes 1 Geopbytes

Text Code

Text code is format used commonly to represent alphabets, punctuation marks and other symbols. Four
most popular text code systems are −

2
 EBCDIC
 ASCII
 Extended ASCII
 Unicode

EBCDIC

Extended Binary Coded Decimal Interchange Code is an 8-bit code that defines 256 symbols. Given
below is the EBCDIC Tabular column

ASCII

American Standard Code for Information Interchange is an 8-bit code that specifies character values
from 0 to 127.

ASCII Tabular column

ASCII Code Decimal Value Character

0000 0000 0 Null prompt


3
0000 0001 1 Start of heading

0000 0010 2 Start of text

0000 0011 3 End of text

0000 0100 4 End of transmit

0000 0101 5 Enquiry

0000 0110 6 Acknowledge

0000 0111 7 Audible bell

0000 1000 8 Backspace

0000 1001 9 Horizontal tab

0000 1010 10 Line Feed

Extended ASCII

Extended American Standard Code for Information Interchange is an 8-bit code that specifies character
values from 128 to 255.

Extended ASCII Tabular column

Unicode

Unicode Worldwide Character Standard uses 4 to 32 bits to represent letters, numbers and symbol.

Unicode Tabular Column

4
CONVERSION
When many number systems are considered together, the subscript must always be put so as to
differentiate the number systems. The magnitude of a number can be considered using these parameters:

 Absolute value
 Place value or positional value
 Base value

The absolute value is the magnitude of a digit in a number. For example, the digit 5 in 7458 has an
absolute value of 5 according to its value in the number line.

The place value of a digit in a number refers to the position of the digit in that number i.e. whether;
tens, hundreds, thousands etc. The total value of a number is the sum of the place value of each digit
making the number.

The base value of a number also known as the radix, depends on the type of the number systems that is
being used. The value of any number depends on the radix. For example, the number 100 10 is not
equivalent to 1002.

To convert numbers from one system to another, the following will be considered:
- Converting between binary and decimal numbers.

- Converting octal numbers to decimal and binary form.

- Converting hexadecimal numbers to decimal and binary form.

Converting binary numbers to decimal numbers


5
To convert a binary number to a decimal number, we proceed as follows:
- First, write the place values starting from the right-hand side.

- Write each digit under its place value.

- Multiply each digit by its corresponding place value.

- Add up the products, the answer will be the decimal number in base ten.

EXAMPLE

Convert 1011012 to base 10 (or decimal) number


Place value 25 24 23 22 21 20
Binary digits 1 0 1 1 0 1
Multiply each digit by its place value
N10 = (1*25) + (0*24) + (1*23) + (1*22) + (0*21) + (1*20)
N10 = 32+0+8+4+0+1
=4510
NB: remember to indicate the base subscript since it is the value that distinguishes the different systems.

Converting a decimal fraction to binary

Divide the integral part continuously by 2, for the fractional part, proceed as follows:
Multiply the fractional part by 2 and note down the product
- Take the fractional part of the immediate product and multiply it by 2 again.
- Continue this process until the fractional part of the subsequent product is 0 or starts to repeat
itself.
- Combine the two parts together to set the binary equivalent.

Example

i. Convert 0.37510 into binary form


0.375×2=0.750

6
0.750×2 =1.500
0.500×2 =1.000 (fraction becomes zero)
Therefore 0.37510 = 0.0112
NB: When converting a real number from binary to decimal, work out the integral part and the fractional
parts separately then combine them.

Converting octal numbers to decimal numbers

To convert a base 8 number to its decimal equivalent we use the same method as we did with binary
numbers. However, it is important to note that the maximum absolute value of an octal digit is 7. For
example, 982 is not a valid octal number because digit 9 is not an octal digit, but 7368 is valid because
all the digits are in the range 0-7. Example below shows how to convert an octal number to a decimal
number.

Example
Convert 5128 to its base 10 equivalent
Place value 82 81 80
64 8 1

Octal digit 5 1 2
Write each number under its place value as shown below
Multiply each number by its place value
N10= (5 x 82) + (1 x 81) + (2 x 80)
= (5 x 64) + 8 + 2
= 320 + 8 + 2
N10= 33010
Therefore 5128 =33010

Converting octal numbers to binary numbers

7
To convert an octal number to binary, each digit is represented by three binary digits because the
maximum octal digit i.e. 7 can be represented with a maximum of seven digits. See table 1: Table 1:
Octal to Binary

Octal Binary Equivalent


Digits
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111

Example

i. Convert octal number 3218 to its binary equivalent

Solution

Working from left to the right, each octal number is represented using three digits and then combined
we get the final binary equivalent. Therefore:

3=0112
2=0102
1=0012
Combining the three from left to right
3 2 1
011 010 001
3218 = 0110100012

Converting hexadecimal numbers to decimal number

8
To convert hexadecimal number to base 10 equivalent we proceed as follows:
First, write the place values starting from the right-hand side.
- If a digit is a letter such as ‘A’ write its decimal equivalent

- Multiply each hexadecimal digit with its corresponding place value and then add the products.

- The following examples illustrate how to convert hexadecimal number to a decimal number

Example
Convert the hexadecimal number 11116 to its binary equivalent

Solution

Place each number under its place value.


162 161 160
1 1 1
256 x1= 256
16 x 1 = 16
1 x 1= + 1
273
Therefore 11116 =27310

Converting Hexadecimal Numbers to Binary Numbers

Since F is equivalent to a binary number 11112 the hexadecimal number are therefore represented using
4 digits as shown in the table 2 below.

Table 2: Hexadecimal Table

Hexadecimal Decimal Binary


Digits Equivalent Equivalent

9
00 00 0000
01 01 0001
02 02 0010
03 03 0011
04 04 0100
05 05 0101
06 06 0110
07 07 0111
08 08 1000
09 09 1001
A 10 1010
B 11 1011
C 12 1100
D 13 1101
E 14 1110
F 15 1111

The simplest method of converting a hexadecimal number to binary is to express each hexadecimal digit
as a four bits’ binary digit number and then arranging the group according to their corresponding
positions as shown in the example below.

Converting binary numbers to hexadecimal numbers

To convert binary numbers to their binary equivalents, simply group the digits of the binary number into
groups of four from right to left e.g. 11010001.The next step is to write the hexadecimal equivalent of
each group e.g. 1101- D

0001- 1
The equivalent of 11010001 is D1H or D116

Example

10
Convert 32116 to its binary equivalents
Hexadecimal 3 2 1
Binary Equivalent 0011 0010 0001
Combining the three sets of bits, we get 0011001000012
32116 = 0011001000012

Reason for use of binary system in computers

It has proved difficult to develop devices that can understand natural language directly due to the
complexity of natural languages. However, it is easier to construct electric circuits based on the binary
or ON and OFF logic. All forms of data can be represented in binary system format. Other reasons for
the use of binary are that digital devices are more reliable, small and use less energy as compared to
analog devices.

FIXED POINT REPRESENTATION

A fixed-point number consists of a whole or integral part and a fractional part, with the two parts
separated by a radix point (decimal point in base 10, binary point in base 2, etc.).

Conversion of fixed point numbers

10.1012 to decimal

3.375 to binary

Decimal Fixed-Point Representation

Fixed-point representation has a radix point known as decimal point. Fixed-point numbers having
decimal points at the right end of the number are treated as integers because the fixed-point numbers
having decimal points at the left end of the number are treated as fractions. In this method, the decimal
point position is settled because the number saved in the memory is considered as an integer or as a
fraction.

Binary numbers can be divided into two: signed and unsigned binary numbers. The unsigned are
continually considered as positive integers and are defined as 0s in the MSB while the signed contrast
for negative numbers and are defined as 1s in the MSB.
11
Signed Numbers
Signed numbers contain both sign and magnitude of the number. Generally, the sign is placed in front of
number. So, we have to consider the positive sign for positive numbers and negative sign for negative
numbers. Therefore, all numbers can be treated as signed numbers if the corresponding sign is assigned
in front of the number.
If sign bit is zero, it indicates the binary number is positive. Similarly, if sign bit is one, it indicates the
binary number is negative.
Representation of Un-Signed Binary Numbers
The bits present in the un-signed binary number holds the magnitude of a number. That means, if the
un-signed binary number contains ‘N’ bits, then all N bits represent the magnitude of the number, since
it does not have any sign bit.
Example
Consider the decimal number 108. The binary equivalent of this number is 1101100. This is the
representation of unsigned binary number 108
10810 = 11011002
It is having 7 bits. These 7 bits represent the magnitude of the number 108.
Representation of Signed Binary Numbers
The Most Significant Bit (MSB)
The MSB of signed binary numbers is used to indicate the sign of the numbers. Hence, it is also called
as sign bit. The positive sign is represented by placing ‘0’ in the sign bit. Similarly, the negative sign is
represented by placing ‘1’ in the sign bit.
If the signed binary number contains ‘N’ bits, then N−1 bits only represent the magnitude of the number
since one bit, MSB is reserved for representing sign of the number. Below is an 8-bit representation:

magnitude

Sign bit
There are three types of representations for signed binary numbers
● Sign-Magnitude form
● 1’s complement form
● 2’s complement form
Representation of a positive number in all these 3 forms is same. But, only the representation of negative
number will differ in each form.
Example

12
Consider the positive decimal number +108. The binary equivalent of magnitude of this number is
1101100. These 7 bits represent the magnitude of the number 108. Since it is positive number, consider
the sign bit as zero, which is placed on left most side of magnitude.
+108
+10810 = 01101100
Therefore, the signed binary representation of positive decimal number +108 is 𝟎𝟏𝟏𝟎𝟏𝟏𝟎𝟎. So, the
same representation is valid in sign-magnitude form, 1’s complement form and 2’s complement form for
positive decimal number +108.
Sign-Magnitude form
In sign-magnitude form, the MSB is used for representing sign of the number and the remaining bits
represent the magnitude of the number. So, just include sign bit at the left most side of unsigned binary
number. This representation is similar to the signed decimal numbers representation.

Example
Consider the negative decimal number -108. The magnitude of this number is 108. We know the
unsigned binary representation of 108 is 1101100. It is having 7 bits. All these bits represent the
magnitude.
Since the given number is negative, consider the sign bit as 1, which is placed on left most side of
magnitude.
−108
−10810 = 11101100
Therefore, the sign-magnitude representation of -108 is 11101100.

Signed decimal sign-magnitude

+6 0110

-6 1110

+0 0000

-0 1000

+7 0111

-7 1111

The above are examples of sign magnitude. Note that it is 4-bit representation
13
Range
From the above table, it is obvious that if the word size is n bits, the range of numbers that can be
represented is from - (2n-1 -1) to + (2n-1 -1). A table of word size and the range of Sign Magnitude (SM)
numbers that can be represented as shown in the following.
Word size The range for SM numbers

4 -7 to +7

8 -127 to +127

16 -32767 to +32767

32 -2147483647 to +2147483647

Notice that the bit sequence 1101corresponds to the unsigned number 13, as well as the number –5 in
SM notation. Its value depends only on the way the user or the programmer interprets the bit sequence.
Disadvantages of sign magnitude
● There are two notations for 0 (0000 and 1000), which is very inconvenient when the computer
wants to test for a 0 result.
● It is not convenient for the computer to perform arithmetic.
Hence, due to the above mentioned ambiguities, sign magnitude notation is generally not used to
represent signed numbers inside a computer.

1’s complement form

The 1’s complement of a number is obtained by complementing all the bits of signed binary number.
So, 1’s complement of positive number gives a negative number. Similarly, 1’s complement of negative
number gives a positive number.
That means, if you perform two times 1’s complement of a binary number including sign bit, then you
will get the original signed binary number.
Example
Consider the negative decimal number -108. The magnitude of this number is 108. The signed binary
representation of 108 (in 8-bit) is 01101100, the MSB of this number is zero, which indicates positive
number. Complement of zero is one and vice-versa. So, replace zeros by ones and ones by zeros in order
to get the negative number.
−10810 = 10010011
Therefore, the 1’s complement of 10810 is
10010011
100100112.

14
2’s complement form

The 2’s complement of a binary number is obtained by adding one to the 1’s complement of signed
binary number. So, 2’s complement of positive number gives a negative number. Similarly, 2’s
complement of negative number gives a positive number.
That means, if you perform two times 2’s complement of a binary number including sign bit, then you
will get the original signed binary number.

In a computer, numbers are stored in registers where there is reserved a designated number of bits for
the storage of numbers in binary form. Registers come in different sizes, four, eight, sixteen,etc.

Steps of converting a negative decimal number to two’s complement:


 Step 1: First make sure you choose a register that is large enough to accommodate all of the bits
needed to represent the number.
 Step 2: Convert the absolute value of the given number to binary. Prefix this number with 0
indicate that it is positive (ensure the number of zeros added sum up to the desired register size,
e.g. 8).
 Step 3: Take the complement of each bit by changing zeroes to ones and ones to zero.
 Step 4: Add 1 to your result. This is the two’s complement representation of the negative integer.

Example 1: Find the two’s complement of -17


 Step 1: In 8 bits
 Step 2: The absolute value of -17 is 17. 1710 = 0001 00012 .
 Step 3: Take the complement: 1110 1110
 Step 4: Add 1: 1110 1110 + 1 = 1110 1111. Thus the two’s complement for -17 is 1110 1111 2.
It begins on the left with a 1, therefore we know it is negative.
Example 2:
Do same for -108

COMPUTER ARCHITECTURE AND ORGANIZATION


In general terms, computer architecture can be considered as a catalogue of tools or attributes that are
visible to the user such as instruction sets, number of bits used for data, addressing techniques, etc. or
Computer architecture can be defined as a set of rules and methods that describe the functionality,
management and implementation of computers
Computer organization defines the way system is structured so that all those catalogued tools can be
used. Or

It refers to the operational units of the computer and their interconnection that realize the architectural
specification.

15
Why Study Computer Architecture?

1. Enable better systems: make computer faster, cheaper, smaller and more reliable by
exploiting advances and changes in underlying technology.

2. Enable new applications: such as 3D visualisation, virtual reality.

3. Enable better solutions to problems: software innovation is built on trends and changes in
computer architecture.

4. Applications and technology both demand novel architecture.

5. Technology shift: such as memory bottleneck, data intensive applications, security and
privacy issues, power/energy constraints etc.

Computer architecture comprises at least three main subcategories:


• Instruction Set Architecture (ISA): ISA describes the design of a computer in terms of
the basic operations it supports.

• Microarchitecture: It describes the data paths, data processing elements and data storage
elements. It also describes how to implement the ISA.

• System Design: Which includes all of the other hardware components within a
computing system such as:

 System interconnects such as computer buses and switches


 Memory controllers and hierarchies
 CPU off-load mechanisms such as direct memory access (DMA) issues like
multiprocessing.

ISA

An Instruction Set Architecture (ISA) is part of the abstract model of a computer that defines
how the CPU is controlled by the software. The ISA defines the supported data types, the
registers, how the hardware manages main memory, key features (such as virtual memory) of
instructions a microprocessor can execute, and the input/output model of multiple ISA
16
implementations. The ISA can be extended by adding instructions or other capabilities, or by
adding support for larger addresses and data values.

Functions of ISA

 The ISA acts as an interface between the hardware and the software, specifying both what
the processor is capable of doing as well as how it gets done.
 The ISA provides the only way through which a user is able to interact with the hardware.
It can be viewed as a programmer’s manual because it’s the portion of the machine that’s
visible to the assembly language programmer, the compiler writer, and the application
programmer.
 It allocates memory to instructions and also acts upon memory address mode.

Importance of ISA

 Understanding what the instruction set can do and how the compiler makes use of those
instructions can help developers write more efficient code.
 It can also help developers understand the output of the compiler which can be useful for
debugging.

Differences between Computer Architecture and Organization


Computer Architecture Computer Organization

Computer Architecture is concerned with the way Computer Organization is concerned with the
hardware components are connected together to form a structure and behavior of a computer system as
computer system. seen by the user.

It acts as the interface between hardware and software. It deals with the components of a connection in a
system.

It helps us to understand the functionalities of a Computer Organization tells us how exactly all
system. the units in the system are arranged and
interconnected.

17
A programmer can view architecture in terms of Whereas Organization expresses the realization of
instructions, addressing modes and registers. architecture.

While designing a computer system, architecture is An organization is done on the basis of


considered first. architecture.

It deals with high-level design issues. Computer Organization deals with low-level
design issues.

Architecture involves Logic (Instruction sets, Organization involves Physical Components


Addressing modes, Data types, Cache optimization) (Circuit design, Adders, Signals, Peripherals)

Instruction Formats (Zero, One, Two and Three Address Instruction)


An instruction is a command given to the computer to perform specified operation on given data. Each
instruction consists of two parts: an opcode (operation code) and an operand. The first part of an
instruction, which specifies the operation to be performed, is known as opcode. The second part of an
instruction called operand is the data on which computer performs the specified operation.

In computer organization, instruction formats refer to the way instructions are encoded and represented
in machine language. There are several types of instruction formats, including zero, one, two, and three-
address instructions.

Each type of instruction format has its own advantages and disadvantages in terms of code size,
execution time, and flexibility. Modern computer architectures typically use a combination of these
formats to provide a balance between simplicity and power.

Types of Instruction Fields

A computer performs a task based on the instructions provided. Instructions in computers are comprised
of groups called fields. These fields contain different information for computers which are all written in
0s and 1s. Each field has a different significance or meaning. The most common fields are:

 The operation field specifies the operation to be performed, like addition.

 Address field which contains the location of the operand, i.e., register or memory location.

18
 Mode field which specifies how operand is to be founded.

An instruction is of variable length depending upon the number of addresses it contains.

Generally, CPU organization is of three types based on the number of address fields:

 Single Accumulator organization

 General register organization

 Stack organization

In the first organization, the operation is performed using a special register called the accumulator.

In the second, multiple registers are used for the computation purpose.

In the third organization, they work on stack based operation because it does not contain any address
field. We generally see a blend of various organizations applied.

Types of Instructions

Based on the number of addresses, instructions are classified as:

NOTE: We will use the X = (A+B)*(C+D) expression to showcase the procedure.

Zero Address Instructions

These instructions do not specify any operands or addresses. Instead, they operate on data stored in
registers or memory locations implicitly defined by the instruction. For example, a zero-address
instruction might simply add the contents of two registers together without specifying the register
names.

A stack-based computer does not use the address field in the instruction. To evaluate an expression, it
is first converted to reverse Polish Notation i.e. Postfix Notation.

Expression: X =(A+B)*(C+D)
Postfixed: X=AB+CD+*
TOP means top of stack
M[X] is any memory location

19
PUSH A TOP = A

PUSH B TOP = B

ADD TOP = A+B

PUSH C TOP = C

PUSH D TOP = D

ADD TOP = C+D

MUL TOP = (C+D)*(A+B)

POP X M[X] = TOP

One Address Instructions


These instructions specify one operand or address, which typically refers to a memory location or
register. The instruction operates on the contents of that operand, and the result may be stored in the
same or a different location. For example, a one-address instruction might load the contents of a
memory location into a register.
This uses an implied ACCUMULATOR register for data manipulation. One operand is in the
accumulator and the other is in the register or memory location. Implied means that the CPU already
knows that one operand is in the accumulator so there is no need to specify it.

One Address Instruction

Expression: X = (A+B)*(C+D)
AC is accumulator
M[] is any memory location
M[T] is temporary location

20
LOAD A AC = M[A]

ADD B AC = AC + M[B]

STORE T M[T] = AC

LOAD C AC = M[C]

ADD D AC = AC + M[D]

MUL T AC = AC * M[T]

STORE X M[X] = AC

Two Address Instructions


These instructions specify two operands or addresses, which may be memory locations or registers.
The instruction operates on the contents of both operands, and the result may be stored in the same or
a different location. For example, a two-address instruction might add the contents of two registers
together and store the result in one of the registers.
This is common in commercial computers. Here two addresses can be specified in the instruction.
Unlike earlier in one address instruction, the result was stored in the accumulator, here the result can
be stored at different locations rather than just accumulators, but require more number of bit to
represent the address.

Two Address Instruction

Here destination address can also contain an operand.


Expression: X = (A+B)*(C+D)
R1, R2 are registers
M[] is any memory location

21
MOV R1, A R1 = M[A]

ADD R1, B R1 = R1 + M[B]

MOV R2, C R2 = M[C]

ADD R2, D R2 = R2 + M[D]

MUL R1, R2 R1 = R1 * R2

MOV X, R1 M[X] = R1

Three Address Instructions


These instructions specify three operands or addresses, which may be memory locations or registers.
The instruction operates on the contents of all three operands, and the result may be stored in the same
or a different location. For example, a three-address instruction might multiply the contents of two
registers together and add the contents of a third register, storing the result in a fourth register.
This has three address fields to specify a register or a memory location. Programs created are much
short in size but number of bits per instruction increases. These instructions make the creation of the
program much easier but it does not mean that program will run much faster because now instructions
only contain more information but each micro-operation (changing the content of the register, loading
address in the address bus etc.) will be performed in one cycle only.

Three Address Instruction

Expression: X = (A+B)*(C+D)
R1, R2 are registers
M[] is any memory location

ADD R1, A, B R1 = M[A] + M[B]

ADD R2, C, D R2 = M[C] + M[D]

22
ADD R1, A, B R1 = M[A] + M[B]

MUL X, R1, R2 M[X] = R1 * R2

Advantages
Zero-address instructions
 They are simple and can be executed quickly since they do not require any operand fetching or
addressing. They also take up less memory space.
One-address instructions
 They allow for a wide range of addressing modes, making them more flexible than zero-address
instructions. They also require less memory space than two or three-address instructions.
Two-address instructions
 They allow for more complex operations and can be more efficient than one-address instructions
since they allow for two operands to be processed in a single instruction. They also allow for a
wide range of addressing modes.
Three-address instructions
 They allow for even more complex operations and can be more efficient than two-address
instructions since they allow for three operands to be processed in a single instruction. They also
allow for a wide range of addressing modes.

Disadvantages
Zero-address instructions
 They can be limited in their functionality and do not allow for much flexibility in terms of
addressing modes or operand types.
One-address instructions
 They can be slower to execute since they require operand fetching and addressing.
Two-address instructions
 They require more memory space than one-address instructions and can be slower to execute since
they require operand fetching and addressing.
Three-address instructions
 They require even more memory space than two-address instructions and can be slower to execute
since they require operand fetching and addressing.

Overall, the choice of instruction format depends on the specific requirements of the computer
architecture and the trade-offs between code size, execution time, and flexibility.

FUNCTIONAL UNITS OF DIGITAL SYSTEM


Functional units are a part of a CPU that performs the operations and calculations called for by the
computer program.

23
A computer consists of four main components namely, Input unit, Central Processing Unit (which is
made up of Memory unit, Arithmetic & logical unit, Control unit), secondary storage and an Output unit.

A. INPUT UNIT
Input units are used by the computer to read the data. The most commonly used input devices are
keyboards, mouse, joysticks, trackballs, microphones, etc.
However, the most well-known input device is a keyboard. Whenever a key is pressed, the
corresponding letter or digit is automatically translated into its corresponding binary code and
transmitted over a cable to either the memory or the processor.

B. CENTRAL PROCESSING UNIT


Central processing unit commonly known as CPU can be referred as an electronic circuitry within a
computer that carries out the instructions given by a computer program by performing the basic
arithmetic, logical, control and input/output (I/O) operations specified by the instructions. Its
components are Memory Unit, Control Unit, and Arithmetic & Logic Unit.
I. Memory unit

The Memory unit can be referred to as the storage area in which programs are kept which are
running, and that contains data needed by the running programs. It enables a processor to access
running execution applications and services that are temporarily stored in a specific memory
location.

The memory is divided into large number of small parts called cells. Each location or cell has a
unique address, which varies from zero to memory size minus one. For example, if the computer
has 64k words, then this memory unit has 64 * 1024 = 65536 memory locations. The address of
these locations varies from 0 to 65535. The memory unit can be categorized into three namely,
cache, primary memory and secondary memory.

Cache memory
Cache memory is also a kind of memory which is used to fetch the data very fast. It is a very high-speed
semiconductor memory which can speed up the CPU. It acts as a buffer between the CPU and the main
memory. It is used to hold those parts of data and program which are most frequently used by the CPU.
The parts of data and programs are transferred from the disk to cache memory by the operating system,
from where the CPU can access them.
24
Characteristics
 Cache memory is faster than main memory.
 It consumes less access time as compared to main memory.
 It stores programs that can be executed within a short period of time.
 It stores data for temporary use.

Primary Memory
Primary storage is a volatile memory that holds only those data and instructions on which the computer
is currently working on. It contains a large number of semiconductor storage cells, capable of storing a
bit of information. The data and instruction required to be processed resides in the main memory.
Primary memory is divided into two: Random Access Memory (RAM) and Read Only Memory (ROM).
Characteristics
 It has a limited capacity
 It is generally made up of semiconductor devices
 It is a volatile form of memory, means when the computer is shut down, anything contained in
RAM is lost.
 These memories are not as fast as the cache.

Random Access Memory (RAM)


RAM is the internal memory of the CPU for storing data, program and program result. It is a read/write
memory which stores data when the machine is working and as soon as the machine is switched off,
data is erased. Access time in RAM is independent of the address, that is, each storage location inside
the memory is as easy to reach as other locations and takes the same amount of time. RAM is of two
types: Static RAM (SRAM) and dynamic RAM (DRAM).
o Static RAM (SRAM)
The word static indicates that the memory retains its contents as long as power is being supplied.
However, data is lost when the power gets down due to volatile nature. SRAM chips use a matrix of 6-
transistors and no capacitors. Transistors do not require power to prevent leakage, so SRAM need not be
refreshed on a regular basis. There is extra space in the matrix, hence SRAM uses more chips than
DRAM for the same amount of storage space, making the manufacturing costs higher. SRAM is thus
used as cache memory and has very fast access.

25
o Dynamic RAM (DRAM)

DRAM, unlike SRAM must be continually refreshed in order to maintain the data. This is done by
placing the memory on a refresh circuit that rewrites the data several hundred times per second. DRAM
is used for most system memory as it is cheap and small. All DRAMs are made up of memory cells,
which are composed of one capacitor and one transistor.

Read Only Memory (ROM)


ROM is the type of memory from which data can only be read but cannot be written. This type of
memory is non-volatile and the information is stored permanently during manufacture. A ROM stores
instructions that are required to start a computer. This operation is referred to as bootstrap. ROM chips
are not only used in the computer but also in other electronic items like washing machine and
microwave oven. The various types of ROMs and their characteristics are as follows.
o MROM (Masked ROM)

The very first ROMs were hard-wired devices that contained a pre-programmed set of data or
instructions. This kind of ROMs are known as masked ROMs, which are inexpensive.

o PROM (Programmable Read Only Memory)

PROM is read-only memory that can be modified only once by a user. The user buys a blank PROM and
enters the desired contents using a PROM program. Inside the PROM chip, there are small fuses which
are burnt open during programming. It can be programmed only once and is not erasable.

o EPROM (Erasable and Programmable Read Only Memory)

EPROM can be erased by exposing it to ultra-violet light for a duration of up to 40 minutes. Usually, an
EPROM eraser achieves this function. During programming, an electrical charge is trapped in an
insulated gate region. The charge is retained for more than 10 years because the charge has no leakage
path. For erasing this charge, ultra-violet light is passed through a quartz crystal window (lid). This
exposure to ultra-violet light dissipates the charge during normal use, the quartz lid is sealed with a
sticker.

o EEPROM (Electrically Erasable and Programmable Read Only Memory)


26
EEPROM is programmed and erased electrically, it can be erased and reprogrammed about ten
thousand times. Both erasing and programming take about 4 to 10 ms (millisecond) and any location can
be selectively erased and programmed. Hence, the process of reprogramming is flexible but slow.

II. Arithmetic & Logical unit

The ALU is where the CPU performs all the arithmetic and logic operations. Every task that a
computer carries out is completed here, e.g typing into a word processor involves adding binary
digits to the file and then calculating which pixels on the screen should change so that you can
see the characters. The ALU’s operations fall into two parts:
- Arithmetic operations like addition, subtraction, multiplication, division and
- Logical operations like AND, OR, NOT operations.

III. Control unit

The control unit is a component of a computer's central processing unit that coordinates the operation of
the processor. It tells the computer's memory, arithmetic/logic unit and input and output devices how to
respond to a program's instructions. It is also known as the nerve center of a computer system.

C. SECONDARY MEMORY

This type of memory is also known as external memory. It is a non-volatile form of memory. It is slower
than the main memory. These are used for storing data/information permanently and on a long-term
basis. The CPU directly does not access these memories, instead they are accessed via input-output
routines. The contents of secondary memories are first transferred to the main memory and then the
CPU can access it. The most common examples of secondary memory are magnetic disks, magnetic
tapes, and optical disks.

27
D. OUTPUT UNIT

The primary function of the output unit is to send the processed results to the user. Output devices
display information in a way that the user can understand. They are pieces of equipment that are used to
generate information or any other response processed by the computer. The most common example of
an output device is a monitor. Others include the printer, plotter, speakers, etc.

CHARACTERISTICS OF MEMORY DEVICES

The key characteristics of memory devices or memory system are as follows:


1. Location
2. Capacity
3. Unit of Transfer
4. Access Method
5. Performance
6. Physical type
7. Physical characteristics
8. Organization

Location: It deals with the location of the memory device in the computer system. There are three
possible locations:

 CPU: This is often in the form of CPU registers and small amount of cache
 Internal or main: This is the main memory like RAM or ROM. The CPU can directly access
the main memory.

28
 External or Secondary: It comprises of secondary storage devices like hard disks, magnetic
tapes. The CPU does not access these devices directly. It uses device controllers to access
secondary storage devices.
Capacity: The capacity of any memory device is expressed in terms of word size and number of words
 Word size: Words are expressed in bytes (8 bits) and a word can mean any number of bytes.
Commonly used word sizes are 1 byte (8 bits), 2 bytes (16 bits) and 4 bytes (32 bits).

 Number of words: This specifies the number of words available in the particular memory
device. For example, if a memory device is given as 4K x 16. This means the device has a word
size of 16 bits and a total of 4096(4K) words in memory.

Unit of Transfer: It is the maximum number of bits that can be read or written into the memory at a
time. In case of main memory, it is mostly equal to word size. In case of external memory, unit of
transfer is not limited to the word size; it is often larger and is referred to as blocks.

Access Methods: It is a fundamental characteristic of memory devices. It is the sequence or order in


which memory can be accessed. There are three types of access methods:

 Random Access: If storage locations in a particular memory device can be accessed in any order
and access time is independent of the memory location being accessed. Such memory devices are
said to have a random-access mechanism. RAM IC’s use this access method.

 Serial Access: If memory locations can be accessed only in a certain predetermined sequence,
this access method is called serial access. Magnetic Tapes, CD-ROMs employs serial access
methods.

 Semi Random Access: Memory devices such as magnetic hard disks use this access method
were each track has a read/write head thus each track can be accessed randomly but access
within each track is restricted to a serial access.

Performance: The performance of the memory system is determined using three parameters
 Access Time: In random access memories, it is the time taken by memory to complete the
read/write operation from the instant that an address is sent to the memory. For non-random

29
access memories, it is the time taken to position the read write head at the desired location.
Access time is widely used to measure performance of memory devices.

 Memory cycle time: It is defined only for Random Access Memories and is the sum of the
access time and the additional time required before the second access can commence.

 Transfer rate: It is defined as the rate at which data can be transferred into or out of a memory
unit.
Physical type: Memory devices can be either semiconductor memory (like RAM) or magnetic surface
memory (like Hard disks).
Physical Characteristics: Volatile/Non- Volatile: If a memory device continues hold data even if
power is turned off then the memory device is non-volatile else it is volatile.

Organization: Erasable/Non-erasable: The memories in which data once programmed cannot be erased
are called Non-erasable memories. Memory devices in which data in the memory can be erased is called
erasable memory e.g. RAM (erasable), ROM (non-erasable)

MEMORY HIERARCHY
Memory is one of the important units in any computer system. It serves as a storage for all the
processed and the unprocessed data or programs in a computer system. However, due to the fact
that most computer users often stored large amount of files in their computer memory devices,
the use of one memory device in a computer system has become inefficient and unsatisfactory.
This is because only one memory cannot contain all the files needed by the computer users and
when the memory is large, it decreases the speed of the processor and the general performance
of the computer system.

Therefore, to curb this challenges, memory unit must be divided into smaller memories for more
storage, speedy program executions and the enhancement of the processor performance. The
recently accessed files or programs must be placed in the fastest memory since the memory with
large capacity is cheap and slow and the memory with smaller capacity is fast and costly. The

30
organization of smaller memories to hold the recently accessed files or programs closer to the
CPU is termed memory hierarchy. These memories are successively larger as they move away
from the CPU. The hierarchy system encompasses all the storage devices used in a computer
system. It ranges from the cache memory, which is smaller in size but faster in speed to a
relatively auxiliary memory which is larger in size but slower in speed. The smaller the size of
the memory the costlier it becomes.

Picture of Memory Hierarchy Design

The Computer memory hierarchy looks like a pyramid structure which is used to describe the
differences among memory types. It separates the computer storage based on hierarchy.

Level 0: CPU registers


Level 1: Cache memory
Level 2: Main memory or primary memory
Level 3: Magnetic disks or secondary memory
Level 4: Optical disks or magnetic tapes or tertiary Memory
In Memory Hierarchy the cost of memory, capacity is inversely proportional to speed. Here the devices
are arranged in a manner : Fast to slow, that is, from register to Tertiary memory. The levels are
discussed below:
Level-0 − Registers
The registers are present inside the CPU and because they are present inside the CPU, they have least
access time. Registers are most expensive and smallest in size generally in kilobytes. They are used to
store data/instruction in execution and are implemented by using Flip-Flops.

Level-1 − Cache
Cache memory is used to store the segments of a program that are frequently accessed by the processor.
It is expensive and the smallest in size, generally in Megabytes and is implemented by using
static RAM. It is very costly compared to the main memory and the auxiliary memory.
Level-2 − Primary or Main Memory

31
It directly communicates with the CPU and with auxiliary memory devices through an I/O
processor. Main memory is less expensive than cache memory and larger in size generally in Gigabytes.
This memory is implemented by using dynamic RAM. During program execution, the files that are not
currently needed by the CPU are often moved to the auxiliary storage devices in order to create space in
the main memory for the currently needed files to be stored. The main memory is made up of Random
Access Memory (RAM) and Read Only Memory (ROM).
Level-3 − Secondary storage
Secondary storage devices like Magnetic Disks are present at level 3. They are used as backup storage.
They are cheaper than both cache and main memory and larger in size generally in a few TB. They are
relatively slow in speed. They store programs that are not currently needed by the CPU.

Level-4 − Tertiary storage


Tertiary storage devices like magnetic tapes and optical disks are present at level 4. They are used to
store removable files and are the cheapest and largest in size (1-20 TB).

Hardwired Vs. Micro-programmed Control Unit

In a system or computer, most of the tasks are controlled with the help of a processor or CPU (Central
processing unit), which is the main component of a computer. The CPU usually has two main
systems: control unit (CU) and arithmetic and logic unit (ALU). The control unit (CU) is used to
synchronize the tasks with the help of sending timings and control signals. On the other hand,
mathematical and logical operations can be handled with the help of ALU.

Two types of control unit are Micro programmed control units and hardwired control units. Instructions
are executed with the help of these two control units.

In the hardwired control unit, the execution of operations is much faster, but the implementation,
modification, and decoding are difficult. In contrast, implementing, modifying, decoding micro-
programmed control units is very easy. The micro-programmed control unit is also able to handle
complex instructions. With the help of control signals generated by micro-programmed and hardwired
control units, fetching and execution of instructions are done.

Control Signals

In order to generate the control signals, both the control signals were basically designed. The
functionality of a processor's hardware is operated with the help of these control signals. The control
signals are used to know about various types of things, which are described as follows:
32
o Control signals are used to know what operation is going to be performed.
o It is used to know about the sequence of operations that are performed by the processor.
o It is used to know about the timing at which an operation must be executed and many other types
of things.

Hardwired Control Unit

With the help of generating control signals, the hardwired control unit is able to execute the instructions
at a correct time and proper sequence. As compared to the micro-programmed, the hardwired CU is
generally faster. In this CU, the control signals are generated with the help of PLA (programmable Logic
Array) circuit and state counter. Here the Central processing unit requires all these control signals. With
the help of hardware, the hardwired control signals are generated, and it basically uses the circuitry
approach.

The hardwired control unit contains various components in the form of circuitry which will be discussed
one by one so that we can properly understand the "generation of control signals". The components of
the hardwired CU are:

 Instruction register
 Instruction decoder
 Step Counter
 Clock
 Condition Signals
 External input

The Instruction Register is a type of processor register used to contain an instruction that is currently in
execution. The instruction register is used to generate the OP-code bits respective of the operation as
well as the addressing mode of operands.

The above generated Op-code bits are received in the field of an instruction decoder. The instruction
decoder interprets the operation and instruction's addressing mode. Now on the basis of the addressing
mode of instruction and operation which exists in the instruction register, the instruction decoder sets the
corresponding Instruction signal INSi to 1. Some steps are used to execute each instruction,
i.e., instruction fetch, decode, operand fetch, Arithmetic and logical unit, and memory store. In
general, these five steps are used to execute an instruction.

The information about the current step of instruction must be known by the control unit. The Step
Counter is implemented, which is used to contain the signals. For the step counter to know about the

33
current step of instruction, a Clock is implemented. The one-clock cycle of the clock will be completed
for each step.

When the execution in current step is completed, the Counter Enable will "disable" the Step Counter so
that it will stop, then increment to the next step signal.

The Condition Signals is used if the execution of instruction depends on some conditions. There are
various conditions in which the signals are generated with the help of control signals that can be less
than, greater than, less than equal, greater than equal, and many more.

The external input is the last one. It is used to tell the Control Signal Generator about the interrupts,
which will affect the execution of an instruction.

So, on the basis of the input obtained by the conditional signals, step counter, external inputs, and
instruction register, the control signals will be generated with the help of Control signal Generator.

Micro-programmed Control Unit

A micro-programmed control unit can be described as a simple logic circuit, useful it in two ways, i.e., it
is able to execute each instruction with the help of generating control signals, and it is also able to do
sequencing through microinstructions. It will generate the control signals with the help of programs. The
program which is used to create the control signals is known as the "Micro-program". The micro-
program is placed on the processor chip, which is a type of fast memory. This memory is also known as
the control store or control memory.

A micro-program is used to contain a set of microinstructions (or control word) , each of which contains
different bit patterns. The n bit words are contained by each microinstruction. On the basis of the bit
pattern of a control word, every control signals differ from each other.

The instruction execution in a micro-programmed control unit is also performed in steps, as in the
hardwired CU. So for each step, the micro-program contains a control word/ microinstruction. To
execute a particular instruction, a sequence of microinstructions is needed. This process is known as the
micro-routine.

Micro-programmed Control Unit cycle

Instruction fetch is the first step. In this step, the instruction is fetched from the Instruction Register
(IR) with the help of a Microinstruction address register.

34
Decode is the second step. In this step, the instructions obtained from the instruction register will be
decoded with the help of a microinstruction address generator. Here, the starting address of a micro-
routine is obtained, which enables an easy performance of the operation, which is mentioned in the
instruction. It will also load the starting address into the micro-program counter.

Increment is the third step. In this step, the control word, which corresponds to the starting address of a
micro-program, will be read. When the execution proceeds, the value of the micro-program counter will
be increased so that it can read the successive control words of a micro-routine.

End bit is the fourth step. In this step, the microinstruction of a micro-routine contains a bit, which is
known as the end bit. The execution of the microinstruction will be successfully completed when the
end bit is set to 1.

This is the last step, and in this step, the micro-program address generator will again go back to Step
1 so that we can fetch a new instruction, and this process or cycle goes on.

So in the micro-programmed control unit, the micro-programs are stored with the help of Control
memory or Control store. The implementation of this CU is very easy and flexible, but it is slower as
compared to the Hardwired control unit.
Differences Between Hardwired and Microprogrammed Control Unit

35
Advantages of Hardwired Control Unit
The following are the advantages of Hardwired control unit:

 Because of the use of combinational circuits to generate signals, Hardwired CU is


fast.
 It depends on number of gates and how much delay can occur in generation of
control signals.
 It can be optimized to produce the fast mode of operation.
 Faster than micro- programmed control unit.

Disadvantages of Hardwired Control Unit


The following are the disadvantages of Hardwired control unit:

 The complexity of the design increases as it requires more control signals to be


generated (need of more encoders & decoders)
 Modifications in the control signals are very difficult because it requires
rearranging of wires in the hardware circuit.
 Adding a new feature is difficult & complex.
 Difficult to test & correct mistakes in the original design.
 It is Expensive.
36
Advantages of Micro programmed Control Unit
The following are the advantages of microprogrammed control unit:
 It is a more systematic design of the control unit.
 It is simpler to debug and change.
 It can retain the underlying structure of the control function.
 It can make the design of the control unit much simpler. Hence, it is inexpensive and less
error-prone.
 It is an orderly and systematic design process.
 It is used to control functions implemented in software and not hardware.
 It is more flexible.
Disadvantages of Microprogrammed Control Unit
The following are the disadvantages of microprogrammed control unit:
 Adaptability is obtained at more cost.
 It is slower than a hardwired control unit.

REGISTERS

Registers are a type of computer memory used to quickly accept, store, and transfer data and
instructions that are being used immediately by the CPU. The registers used by the CPU are often
termed as processor registers. A processor register may hold an instruction, a storage address, or
any data (such as bit sequence or individual characters).

Some mostly used registers are Accumulator (AC), Program Counter (PC), Memory Address
Register (MAR), Memory Data Register (MDR) and Current Instruction Register (CIR).

i. Accumulator Register (AC): The accumulator register is located inside the ALU,
It is used during arithmetic & logical operations of ALU.

ii. Program Counter (PC): Program counter register is also known as Instruction
Pointer (IP) register. This register stores the address of the next instruction to be
fetched for execution. When the instruction is fetched, the value of IP is
incremented. Thus this register always points or holds the address of next
instruction to be fetched.
37
iii. Memory Address Register (MAR): This register holds the address of memory
where CPU wants to read or write data. When CPU wants to store some data in the
memory or reads the data from the memory, it places the address of the required
memory location in the MAR.

iv. Memory Data Register (MDR): MDR is the register of a control unit that contains
the data to be stored in the computer storage (e.g. RAM) or the data after a fetch
from the computer storage. It acts like a buffer and holds anything that is copied
from the memory ready for the processor to use it.

v. Current Instruction Register (CIR): The Instruction Register (IR) or Current

Instruction Register (CIR) is the part of a CPU's control unit that holds the
instruction currently being executed or decoded. In simple processors, each
instruction to be executed is loaded into the instruction register, which holds it while
it is decoded, prepared and ultimately executed.

Others include data register, address register, input and output registers, etc.

RISC and CISC


RISC and CISC are two different types of computer architectures that are used to design the
microprocessors that are found in computers. The fundamental difference between RISC and CISC is
that RISC (Reduced Instruction Set Computer) includes simple instructions and takes one cycle,
while the CISC (Complex Instruction Set Computer) includes complex instructions and takes
multiple cycles.

RISC
In the RISC architecture, the instruction set of the computer system is simplified to reduce the
execution time. It has a small set of instructions that generally includes register-to-register operations.
The RISC architecture uses comparatively a simple instruction format that is easy to decode. The
instruction length can be fixed and aligned to word boundaries. RISC processors can execute only one
instruction per clock cycle.

38
The following are some important characteristics of a RISC Processor −

 A RISC processor has a few instructions.


 RISC processor has a few addressing modes.
 In the RISC processor, all operations are performed within the registers of the CPU.
 RISC processor can be of fixed-length.
 RISC can be hardwired rather than micro-programmed control.
 RISC is used for single-cycle instruction execution.
 RISC processor has easily decodable instruction format.

RISC architectures are characterized by a small, simple instruction set and a highly efficient execution
pipeline. This allows RISC processors to execute instructions quickly, but it also means that they can
only perform a limited number of tasks.

CISC

The CISC architecture comprises a complex instruction set. A CISC processor has a variable-length
instruction format. In this processor architecture, the instructions that require register operands can take
only two bytes. In a CISC processor architecture, the instructions which require two memory addresses
can take five bytes to comprise the complete instruction code. Therefore, in a CISC processor, the
execution of instructions may take a varying number of clock cycles. The CISC processor also provides
direct manipulation of operands that are stored in the memory.

The following are the important characteristics of a CISC processor architecture −

 CISC can have variable-length instruction formats.


 It supports a set of a large number of instructions, typically from 100 to 250 instructions.
 It has a large variety of addressing modes, typically from 5 to 20 different modes.
 CISC has some instructions which perform specialized tasks and are used infrequently.

CISC architectures have a large, complex instruction set and a less efficient execution pipeline. This
allows CISC processors to perform a wider range of tasks, but they are not as fast as RISC processors
when executing instructions.

Difference between RISC and CISC

The important differences between RISC and CISC architectures are highlighted below:

39
S.No Attribute RISC CISC
.

Name It stands for Reduced It stands for Complex Instruction Set


1.
Instruction Set Computer. Computer.

Instruction It is a microprocessor It offers hundreds of instructions of different


set architecture that uses small sizes to the users.
2.
instruction set of uniform
length.

Clock cycle These simple instructions This architecture has a set of special purpose
3. are executed in one clock circuits which help execute the instructions at
cycle. a high speed.

Ease of These chips are relatively These chips are complex to design.
4.
design simple to design.

5. Cost They are inexpensive. They are relatively expensive.

Examples Examples of RISC chips Examples of CISC include Intel architecture,


6. include SPARC, POWER AMD.
PC.

Number of It has less number of It has more number of instructions.


7.
instructions instructions.

Encodings It has fixed-length It has variable-length encodings for


8.
encodings for instructions. instructions.

Addressing Simple addressing formats The instructions interact with memory using
9.
format/mode are supported. complex addressing modes.

Array It doesn't support arrays. It has a large number of instructions. It


10.
supports arrays.

Condition It doesn't use condition Condition codes are used.


11.
code codes.
40
Arguments Registers are used for The stack is used for procedure arguments and
12. and procedure arguments and return addresses.
addresses return addresses.

FAULT TOLERANCE COMPUTING

Fault tolerance refers to the property that enables the system to continue to function correctly even when
some of its components fail. In other words, fault tolerance means how an operating system (OS)
responds and allows hardware or software malfunctions and fails. The ability of OS to recover and
tolerate faults can be handled through software, hardware, or a combination solution that leverages load
balancers. Some computer systems use multiple duplicate fault tolerance systems to handle faults
gracefully, which is called a fault-tolerant network. Fault-tolerant systems use backup components that
automatically replace failed components to ensure that no break occurs in service.

LOGIC GATES
Logic gates are the main structural part of a digital system. They are a block of hardware that produces
signals of binary 1 or 0 when input logic requirements are satisfied. Each gate has a distinct graphic
symbol, and its operation can be described by means of algebraic expressions.
The seven basic logic gates includes: AND, OR, XOR, NOT, NAND, NOR, and XNOR. A truth table
can be used to represent the relationship between the input-output binary variables for each gate. This
can be done in a tabular form. Each gate has one or two binary input variables designated by A and B
and one binary output variable designated by x.

AND GATE:

The AND gate is an electronic circuit which gives a high output only if all its inputs are high. The AND
operation is represented by a dot (.) sign.

41
OR GATE:

The OR gate is an electronic circuit which gives a high output if one or more of its inputs are high. The
operation performed by an OR gate is represented by a plus (+) sign.

NOT GATE:

The NOT gate is an electronic circuit which produces an inverted version of the input at its output. It is
also known as an Inverter.

NAND GATE:
The NOT-AND (NAND) gate which is equal to an AND gate followed by a NOT gate. The NAND gate
gives a high output if any of the inputs are low. The NAND gate is represented by a AND gate with a
small circle on the output. The small circle represents inversion.

NOR GATE:

42
The NOT-OR (NOR) gate which is equal to an OR gate followed by a NOT gate. The NOR gate gives a
low output if any of the inputs are high. The NOR gate is represented by an OR gate with a small circle
on the output. The small circle represents inversion.

Exclusive-OR/ XOR GATE:


The 'Exclusive-OR' gate is a circuit which will give a high output if one of its inputs is high but not both
of them. The XOR operation is represented by an encircled plus sign.

EXCLUSIVE-NOR/Equivalence GATE:
The 'Exclusive-NOR' gate is a circuit that does the inverse operation to the XOR gate. It will give a low
output if one of its inputs is high but not both of them. The small circle represents inversion.

Boolean algebra

Boolean algebra can be considered as an algebra that deals with binary variables and logic operations.
Boolean algebraic variables are designated by letters such as A, B, x, and y. The basic operations
performed are AND, OR, and complement.

43
The Boolean algebraic functions are mostly expressed with binary variables, logic operation symbols,
parentheses, and equal sign. For a given value of variables, the Boolean function can be either 1 or 0.
For instance, consider the Boolean function:

F = x + y'z

The logic diagram for the Boolean function F = x + y'z can be represented as:

The Boolean function F = x + y'z is transformed from an algebraic expression into a logic diagram
composed of AND, OR, and inverter gates.

o Inverter at input 'y' generates its complement y'.


o There is an AND gate for the term y'z, and an OR gate is used to combine the two terms (x and
y'z).
o The variables of the function are taken to be the inputs of the circuit, and the variable symbol of
the function is taken as the output of the circuit.

A truth table can represent the relationship between a function and its binary variables. To
represent a function in a truth table, we need a list of the 2^n combinations of n binary variables.

The truth table for the Boolean function F = x + y'z can be represented as:

44
Examples of Boolean algebra simplifications
using logic gates
In this section, we will look at some of the examples of Boolean algebra
simplification using Logic gates.

1. F1 = xyz'

2. F2 = x + y'z

3. F3 = xy' + x'z

4. F4 = x'y'z + x'yz + xy'

45
Truth tables for F1= xyz', F2= x+y'z, F3= xy'+x'z and F4= x'y'z+x'yz+xy'

x y z F1 F2 F3 F4

0 0 0 0 0 0 0

0 0 1 0 1 1 1

0 1 0 0 0 0 0

0 1 1 0 0 1 1

1 0 0 0 1 1 1

1 0 1 0 1 1 1

Map 1 1 0 1 1 0 0

1 1 1 0 1 0 0

Simplification
The Map method involves a simple, straightforward procedure for simplifying Boolean expressions.
Map simplification may be regarded as a pictorial arrangement of the truth table which allows an easy
interpretation for choosing the minimum number of terms needed to express the function algebraically.
The map method is also known as Karnaugh map or K-map.
46
Each combination of the variables in a truth table is called a min-term. When expressed in a truth
table a function of n variables will have 2^n min-terms, equivalent to the 2^n binary numbers
obtained from n bits.

There are four min-terms in a two variable map. Therefore, the map consists of four squares, one for
each min-term. The 0's and 1's marked for each row, and each column designates the values of variable
x and y, respectively.

Two-variable map:

Representation of functions in the two-variable map:

Three variable map

There are eight min-terms in a three-variable map. Therefore, the map consists of eight squares.

Three variable map:

47
o The map drawn in part (b) in the above image is marked with numbers in each row and each
column to show the relationship between the squares and the three variables.
o Any two adjacent squares in the map differ by only one variable, which is primed in one square
and unprimed in the other. For example, m5 and m7 lie in the two adjacent squares. Variable y is
primed in m5 and unprimed in m7, whereas the other two variables are the same in both the
squares.
o From the postulates of Boolean algebra, it follows that the sum of two min-terms in adjacent
squares can be simplified to a single AND term consisting of only two literals. For example,
consider the sum of two adjacent squares say m5 and m7:
m5+m7 = xy'z+xyz= xz(y'+y)= xz.

Examples of Boolean algebra simplifications using the map method

1. F(x,y,z) = Σ (2,3,4,5)

First, 1 is marked in each min-term that represents the function. Hence, 010, 011, 100, 101 are marked
with 1's.

Subsequently, we have to find possible adjacent squares. These are indicated in the map by two
rectangles, each enclosing two 1's.

48
The upper right rectangle represents the area enclosed by x'y. The lower left rectangle represents the
product term xy'.

The sum of these two terms gives the simplified expression:

F= x'y+ xy'

There are cases where two squares in the map are considered to be adjacent even though they do
not touch each other. In the figure below, m0 is adjacent to m2 and m4 is adjacent to m6 because
the min-terms differ by one variable.

Algebraically verification:

m0+m2 = x'y'z'+ x'yz'= x'z'(y'+y) = x'z'

m4+m6 = xy'z' + xyz'= xz' + (y'+y) = xz'

2. F(x,y,z) = Σ(3,4,6,7)

49
As you can see, there are four squares marked with 1's, one for each min-term of the function.

The other two adjacent squares are combined in the third column to give a two-literal term yz.

The remaining two squares with 1's are shown in the above diagram with their values enclosed in half
rectangles. When these two half rectangles are combined, it yields two literal term xz'.

The simplified function becomes F= yz+xz'.

50

You might also like