CO Notes All Units
CO Notes All Units
1.DIGITAL COMPUTERS:
The first electronic digital computer was developed in the late 1940s and was used
primarily for numerical computations.
By convention, the digital computers use the binary number system, which has two
digits: 0 and 1. A binary digit is called a bit.
A computer system is subdivided into two functional entities: Hardware and Software.
The hardware consists of all the electronic components and electromechanical devices
that comprise the physical entity of the device.
The software of the computer consists of the instructions and data that the computer
manipulates to perform various data-processing tasks.
The Central Processing Unit (CPU) contains an arithmetic and logic unit for
manipulating data, a number of registers for storing data, and a control
circuit for fetching and executing instructions.
The memory unit of a digital computer contains storage for instructions and
data.
The Random Access Memory (RAM) for real-time processing of the data.
The Input-Output devices for generating inputs from the user and displaying
the final results to the user.
The Input-Output devices connected to the computer include the keyboard,
mouse, terminals, magnetic disk drives, and other communication devices.
*****
2.LOGIC GATES:
The logic gates are the main structural part of a digital system.
Logic Gates 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.
The relationship between the input-output binary variables for each gate can
be represented in tabular form by a truth table.
Each gate has one or two binary input variables designated by A and B and
one binary output variable designated by x.
(i)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.
(ii)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.
(iii)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.
(iv)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.
(v)NOR GATE: 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.
(vi)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.
*****
3.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.
The logic diagram for the Boolean function F = x + y'z can be represented as:
The truth table for the Boolean function F = x + y'z can be represented as:
Examples of Boolean algebra simplifications using logic gates:
1.F1 = xyz'
2. F2 = x + y'z
3. F3 = xy' + x'z
OR operator → A + B = B + A
AND operator → A * B = B * A
Associative Law of multiplication states that the AND operation are done on
two or more than two variables. For example:
A * (B * C) = (A * B) * C
Distributive Law states that the multiplication of two variables and adding the
result with a variable will result in the same value as multiplication of addition
of the variable with individual variables. For example:
A + BC = (A + B) (A + C).
Annulment law:
A.0 = 0
A+1=1
Identity law:
A.1 = A
A+0=A
Idempotent law:
A+A=A
A.A = A
Complement law:
A + A' = 1
A.A'= 0
Double negation law:
((A)')' = A
Absorption law:
A.(A+B) = A
A + AB = A
1."The negation of a conjunction is the disjunction of the negations", which means that
the complement of the product of 2 variables is equal to the sum of the compliments of
individual variables. For example, (A.B)' = A' + B'.
2."The negation of disjunction is the conjunction of the negations", which means that
compliment of the sum of two variables is equal to the product of the complement of
each variable. For example, (A + B)' = A'B'.
The logic diagram for the Boolean function AB+A (B+C) + B (B+C) can be
represented as:
We will simplify this Boolean function on the basis of rules given by Boolean algebra.
AB + A (B+C) + B (B+C)
AB + AB + AC + B + BC {Idempotent law; BB = B}
*****
4.Map 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.
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:
The map was 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.
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.
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.
1. F(x,y,z) = Σ (2,3,4,5)
F= x'y+ xy'
Algebraically verification:
2. F(x,y,z) = Σ(3,4,6,7)
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'.
*****
5.Combinational Circuits:
A combinational circuit comprises of logic gates whose outputs at any
time are determined directly from the present combination of inputs without any
regard to previous inputs.
The 'n' input variables come from an external source whereas the 'm'
output variables go to an external destination. In many applications, the source or
destination are storage registers.
Half – Adder:
A Half-adder circuit needs two binary inputs and two binary outputs. The input
variable shows the augend and addend bits whereas the output variable produces the
sum and carry. We can understand the function of a half-adder by formulating a truth
table. The truth table for a half-adder is:
'x' and 'y' are the two inputs, and S (Sum) and C (Carry) are the two outputs.
The Carry output is '0' unless both the inputs are 1.
'S' represents the least significant bit of the sum.
S = x'y+xy', C = xy
Full – Adder:
This circuit needs three binary inputs and two binary outputs. The
truth table for a full-adder is:
Two of the input variable 'x' and 'y', represent the two significant bits to be
added.
The third input variable 'z', represents the carry from the previous lower
significant position.
The outputs are designated by the symbol 'S' for sum and 'C' for carry.
The eight rows under the input variables designate all possible combinations of
0's, and 1's that these variables may have.
The input-output logical relationship of the full-adder circuit may be expressed
in two Boolean functions, one for each output variable.
Each output Boolean function can be simplified by using a unique map method.
*****
The design of these flip flops also includes two inputs, called the SET [S] and RESET
[R]. There are also two outputs, Q and Q'.
Clocked S-R Flip-Flop: The operation of a basic flip-flop can be modified by providing an
additional control input that determines when the state of the circuit is to be changed.
The limitation with a S-R flip-flop using NOR and NAND gate is the invalid
state. This problem can be overcome by using a stable SR flip-flop that can change
outputs when certain invalid states are met, regardless of the condition of either the Set
or the Reset inputs.
A clock pulse is given to the inputs of the AND Gate. If the value of
the clock pulse is '0', the outputs of both the AND Gates remain '0'.
From the above figure, you can see that the D input is connected to the S input and the
complement of the D input is connected to the R input.
When the value of CP is '1' (HIGH), the flip-flop moves to the SET state if it is '0'
(LOW), the flip-flop switches to the CLEAR state.
J-K Flip-flop: J-K flip-flop can be considered as a modification of the S-R flip-flop.
The main difference is that the intermediate state is more refined and precise than that
of an S-R flip-flop.
The characteristics of inputs 'J' and 'K' is same as the 'S' and 'R' inputs of the S-R flip-
flop.
When both the inputs J and K have a HIGH state, the flip-flop switches to the
complement state, so, for a value of Q = 1, it switches to Q=0, and for a value of Q =
0, it switches to Q=1.
T Flip-Flop: T flip-flop is a much simpler version of the J-K flip-flop.
Both the J and K inputs are connected and are also called as a single input J-K Flip-
flop.
A pulse start from the initial value of '0', goes momentarily to '1', and after a short
while, returns to its initial '0' value.
A positive clock source remains at '0' during the interval between pulses and goes to
1 during the occurrence of a pulse.
The pulse goes through two signal transition: from '0' to '1' and return from '1' to '0'.
*****
DIGITAL COMPONENTS
1.INTEGRATED CIRCUITS:
Digital circuits are constructed with integrated circuits. An integrated circuit
(abbreviated IC) is a small silicon semiconductor crystal called a chip
containing the electronic components for the digital gates.
The various gates are interconnected inside the chip to form the required
circuit.
TTL is a widespread logic family that has been in operation for many years
and is considered as standard. ECL has an advantage in systems requiring high-
speed operation. MOS is suitable for circuits that need high component density,
and CMOS is preferable in systems requiring low power consumption.
*****
2.Decoders:
Discrete quantities of information are represented in digital computers with
binary codes. A binary code of n bits is capable of representing up to 2n distinct
elements of the coded information.
A decoder is a combinational circuit that converts binary information from the
n coded inputs to a maximum of 2n unique outputs.
If the n-bit coded information has unused bit combinations, the decoder may
have less than 2n outputs.
The decoders presented in this section are called n-to-m-line decoders, where
m ≤ 2n. Their purpose is to generate the 2n (or fewer) binary combinations of the
n input variables. A decoder has n inputs and m outputs and is also referred to
as an n x m decoder.
The logic diagram of a 3-to-8-line decoder is shown in Fig. below The three
data inputs, A0, A1 and A2, are decoded into eight outputs, each output.
representing one of the combinations of the three binary input variables. The
three inverters provide the complement of the inputs, and each of the eight AND
gates generates one of the binary combination.
When the circuit is disabled, none of the outputs are selected and all outputs
are equal to 1.
In general, a decoder may operate with complemented or uncomplemented
outputs. The enable input may be activated with a 0 or with a 1 signal level.
Some decoders have two or more enable inputs that must satisfy a given logic
condition in order to enable the circuit.
Encoders:
An encoder is a digital circuit that performs the inverse operation of a
decoder.
An encoder has 2n (or less) input lines and n output lines. The output lines
generate the binary code corresponding to the input value. An example of an
encoder is the octal-to-binary encoder, whose truth table is given in Table
below.
It has eight inputs, one for each of the octal digits, and three outputs that
generate the corresponding binary number. It is assumed that only one input
has a value of 1 at any given time; otherwise, the circuit has no meaning.
3.Multiplexers:
A multiplexer is a combinational circuit that receives binary information
from one of 2n input data lines and directs it to a single output line.
The selection of a particular input data line for the output is determined
by a set of selection inputs.
A 2n-to-1 multiplexer has 2n input data lines and n input selection lines
whose bit combinations determine which input data are selected for the
output.
A 4-to-1-line multiplexer is shown in Fig. below. Each of the four data
inputs I0 through I3 is applied to one input of an AND gate. The two
selection inputs S1 and S0 are decoded to select a particular AND gate. The
outputs of the AND gates are applied to a single OR gate to provide the
single output.
To demonstrate the circuit operation, consider the case when S1S0 = 10.
The AND gate associated with input I2 has two of its inputs equal to 1. The
third input of the gate is connected to I2 The other three AND gates have at
least one input equal to 0, which makes their outputs equal to 0.
The OR gate output is now equal to the value of I2, thus providing a path
from the selected input to the output. The 4-to-1 line multiplexer of Fig.
below has six inputs and one output.
A truth table describing the circuit needs 64 rows since six input variables
can have 26 binary combinations. This is an excessively long table and will
not be shown here.
A more convenient way to describe the operation of multiplexers is by
means of a function table. The function table for the multiplexer is shown in
Table below. The table demonstrates the relationship between the four data
inputs and the single output as a function of the selection inputs S1 and S0.
When the selection inputs are equal to 00, output Y is equal to input I0
When the selection inputs are equal to 01, input I1 has a path to output Y,
and similarly for the other two combinations.
The multiplexer is also called a data selector, since it selects one of many
data inputs and steers the binary information to the output.
*****
4.Registers:
A register is a group of flip-flops with each flip-flop capable of storing one bit
of information.
An n-bit register has a group of n flip-flops and is capable of storing any
binary information of n bits. In addition to the flip-flops, a register may have
combinational gates that perform certain data-processing tasks.
In its broadest definition, a register consists of a group of flip-flops and gates
that effect their transition. The flip-flops hold the binary information and the
gates control when and how new information is transferred into the register.
Various types of registers are available commercially. The simplest register is
one that consists only of flip-flops, with no external gates. Figure below shows
such a register constructed with four D flip-flops.
The common clock input triggers all flip-flops on the rising edge of each
pulse, and the binary data available at the four inputs are transferred into the 4-
bit register. The four outputs can be sampled at any time to obtain the binary
information stored in the register.
The clear input goes to a special terminal in each flip-flop. When this input
goes to 0, all flip-flops are reset asynchronously. The clear input is useful for
clearing the register to all 0's prior to its clocked operation.
The clear input must be maintained at logic 1 during normal clocked
operation. Note that the clock signal enables the D input but that the clear. input
is independent of the clock.
The transfer of new information into a register is referred to as loading the
register.
If all the bits of the register are loaded simultaneously with a common clock
pulse transition, we say that the loading is done in parallel.
A clock transition applied to the C inputs of the register of Fig. above will
load all four inputs I0 through I3 in parallel.
In this configuration, the clock must be inhibited from the circuit if the content
of the register must be left unchanged.
*****
5.Shift Registers:
A register capable of shifting its binary information in one or both directions is
called a shift register.
The logical configuration of a shift register consists of a chain of flip-flops in
cascade, with the output of one flip-flop connected to the input of the next flip-
flop.
All flip-flops receive common clock pulses that initiate the shift from one stage
to the next.
The simplest possible shift register is one that uses only flip-flops, as shown
in Fig. below. The output of a given flip-flop is connected to the D input of the
flip-flop at its right.
The clock is common to all flip-flops. The serial input determines what goes
into the leftmost position during the shift. The serial output is taken from the
output of the rightmost flip-flop.
Sometimes it is necessary to control the shift so that it occurs with certain
clock pulses but not with others. This can be done by inhibiting the clock from
the input of the register if we do not want it to shift. When the shift register of
Fig below is used, the shift can be controlled by connecting the clock to the
input of an AND gate, and a second input of the AND gate can then control the
shift by inhibiting the clock.
However, it is also possible to provide extra circuits to control the shift operation
through the D inputs of the flip-flops rather than the clock input.
6.Binary Counters
A register that goes through a predetermined sequence of states upon the
application of input pulses is called a counter.
The input pulses may be clock pulses or may originate from an external
source. They may occur at uniform intervals of time or at random.
Counters are found in almost all equipment containing digital logic. They
are used for counting the number of occurrences of an event and are useful for
generating timing signals to control the sequence of operations in digital
computers.
Of the various sequences a counter may follow, the straight binary sequence
is the simplest and most straightforward. A counter that follows the binary
number sequence is called a binary counter. An n-bit binary counter is a register
of n flip-flops and associated gates that follows a sequence of states according
to the binary count of n bits, from 0 to 2n - 1.
A counter circuit will usually employ flip-flops with complementing
capabilities. Both T and JK flip-flops have this property. Remember that a JK
flip-flop is complemented if both its J and K inputs are 1 and the clock goes
through a positive transition. The output of the flip-flop does not change if J = K
= 0.
Synchronous binary counters have a regular pattern, as can be seen from the
4-bit binary counter shown in Fig. below. The C inputs of all flip-flops receive
the common clock.
If the count enable is 0, all J and K inputs are maintained
The first stage A0 is complemented when the counter is enabled and the
clock goes through a positive transition. Each of the other three flip-flops are
complemented when all previous least significant flip-flops are equal to 1 and
the count is enabled.
The chain of AND gates generate the required logic for the J and K inputs. The
output carry can be used to extend the counter to more stages, with each stage
having an additional flip-flop and an AND gate.
*****
7.Memory Unit:
A memory unit is a collection of storage cells together with associated circuits
needed to transfer information in and out of storage.
The memory stores binary information in groups of bits called words. A
word in memory is an entity of bits that move in and out of storage as a unit.
A memory word is a group of 1's and 0's and may represent a number, an
instruction code, one or more alphanumeric characters, or any other binary-
coded information.
A group of byte eight bits is called a byte. Most computer memories use
words whose number of bits is a multiple of 8. Thus a 16-bit word contains two
bytes, and a 32-bit word is made up of four bytes. The capacity of memories in
commercial computers is usually stated as the total number of bytes that can be
stored.
Two major types of memories are used in computer systems: random access
memory (RAM) and read-only memory (ROM).
Random-Access Memory
In random-access memory (RAM) the memory cells can be accessed for
information transfer from any desired random location.
That is, the process of locating a word in memory is the same and requires an
equal amount of time no matter where the cells are located physically in
memory: thus the name "random access."
The two operations that a random-access memory can perform are the write
and read operations.
The write signal specifies a transfer-in operation and the read signal specifies a
transfer-out operation. On accepting one of these control signals, the internal
circuits inside the memory provide the desired function.
The memory unit will then take the bits presently available in the input data
lines and store them in the word specified by the address lines. The steps that
must be taken for the purpose of transferring a stored word out of memory are
as follows:
The memory unit will then take the bits from the word that has been selected
by the address and apply them into the output data lines. The content of the
selected word does not change after reading.
Read-Only Memory:
As the name implies, a read-only memory (ROM) is a memory unit that
performs the read operation only; it does not have a write capability.
This implies that the binary information stored in a ROM is made permanent
during the hardware production of the unit and cannot be altered by writing
different words into it.
Whereas a RAM is a general-purpose device whose contents can be altered
during the computational process, a ROM is restricted to reading words that are
permanently stored within the unit.
The binary information to be stored, specified by the designer, is then
embedded in the unit to form the reqttired interconnection pattern.
*****
UNIT-II
DATA REPRESENTATION
1.DATA TYPES:
Computer programs or application may use different types of data based
on the problem or requirement.
*****
2.COMPLEMENTS:
Complements are used in the digital computers in order to simplify the
subtraction operation and for the logical manipulations. For each radix-r system
(radix r represents base of number system) there are two types of complements.
As the binary system has base r = 2. So the two types of complements for the
binary system are 2's complement and 1's complement.
1's complement
The 1's complement of a number is found by changing all 1's to 0's and all
0's to 1's. This is called as taking complement or 1's complement. Example of 1's
Complement is as follows.
2's complement
The 2's complement of binary number is obtained by adding 1 to the Least Significant
Bit (LSB) of 1's complement of the number.
2's complement = 1's complement + 1
Example of 2's Complement is as follows.
*****
3.FIXED-POINT REPRESENTATION:
Digital Computers use Binary number system to represent all types
of information inside the computers. Alphanumeric characters are represented using
binary bits (i.e., 0 and 1). Digital representations are easier to design, storage is easy,
accuracy and precision are greater.
There are various types of number representation techniques for
digital number representation, for example: Binary number system, octal number
system, decimal number system, and hexadecimal number system etc. But Binary
number system is most relevant and popular for representing numbers in digital
computer system.
There are two major approaches to store real numbers (i.e., numbers
with fractional component) in modern computing. These are (i) Fixed Point Notation
and (ii) Floating Point Notation. In fixed point notation, there are a fixed number of
digits after the decimal point, whereas floating point number allows for a varying
number of digits after the decimal point.
Fixed-Point Representation:
This representation has fixed number of bits for integer part and for
fractional part. For example, if given fixed-point representation is IIII.FFFF, then you
can store minimum value is 0000.0001 and maximum value is 9999.9999. There are
three parts of a fixed-point number representation: the sign field, integer field, and
fractional field.
These are above smallest positive number and largest positive number
which can be store in 32-bit representation as given above format. Therefore, the
smallest positive number is 2-16≈ 0.000015 approximate and the largest positive
number is (215-1)+(1-2-16)=215(1-2-16) =32768, and gap between these numbers is 2-16.
We can move the radix point either left or right with the help of only integer
field is 1.
*****
4.FLOATING-POINT REPRESENTATION:
This representation does not reserve a specific number of bits for
the integer part or the fractional part. Instead it reserves a certain number of bits for
the number (called the mantissa or significand) and a certain number of bits to say
where within that number the decimal place sits (called the exponent).
The floating number representation of a number has two part: the first
part represents a signed fixed point number called mantissa. The second part of
designates the position of the decimal (or binary) point and is called the exponent. The
fixed point mantissa may be fraction or an integer. Floating -point is always
interpreted to represent a number in the following form: Mxre.
Only the mantissa m and the exponent e are physically represented in
the register (including their sign). A floating-point binary number is represented in a
similar manner except that is uses base 2 for the exponent. A floating-point number is
said to be normalized if the most significant digit of the mantissa is 1.
So, actual number is (-1)s(1+m)x2(e-Bias), where s is the sign bit, m is the mantissa, e is
the exponent value, and Bias is the bias number.
The floating point representation is more flexible. Any non-zero
number can be represented in the normalized form of ±(1.b1b2b3 ...)2x2n .This is
normalized form of a number x.
Example −Suppose number is using 32-bit format: the 1 bit sign bit, 8 bits for signed
exponent, and 23 bits for the fractional part. The leading bit 1 is not stored (as it is
always 1 for a normalized number) and is referred to as a “hidden bit”.
Then −53.5 is normalized as -53.5=(-110101.1)2=(-
1.101011)x25 , which is represented as following below,
*****
REGISTER TRANSFER & MICRO OPERATIONS
1.Register transfer language:
In symbolic notation, it is used to describe the micro-operations transfer
among registers. It is a kind of intermediate representation (IR) that is very close to
assembly language, such as that which is used in a compiler.The term “Register
Transfer” can perform micro-operations and transfer the result of operation to the
same or other register.
Micro-operations : The operation executed on the data store in registers are called
micro-operations. They are detailed low-level instructions used in some designs to
implement complex machine instructions.
Register Transfer: The information transformed from one register to another
register is represented in symbolic form by replacement operator is called Register
Transfer.
Replacement Operator : In the statement, R2 <- R1, <- acts as a replacement
operator. This statement defines the transfer of content of register R1 into register
R2.
There are various methods of RTL –
1. General way of representing a register is by the name of the register inclosed in a
rectangular box as shown in (a).
3. The numbering of bits in a register can be marked on the top of the box as shown
in (c).
4. A 16-bit register PC is divided into 2 parts- Bits (0 to 7) are assigned with lower
byte of 16-bit address and bits (8 to 15) are assigned with higher bytes of 16-bit
address as shown in (d).
R1(8-bit)
R1(0-7)
() Denotes a part of register
R1 <- R2
R2 <- R1
Specify two micro-operations of Register
, Transfer
P : R2 <- R1
if P=1
: Denotes conditional operations
If the control function P=1, then load the content of R1 into R2 and at the same clock
load the content of R2 into R1.
*****
2.Register Transfer:
Information transferred from one register to another is designated in symbolic
form by means of replacement operator.
R2 ← R1
Normally we want the transfer to occur only in predetermined control condition. This
can be shown by following if-then statement: if (P=1) then (R2 ← R1)
Here P is a control signal generated in the control section.
P: R2 ← R1
The control condition is terminated with a colon. It shows that transfer operation can
be executed only if P=1.
Types of Micro-Operations:
The micro-operations in digital computers are of 4 types:
R3 → R1 + R2
The above statement instructs the data or contents of register R1 to be added to data or
content of register R2 and the sum should be transferred to register R3.
R3 → R1 + R2' + 1
In subtract micro-operation, instead of using minus operator we take 1's
compliment and add 1 to the register which gets subtracted, i.e R1 - R2 is equivalent
to R3 → R1 + R2' + 1
R1 → R1 + 1
R1 → R1 – 1
P: R1 ← R1 X-OR R2
Assume that each register has 3 bits. Let the content of R1 be 010 and R2 be 100. The
X-OR micro-operation will be:
Shift Micro-Operations: These are used for serial transfer of data. That means we
can shift the contents of the register to the left or right. In the shift left operation
the serial input transfers a bit to the right most position and in shift
right operation the serial input transfers a bit to the left most position.
There are three types of shifts as follows:
a) Logical Shift: It transfers 0 through the serial input. The symbol "shl" is used for
logical shift left and "shr" is used for logical shift right.
R1 ← she R1
R1 ← she R1
b) Circular Shift: This circulates or rotates the bits of register around the two ends
without any loss of data or contents. In this, the serial output of the shift register is
connected to its serial input. "cil" and "cir" is used for circular shift left and right
respectively.
c) Arithmetic Shift: This shifts a signed binary number to left or right. An arithmetic
shift left multiplies a signed binary number by 2 and shift left divides the number by
2. Arithmetic shift micro-operation leaves the sign bit unchanged because the signed
number remains same when it is multiplied or divided by 2.
Arithmetic logical unit: Instead of having individual registers performing the micro-
operations, computer system provides a number of registers connected to a common
unit called as Arithmetic Logical Unit (ALU). ALU is the main and one of the most
important unit inisde CPU of computer. All the logical and mathematical operations of
computer are performed here. The contents of specific register is placed in the in the
input of ALU. ALU performs the given operation and then transfer it to the destination
register.
*****
A bus consists of a set of common lines, one for each bit of register, through
which binary information is transferred one at a time. Control signals determine which
register is selected by the bus during a particular register transfer.
The following block diagram shows a Bus system for four registers. It is
constructed with the help of four 4 * 1 Multiplexers each having four data inputs (0
through 3) and two selection inputs (S1 and S2).
We have used labels to make it more convenient for you to understand the
input-output configuration of a Bus system for four registers. For instance, output 1 of
register A is connected to input 0 of MUX1.
The two selection lines S1 and S2 are connected to the selection inputs of all
four multiplexers. The selection lines choose the four bits of one register and transfer
them into the four-line common bus.
When both of the select lines are at low logic, i.e. S1S0 = 00, the 0 data inputs
of all four multiplexers are selected and applied to the outputs that forms the bus. This,
in turn, causes the bus lines to receive the content of register A since the outputs of
this register are connected to the 0 data inputs of the multiplexers.
Similarly, when S1S0 = 01, register B is selected, and the bus lines will
receive the content provided by register B.
The following function table shows the register that is selected by the bus for each of
the four possible binary values of the Selection lines.
The most commonly used three state gates in case of the bus system is a buffer gate.
The following diagram demonstrates the construction of a bus system with three-state
buffers.
The outputs generated by the four buffers are connected to form a single bus
line.
Only one buffer can be in active state at a given point of time.
The control inputs to the buffers determine which of the four normal inputs will
communicate with the bus line.
A 2 * 4 decoder ensures that no more than one control input is active at any
given point of time.
Memory Transfer:
The transfer of information from a memory unit to the user end is called
a Read operation.
The transfer of new information to be stored in the memory is called
a Write operation.
A memory word is designated by the letter M.
We must specify the address of memory word while writing the memory
transfer operations.
The address register is designated by AR and the data register by DR.
Thus, a read operation can be stated as:
1.Read: DR ← M [AR]
The Read statement causes a transfer of information into the data register (DR)
from the memory word (M) selected by the address register (AR).
And the corresponding write operation can be stated as:
2.Write: M [AR] ← R1
The Write statement causes a transfer of information from register R1 into the
memory word (M) selected by address register (AR).
*****
4.Arithmetic micro operations:
We can perform arithmetic operations on the numeric data which is stored
inside the registers.
Example :
R3 <- R1 + R2
The value in register R1 is added to the value in the register R2 and then the sum is
transferred into register R3. Similarily, other arithmetic micro-operations are
performed on the registers.
Addition:
In addition micro-operation, the value in register R1 is added to the value in
the register R2 and then the sum is transferred into register R3.
Substraction:
In subtraction micro-operation, the contents of register R2 are subtracted
from contents of the register R1, and then the result is transferred into R3.
R3<- R1-R2
There is another way of doing the subtraction. In this, 2’s complement of R2 is added
to R1, which is equivalent to R1 – R2, and then the result is transferred into register
R3.
1’s Complement: In this micro-operation, the complement of the value inside the
register R1 is taken.
2’s Complement: In this micro-operation, the complement of the value inside the
register R2 is taken and then 1 is added to the value and then the final result is
transferred into the register R2. This process is also called Negation. It is equivalent
to -R2.
*****
*****
• Arithmetic Instructions
• Logical Instructions
• Branching Instructions
• Control Instructions
7.8085 microprocessor:
Bus is a group of conducting wires which carries information, all the
peripherals are connected to microprocessor through Bus.
Diagram to represent bus organization system of 8085 Microprocessor.
Arithmetic and logic unit: As the name suggests, it performs arithmetic and logical
operations like Addition, Subtraction, AND, OR, etc. on 8-bit data.
General purpose register: There are 6 general purpose registers in 8085 processor,
i.e. B, C, D, E, H & L. Each register can hold 8-bit data.
These registers can work in pair to hold 16-bit data and their pairing
combination is like B-C, D-E & H-L.
Program counter: It is a 16-bit register used to store the memory address location of
the next instruction to be executed. Microprocessor increments the program whenever
an instruction is being executed, so that the program counter points to the memory
address of the next instruction that is going to be executed.
Stack pointer: It is also a 16-bit register works like stack, which is always
incremented/decremented by 2 during push & pop operations.
Flag register: It is an 8-bit register having five 1-bit flip-flops, which holds either 0 or
1 depending upon the result stored in the accumulator.
These are the set of 5 flip-flops:
Sign (S)
Zero (Z)
Auxiliary Carry (AC)
Parity (P)
Carry (C)
Instruction register and decoder: It is an 8-bit register. When an instruction is
fetched from memory then it is stored in the Instruction register. Instruction decoder
decodes the information present in the Instruction register.
Timing and control unit: It provides timing and control signal to the microprocessor
to perform operations. Following are the timing and control signals, which control
external and internal circuits.
Address buffer and address-data buffer: The content stored in the stack pointer and
program counter is loaded into the address buffer and address-data buffer to
communicate with the CPU. The memory and I/O chips are connected to these buses;
the CPU can exchange the desired data with the memory and I/O chips.
Address bus and data bus: Data bus carries the data to be stored. It is bidirectional,
whereas address bus carries the location to where it should be stored and it is
unidirectional. It is used to transfer the data & Address I/O devices.
8085 Architecture
We have tried to depict the architecture of 8085 with this following image:
*****
UNIT-III
Basic Computer organization and Design
1.Instruction codes:
While a Program, as we all know, is, A set of instructions that specify the
operations, operands, and the sequence by which processing has to occur.
An instruction code is a group of bits that tells the computer to perform a specific
operation part.
The operation code of an instruction is a group of bits that define operations such
as add, subtract, multiply, shift and compliment. The number of bits required for the
operation code depends upon the total number of operations available on the
computer. The operation code must consist of at least n bits for a
given 2^n operations. The operation part of an instruction code specifies the operation
to be performed.
Common Bus System: The basic computer has 8 registers, a memory unit and a
control unit. Paths must be provided to transfer data from one register to another. An
efficient method for transferring data in a system is to use a Common Bus System.
The output of registers and memory are connected to the common bus.
Load(LD): The lines from the common bus are connected to the inputs of each
register and data inputs of memory. The particular register whose LD input is enabled
receives the data from the bus during the next clock pulse transition.
Before studying about instruction formats lets first study about the operand
address parts.
When the 2nd part of an instruction code specifies the operand, the instruction is said
to have immediate operand. And when the 2nd part of the instruction code specifies
the address of an operand, the instruction is said to have a direct address. And
in indirect address, the 2nd part of instruction code, specifies the address of a
memory word in which the address of the operand is found.
Computer Instructions: The basic computer has three instruction code formats.
The Operation code (opcode) part of the instruction contains 3 bits and remaining 13
bits depends upon the operation code encountered.
1. Memory Reference Instruction: It uses 12 bits to specify the address and 1 bit to
specify the addressing mode (I). I is equal to 0 for direct address and 1 for indirect
address.
2. Register Reference Instruction: These instructions are recognized by the
oppose 111 with a 0 in the left most bit of instruction. The other 12 bits specify the
operation to be executed.
3. Input-Output Instruction: These instructions are recognized by the operation
code 111 with a 1 in the left most bit of instruction. The remaining 12 bits are used to
specify the input-output operation.
Format of Instruction:
*****
2.Computer Register:
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.
The computer needs processor registers for manipulating data and a register for
holding a memory address. The register holding the memory location is used to
calculate the address of the next instruction after the execution of the current
instruction is completed.
Within the processor , there is a set of Registers which are very fast but hold only
small amount of data, in order to speed up its operation by providing quick access to
commonly used values.Because they are semiconductor devices whose contents can be
accessed at extremely high speed.And the most important thing about Registers is that
Registers generally hold data temporarily, during execution of a program.And
Registers are normally measured by the number of bits they can hold.
As an example: An 8-bit register means, it can store 8 bit of data, 32-bit register means
it can store 32 bit of data.
*****
3.Computer Instructions:
o The three operation code bits in positions 12 through 14 should be equal to 111.
Otherwise, the instruction is a memory-reference type, and the bit in position 15
is taken as the addressing mode I.
o When the three operation code bits are equal to 111, control unit inspects the bit
in position 15. If the bit is 0, the instruction is a register-reference type.
Otherwise, the instruction is an input-output type having bit 1 at position 15.
A huge amount of binary information is stored in the memory unit, but all
computations are done in processor registers. Therefore, one must possess the
capability of moving information between these two units.
Program control instructions such as branch instructions are used change the sequence
in which the program is executed.
Input and Output instructions act as an interface between the computer and the user.
Programs and data must be transferred into memory, and the results of computations
must be transferred back to the user.
*****
In the hardwired organization, the control logic is implemented with gates, flip-
flops, decoders, and other digital circuits. It has the advantage that it can be optimized
to produce a fast mode of operation. In the microprogrammed organization, the
control information is stored in a control memory. The control memory is
programmed to initiate the required sequence of microoperations. A hardwired
control, as the name implies, requires changes in the wiring among the various
components if the design has to be modified or changed.
In the microprogrammed control, any required changes or modifications can be
done by updating the microprogram in control memory.
The block diagram of the control unit is shown in Fig.
It consists of two decoders,
The instruction register is shown again in Fig. where it is divided into three parts:
1. the 1 bit,
2. the operation code, and
3. bits 0 through 11.
An instruction read from memory is placed in the instruction register (IR).position of
this register in the common bus system is indicated in Fig.
*****
5.Instruction Cycle:
An instruction cycle, also known as fetch-decode-execute cycle is the basic
operational process of a computer. This process is repeated continuously by CPU from
boot up to shut down of computer.
1. Fetch the Instruction: The instruction is fetched from memory address that is
stored in PC(Program Counter) and stored in the instruction register IR. At the end of
the fetch operation, PC is incremented by 1 and it then points to the next instruction to
be executed.
3. Read the Effective Address: If the instruction has an indirect address, the effective
address is read from the memory. Otherwise operands are directly read in case of
immediate operand instruction.
4. Execute the Instruction: The Control Unit passes the information in the form of
control signals to the functional unit of CPU. The result generated is stored in main
memory or sent to an output device.
The cycle is then repeated by fetching the next instruction. Thus in this
way the instruction cycle is repeated continuously.
*****
6.Input-Output:
Instructions and data stored in the memory must come from some input device. The
results are displayed to the user through some output device.
The following block diagram shows the input-output configuration for a basic
computer.
o The input-output terminals send and receive information.
o The amount of information transferred will always have eight bits of an
alphanumeric code.
o The information generated through the keyboard is shifted into an input
register 'INPR'.
o The information for the printer is stored in the output register 'OUTR'.
o Registers INPR and OUTR communicate with a communication interface
serially and with the AC in parallel.
o The transmitter interface receives information from the keyboard and
transmits it to INPR.
o The receiver interface receives information from OUTR and sends it to the
printer serially.
*****
7.Interrupt:
Interrupt is a signal emitted by hardware or software when a process or an
event needs immediate attention. It alerts the processor to a high-priority process
requiring interruption of the current working process. In I/O devices one of the bus
control lines is dedicated for this purpose and is called the Interrupt Service Routine
(ISR).
While the processor is handling the interrupts, it must inform the device
that its request has been recognized so that it stops sending the interrupt request
signal. Also, saving the registers so that the interrupted process can be restored in the
future, increases the delay between the time an interrupt is received and the start of
the execution of the ISR. This is called Interrupt Latency.
Hardware Interrupts:
In a hardware interrupt, all the devices are connected to the Interrupt Request Line.
A single request line is used for all the n devices. To request an interrupt, a device
closes its associated switch. When a device requests an interrupt, the value of INTR
is the logical OR of the requests from individual devices.
Handling Multiple Devices: When more than one device raises an interrupt request
signal, then additional information is needed to decide which device to be considered
first. The following methods are used to decide which device to
select:Polling,Vectored Interrupts, and Interrupt Nesting. These are explained as
followingbelow.
1. Polling: In polling, the first device encountered with the IRQ bit set is the device
that is to be serviced first. Appropriate ISR is called to service the same. It is easy
to implement but a lot of time is wasted by interrogating the IRQ bit of all
devices.
(i).Memory or Storage Unit: This unit can store instructions, data, and intermediate
results. This unit supplies information to other units of the computer when needed. It
is also known as internal storage unit or the main memory or the primary storage or
Random Access Memory (RAM).
Its size affects speed, power, and capability. Primary memory and secondary memory
are two types of memories in the computer. Functions of the memory unit are :
It stores all the data and the instructions required for processing.
It stores intermediate results of processing.
It stores the final results of processing before these results are released to an
output device.
All inputs and outputs are transmitted through the main memory.
(ii).Control Unit: This unit controls the operations of all parts of the computer but
does not carry out any actual data processing operations.
(iii).ALU (Arithmetic Logic Unit): This unit consists of two subsections namely,
Arithmetic Section
Logic Section
Arithmetic Section: Function of arithmetic section is to perform arithmetic operations
like addition, subtraction, multiplication, and division. All complex operations are
done by making repetitive use of the above operations.
For example:
MULT R1, R2, R3
This is an instruction of an arithmetic multiplication written in assembly language. It
uses three address fields R1, R2, and R3. The meaning of this instruction is:
R1 <-- R2 * R3
This instruction also can be written using only two address fields as:
MULT R1, R2
In this instruction, the destination register is the same as one of the source registers.
This means the operation.
R1 <-- R1 * R2
The use of large number of registers results in short program with limited
instructions.
The advantages of General register based CPU organization :
Efficiency of CPU increases as there are a large number of registers are used in
this organization.
Less memory space is used to store the program since the instructions are written
in compact way.
4.Instruction Formats:
Computer perform task on the basis of instruction provided. An instruction
in computer comprises of groups called fields. These fields contains different
information as for computers every thing is in 0 and 1 so each field has different
significance on the basis of which a CPU decide what to perform. The most common
fields are:
Operation field which specifies the operation to be performed like addition.
Address field which contain the location of operand, i.e., register or memory
location.
Mode field which specifies how operand is to be founded.
An instruction is of various length depending upon the number of
addresses it contain. Generally CPU organizations are of three types on the basis of
number of address fields:
1. Single Accumulator organization
2. General register organization
3. Stack organization
In first organization operation is done involving a special register
called accumulator. In second on multiple registers are used for the computation
purpose. In third organization the work on stack basis operation due to which it does
not contain any address field. It is not necessary that only a single organization is
applied a blend of various organization is mostly what we see generally.
(i).Zero Address Instructions: A stack based computer do not use address field in
instruction.To evaluate a expression first it is converted to revere Polish Notation i.e.
Post fix Notation.
Expression: X = (A+B)*(C+D)
Postfixed : X = AB+CD+*
(ii).One Address Instructions: This use a implied ACCUMULATOR register for
data manipulation.One operand is in accumulator and other is in register or memory
location.Implied means that the CPU already know that one operand is in
accumulator so there is no need to specify it.
*****
5.Adressing Modes:
The operation field of an instruction specifies the operation to be
performed. This operation will be executed on some data which is stored in computer
registers or the main memory. The way any operand is selected during the program
execution is dependent on the addressing mode of the instruction. The purpose of
using addressing modes is as follows:
1.Immediate Mode: In this mode, the operand is specified in the instruction itself. An
immediate mode instruction has an operand field rather than the address field.
For example: ADD 7, which says Add 7 to contents of accumulator. 7 is the operand
here.
2.Register Mode: In this mode the operand is stored in the register and this register is
present in CPU. The instruction has the address of the Register where the operand is
stored.
3.Register Indirect Mode: In this mode, the instruction specifies the register whose
contents give us the address of operand which is in memory. Thus, the register
contains the address of operand rather than the operand itself.
4.Auto Increment/Decrement Mode: In this the register is incremented or
decremented after or before its value is used.
6.Indirect Addressing Mode: In this, the address field of instruction gives the
address where the effective address is stored in memory. This slows down the
execution, as this includes multiple memory lookups to find the operand.
7.Displacement Addressing Mode: In this the contents of the indexed register is
added to the Address part of the instruction, to obtain the effective address of operand.
EA = A + (R), In this the address field holds two values, A(which is the base
value) and R(that holds the displacement), or vice versa.
The operand is A cells away from the current cell(the one pointed to by PC)
10.Stack Addressing Mode: In this mode, operand is at the top of the stack. For
example: ADD, this instruction will POP top two items from the stack, add them, and
will then PUSH the result to the top of the stack.
*****
UNIT-IV
INPUT_OUTPUT ORGANIZATION
1.Peripheral devices:
*****
2.INPUT-OUTPUT INTERFACE:
The method that is used to transfer information between internal storage and
external I/O devices is known as I/O interface. The CPU is interfaced using special
communication links by the peripherals connected to any computer system. These
communication links are used to resolve the differences between CPU and
peripheral. There exists special hardware components between CPU and peripherals
to supervise and synchronize all the input and output transfers that are called
interface units.
Mode of Transfer:
This mode uses an interrupt facility and special commands to inform the interface
to issue the interrupt command when data becomes available and interface is
ready for the data transfer. In the meantime CPU keeps on executing other tasks
and need not check for the flag. When the flag is set, the interface is informed and
an interrupt is initiated. This interrupt causes the CPU to deviate from what it is
doing to respond to the I/O transfer. The CPU responds to the signal by storing
the return address from the program counter (PC) into the memory stack and then
branches to service that processes the I/O request. After the transfer is complete,
CPU returns to the previous task it was executing. The branch address of the
service can be chosen in two ways known as vectored and non-vectored interrupt.
In vectored interrupt, the source that interrupts, supplies the branch information to
the CPU while in case of non-vectored interrupt the branch address is assigned to
a fixed location in memory.
Both the methods programmed I/O and Interrupt-driven I/O require the
active intervention of the processor to transfer data between memory and the I/O
module, and any data transfer must transverse
a path through the processor. Thus both these forms of I/O suffer from two inherent
drawbacks.
The I/O transfer rate is limited by the speed with which the processor
can test and service a
device.
The processor is tied up in managing an I/O transfer; a number of
instructions must be executed
for each I/O transfer.
The data transfer between a fast storage media such as magnetic disk
and memory unit is limited by the speed of the CPU. Thus we can allow the
peripherals directly communicate with each other using the memory buses,
removing the intervention of the CPU. This type of data transfer technique is
known as DMA or direct memory access. During DMA the CPU is idle and it has
no control over the memory buses. The DMA controller takes over the buses to
manage the transfer directly between the I/O devices and the memory unit.
Bus Request: It is used by the DMA controller to request the CPU to relinquish
the control of the buses.
Bus Grant: It is activated by the CPU to Inform the external DMA controller that
the buses are in high impedance state and the requesting DMA can take control of
the buses. Once the DMA has taken the control of the buses it transfers the data.
This transfer can take place in many ways.
Burst Transfer:DMA returns the bus after complete data transfer. A register is
used as a byte count,being decremented for each byte transfer, and upon the byte
count reaching zero, the DMAC will release the bus. When the DMAC operates
in burst mode, the CPU is halted for the duration of the data
transfer.
Cyclic Stealing:An alternative method in which DMA controller transfers one
word at a time after which it must return the control of the buses to the CPU. The
CPU delays its operation only for one memory cycle to allow the direct memory
I/O transfer to “steal” one memory cycle.
(i) First, source puts data on the data bus and ON the strobe signal.
(ii) Destination on seeing the ON signal of strobe, read data from the data bus.
(iii) After reading data from the data bus by destination, strobe gets OFF.
Signals can be seen as:
It shows that first data is put on the data bus and then strobe signal gets active.
(i) First, the destination ON the strobe signal to ensure the source to put the fresh
data on the data bus.
(ii) Source on seeing the ON signal puts fresh data on the data bus.
(iii) Destination reads the data from the data bus and strobe gets OFF signal.
Signals can be seen as:
1. It shows that first strobe signal gets active then data is put on the data bus.
Problems faced in Strobe based asynchronous input output:
1. In Source initiated Strobe, it is assumed that destination has read the data from the
data bus but their is no surety.
2. In Destination initiated Strobe, it is assumed that source has put the data on the
data bus but their is no surety.
3.Handshaking Mechanism:
(i) Source places data on the data bus and enable Data valid signal.
(ii) Destination accepts data from the data bus and enable Data accepted signal.
(iii) After this, disable Data valid signal means data on data bus is invalid now.
(iv) Disable Data accepted signal and the process ends.
Now there is surety that destination has read the data from the data bus
through data accepted signal.
Signals can be seen as:
It shows that first data is put on the data bus then data valid signal gets active and
then data accepted signal gets active. After accepting the data, first data valid
signal gets off then data accepted signal gets off.
2.Destination initiated Handshaking : When destination initiates the process
of data transfer.
REQUEST FOR DATA: if ON requests for putting data on the data bus.
DATA VALID: if ON tells data is valid on the data bus otherwise invalid data.
(i) When destination is ready to receive data, Request for Data signal gets
activated.
(ii) source in response puts data on the data bus and enabled Data valid signal.
(iii) Destination then accepts data from the data bus and after accepting data,
disabled Request for Data signal.
(iv) At last, Data valid signal gets disabled means data on the data bus is no more
valid data.
Now there is surety that source has put the data on the data bus through data valid
signal.
Signals can be seen as:
It shows that first Request for Data signal gets active then data is put on data bus
then Data valid signal gets active. After reading data, first Request for Data signal
gets off then Data valid signal.
*****
4.MODE OF TRANSFER:
The mode of transferring information between internal storage and external I/O
devices is known as I/O interface or input/output interface. The I/O module diagram is
as follows:
Mode of Transfer:
Data transfer between the central computer to I/O devices may be handled in variety
of modes.
Programmed I/O
Interrupt Initiated I/O
Direct Memory Access (DMA)
Let us discuss each in detail:
Programmed I/O:
DMA Operation:
–Read/Write
–Device address
–Starting address of memory block for data
–Amount of data to be transferred
5.PRIORITY INTERRUPT:
A priority interrupt is a system which decides the priority at which various
devices, which generates the interrupt signal at the same time, will be serviced by the
CPU. The system has authority to decide which conditions are allowed to interrupt the
CPU, while some other interrupt is being serviced. Generally, devices with high speed
transfer such as magnetic disks are given high priority and slow devices such
as keyboards are given low priority.
When two or more devices interrupt the computer simultaneously, the computer
services the device with the higher priority first.
Types of Interrupts:
Following are some different types of interrupts:
Normal Interrupt: The interrupts that are caused by software instructions are
called normal software interrupts.
Exception: Unplanned interrupts which are produced during the execution of
some program are called exceptions, such as division by zero.
*****
1. Burst Mode: Here, once the DMA controller gains the charge of the system bus, then
it releases the system bus only after completion of data transfer. Till then the CPU has
to wait for the system buses.
2. Cycle Stealing Mode: In this mode, the DMA controller forces the CPU to stop its
operation and relinquish the control over the bus for a short term to DMA controller.
After the transfer of every byte, the DMA controller releases the bus and then again
requests for the system bus. In this way, the DMA controller steals the clock cycle for
transferring every byte.
3. Transparent Mode: Here, the DMA controller takes the charge of system bus only if
the processor does not require the system bus.
DMA controller is a hardware unit that allows I/O devices to access memory directly
without the participation of the processor. Here, we will discuss the working of the
DMA controller. Below we have the diagram of DMA controller that explains its
working:
1. Whenever an I/O device wants to transfer the data to or from memory, it sends the
DMA request (DRQ) to the DMA controller. DMA controller accepts this DRQ and
asks the CPU to hold for a few clock cycles by sending it the Hold request (HLD).
2. CPU receives the Hold request (HLD) from DMA controller and relinquishes the bus
and sends the Hold acknowledgement (HLDA) to DMA controller.
3. After receiving the Hold acknowledgement (HLDA), DMA controller acknowledges
I/O device (DACK) that the data transfer can be performed and DMA controller takes
the charge of the system bus and transfers the data to or from memory.
4. When the data transfer is accomplished, the DMA raise an interrupt to let know the
processor that the task of data transfer is finished and the processor can take control
over the bus again and start processing where it has left.
After exploring the working of DMA controller, let us discuss the block diagram of
the DMA controller. Below we have a block diagram of DMA controller.
Whenever a processor is requested to read or write a block of data, i.e. transfer a block
of data, it instructs the DMA controller by sending the following information.
1. The first information is whether the data has to be read from memory or the data has to
be written to the memory. It passes this information via read or write control lines that
is between the processor and DMA controllers control logic unit.
2. The processor also provides the starting address of/ for the data block in the memory,
from where the data block in memory has to be read or where the data block has to be
written in memory. DMA controller stores this in its address register. It is also called
the starting address register.
3. The processor also sends the word count, i.e. how many words are to be read or
written. It stores this information in the data count or the word count register.
4. The most important is the address of I/O device that wants to read or write data. This
information is stored in the data register.
*****
7.INPUT-OUTPUT PROCESSOR:
The Input Output Processor (IOP) is just like a CPU that handles the
details of I/O operations. It is more equipped with facilities than those are available
in typical DMA controller. The IOP can fetch and execute its own instructions that
are specifically designed to characterize I/O transfers. In addition to the I/O – related
tasks, it can perform other processing tasks like arithmetic, logic, branching and code
translation. The main memory unit takes the pivotal role. It communicates with
processor by the means of DMA.
The block diagram:
The Input Output Processor is a specialized processor which loads and stores data
into memory along with the execution of I/O instructions. It acts as an interface
between system and devices. It involves a sequence of events to executing I/O
operations and then store the results into the memory.
Advantages –
The I/O devices can directly access the main memory without the intervention by
the processor in I/O processor based systems.
It is used to address the problems that are arises in Direct memory access method.
*****
MEMORY ORGANIZATION
1.MEMORY HIERARCHY:
In the Computer System Design, Memory Hierarchy is an enhancement to
organize the memory such that it can minimize the access time. The Memory
Hierarchy was developed based on a program behaviour known as locality of
references.The figure below clearly demonstrates the different levels of memory
hierarchy : In the Computer System Design, Memory Hierarchy is an enhancement
to organize the memory such that it can minimize the access time. The Memory
Hierarchy was developed based on a program behavior known as locality of
references.The figure below clearly demonstrates the different levels of memory
hierarchy
This Memory Hierarchy Design is divided into 2 main types:
1. External Memory or Secondary Memory :Comprising of Magnetic Disk,
Optical Disk, Magnetic Tape i.e. peripheral storage devices which are accessible
by the processor via I/O Module.
2. Internal Memory or Primary Memory :Comprising of Main Memory, Cache
Memory & CPU registers. This is directly accessible by the processor.
We can infer the following characteristics of Memory Hierarchy Design from above
figure:
1. Capacity: It is the global volume of information the memory can store. As we
move from top to bottom in the Hierarchy, the capacity increases.
2. Access Time: It is the time interval between the read/write request and the
availability of the data. As we move from top to bottom in the Hierarchy, the
access time increases.
3. Performance: Earlier when the computer system was designed without Memory
Hierarchy design, the speed gap increases between the CPU registers and Main
Memory due to large difference in access time. This results in lower performance
of the system and thus, enhancement was required. This enhancement was made
in the form of Memory Hierarchy Design because of which the performance of
the system increases. One of the most significant ways to increase system
performance is minimizing how far down the memory hierarchy one has to go to
manipulate data.
4. Cost per bit: As we move from bottom to top in the Hierarchy, the cost per bit
increases i.e. Internal Memory is costlier than External Memory.
*****
2.Main Memory:
The memory unit that communicates directly within the CPU, Auxillary
memory and Cache memory, is called main memory. It is the central storage unit of
the computer system. It is a large and fast memory used to store data during computer
operations. Main memory is made up of RAM and ROM, with RAM integrated
circuit chips holing the major share.
RAM(Random Access Memory):
*****
3.Auxiliary Memory:
An Auxiliary memory is known as the lowest-cost, highest-capacity and
slowest-access storage in a computer system. It is where programs and data are kept
for long-term storage or when not in immediate use. The most common examples of
auxiliary memories are magnetic tapes and magnetic disks.
Magnetic Disks
o The memory bits are stored in the magnetized surface in spots along the
concentric circles called tracks.
o The concentric circles (tracks) are commonly divided into sections called
sectors.
Magnetic Tape: Magnetic tape is a storage medium that allows data archiving,
collection, and backup for different kinds of data. The magnetic tape is constructed
using a plastic strip coated with a magnetic recording medium.
The bits are recorded as magnetic spots on the tape along several
tracks. Usually, seven or nine bits are recorded simultaneously to form a character
together with a parity bit.
*****
4.Associative Memory:
An associative memory can be considered as a memory unit whose stored
data can be identified for access by the content of the data itself rather than by an
address or memory location.
From the block diagram, we can say that an associative memory consists of a memory
array and logic for 'm' words with 'n' bits per word.
The functional registers like the argument register A and key register K each
have n bits, one for each bit of a word. The match register M consists of m bits, one
for each memory word.
The words which are kept in the memory are compared in parallel with the content of
the argument register.
The following diagram can represent the relation between the memory array and the
external registers in an associative memory.
The cells present inside the memory array are marked by the letter C with two
subscripts. The first subscript gives the word number and the second specifies the bit
position in the word. For instance, the cell Cij is the cell for bit j in word i.
A bit Aj in the argument register is compared with all the bits in column j of the array
provided that Kj = 1. This process is done for all columns j = 1, 2, 3......, n.
If a match occurs between all the unmasked bits of the argument and the bits in word i,
the corresponding bit Mi in the match register is set to 1. If one or more unmasked bits
of the argument and the word do not match, Mi is cleared to 0.
*****
5.Cache Memory:
Cache memory is used to reduce the average time to access data from
the Main memory. The cache is a smaller and faster memory which stores copies of
the data from frequently used main memory locations. There are various different
independent caches in a CPU, which store instructions and data.
Levels of memory:
Cache Performance:
When the processor needs to read or write a location in main memory,
it first checks for a corresponding entry in the cache.
If the processor finds that the memory location is in the cache, a cache hit has
occurred and data is read from cache
If the processor does not find the memory location in the cache, a cache
miss has occurred. For a cache miss, the cache allocates a new entry and
copies in data from main memory, then the request is fulfilled from the
contents of the cache.
The performance of cache memory is frequently measured in terms of
a quantity called Hit ratio.
There are three different types of mapping used for the purpose of cache
memory which are as follows: Direct mapping, Associative mapping, and Set-
Associative mapping. These are explained below.
1.Direct Mapping:
The simplest technique, known as direct mapping, maps each block of main
memory into only one possible cache line. Or In Direct mapping, assigne each
memory block to a specific line in the cache. If a line is previously taken up by a
memory block when a new block needs to be loaded, the old block is trashed. An
address space is split into two parts index field and a tag field. The cache is used to
store the tag field whereas the rest is stored in the main memory. Direct mapping`s
performance is directly proportional to the Hit ratio.
For purposes of cache access, each main memory address can be
viewed as consisting of three fields.
2.AssociativeMapping:
In this type of mapping, the associative memory is used to store
content and addresses of the memory word. Any block can go into any line of the
cache. This means that the word id bits are used to identify which word in the block
is needed, but the tag becomes all of the remaining bits. This enables the placement
of any word at any place in the cache memory. It is considered to be the fastest and
the most flexible mapping form.
3.Set-associative Mapping: :
Set-associative mapping allows that each word that is present in the
cache can have two or more words in the main memory for the same index address.
Set associative cache mapping combines the best of direct and associative cache
mapping techniques.
Application of Cache Memory:
1. Usually, the cache memory can store a reasonable number of blocks at any given
time, but this number is small compared to the total number of blocks in the main
memory.
2. The correspondence between the main memory blocks and those in the cache is
specified by a mapping function.
Types of Cache :
Primary Cache : A primary cache is always located on the processor chip. This
cache is small and its access time is comparable to that of processor registers.
Secondary Cache : Secondary cache is placed between the primary cache and the
rest of the memory. It is referred to as the level 2 (L2) cache. Often, the Level 2
cache is also housed on the processor chip.
Locality of reference :
Since size of cache memory is less as compared to main memory. So to
check which part of main memory should be given priority and loaded in cache is
decided based on locality of reference.
1. Spatial Locality of reference: This says that there is a chance that element will
be present in the close proximity to the reference point and next time if again
searched then more close proximity to the point of reference.
2. Temporal Locality of reference: In this Least recently used algorithm will be
used. Whenever there is page fault occurs within a word will not only load word
in main memory but complete page fault will be loaded because spatial locality of
reference rule says that if you are referring any word next word will be referred in
its register that’s why we load complete page table so the complete block will be
loaded.
*****
6.Virtual Memory:
Demand Paging :
The process of loading the page into memory on demand (whenever page
fault occurs) is known as demand paging.
1. If CPU try to refer a page that is currently not available in the main memory, it
generates an interrupt indicating memory access fault.
2. The OS puts the interrupted process in a blocking state. For the execution to
proceed the OS must bring the required page into the memory.
3. The OS will search for the required page in the logical address space.
4. The required page will be brought from logical address space to physical address
space. The page replacement algorithms are used for the decision making of
replacing the page in physical address space.
5. The page table will updated accordingly.
6. The signal will be sent to the CPU to continue the program execution and it will
place the process back into ready state.
Hence whenever a page fault occurs these steps are followed by the
operating system and the required page is brought into memory.
Swapping:
Swapping a process out means removing all of its pages from memory,
or marking them so that they will be removed by the normal page replacement
process. Suspending a process ensures that it is not runnable while it is swapped out.
At some later time, the system swaps back the process from the secondary storage to
main memory. When a process is busy swapping pages in and out then this situation
is called thrashing.
Thrashing :
Causes of Thrashing :
1. High degree of multiprogramming : If the number of processes keeps on
increasing in the memory than number of frames allocated to each process will be
decreased. So, less number of frames will be available to each process. Due to
this, page fault will occur more frequently and more CPU time will be wasted in
just swapping in and out of pages and the utilization will keep on decreasing..
2. Lacks of Frames: If a process has less number of frames then less pages of that
process will be able to reside in memory and hence more frequent swapping in
and out will be required. This may lead to thrashing. Hence sufficient amount of
frames must be allocated to each process in order to prevent thrashing.
Recovery of Thrashing :
Do not allow the system to go into thrashing by instructing the long term
scheduler not to bring the processes into memory after the threshold.
If the system is already in thrashing then instruct the mid term schedular to
suspend some of the processes so that we can recover the system from thrashing.
***THE END***