CO Unit 1 (Complete)
CO Unit 1 (Complete)
CO Unit 1 (Complete)
Logical Operations are performed using Boolean Algebra which makes the
circuit design more economical and simpler.
Logic ‘1’ and Logic ‘0’ can be easily distinguished.
Multiplexer -The multiplexer is a combinational logic circuit designed to switch one of several
input lines to a single common output line. Multiplexing is the generic term used to describe the
operation of sending one or more analogue or digital signals over a common transmission line at
different times or speeds and as such, the device we use to do just that is called the multiplexer.
A multiplexer is a combinational circuit that has 2 n input lines and a single output line. Simply,
the multiplexer is a multi-input and single-output combinational circuit. The binary information
is received from the input lines and directed to the output line. On the basis of the values of the
selection lines, one of these data inputs will be connected to the output.
Multiplexer Symbol
2×1 Multiplexer:
In 2×1 multiplexer, there are only two inputs, i.e., A0 and A1, 1 selection line, i.e., S and single
outputs, i.e., Y. On the basis of the combination of inputs which are present at the selection line
S, one of these 2 inputs will be connected to the output. The block diagram and the truth table
of the 2×1 multiplexer are given below.
Truth Table:
Y=S'.A0+S.A1
4×1 Multiplexer:
In the 4×1 multiplexer, there is a total of four inputs, i.e., A 0, A1, A2, and A3, 2 selection lines, i.e.,
S0 and S1 and single output, i.e., Y. On the basis of the combination of inputs that are present at
the selection lines S0 and S1, one of these 4 inputs are connected to the output. The block
diagram and the truth table of the 4×1 multiplexer are given below.
Truth Table:
2 to 4 line decoder:
In the 2 to 4 line decoder, there is a total of three inputs, i.e., A0, and A1 and E and four
outputs, i.e., Y0, Y1, Y2, and Y3. For each combination of inputs, when the enable 'E' is set
to 1, one of these four outputs will be 1. The block diagram and the truth table of the 2
to 4 line decoder are given below.
Block Diagram:
Truth Table:
The logical expression of the term Y0, Y1, Y2, and Y3 is as follows:
Y3=E.A1.A0
Y2=E.A1.A0'
Y1=E.A1'.A0
Y0=E.A1'.A0'
3 to 8 line decoder:
The 3 to 8 line decoder is also known as Binary to Octal Decoder. In a 3 to 8 line decoder,
there is a total of eight outputs, i.e., Y0, Y1, Y2, Y3, Y4, Y5, Y6, and Y7 and three inputs, i.e., A0,
A1, and A2. This circuit has an enable input 'E'. Just like 2 to 4 line decoder, when enable
'E' is set to 1, one of these four outputs will be 1. The block diagram and the truth table
of the 3 to 8 line encoder are given below.
Block Diagram:
Truth Table:
The logical expression of the term Y0, Y1, Y2, Y3, Y4, Y5, Y6, and Y7 is as follows:
Y0=A0'.A1'.A2'
Y1=A0.A1'.A2'
Y2=A0'.A1.A2'
Y3=A0.A1.A2'
Y4=A0'.A1'.A2
Y5=A0.A1'.A2
Y6=A0'.A1.A2
Y7=A0.A1.A2
Functional units of a computer system are parts of the CPU (Central Processing Unit) that
performs the operations and calculations called for by the computer program. A computer
consists of following five main components.
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.
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.
Most of all the arithmetic and logical operations of a computer are executed in the ALU
(Arithmetic and Logical Unit) of the processor. It performs arithmetic operations like addition,
subtraction, multiplication, division and also the logical operations like AND, OR, NOT operations.
Control unit (CU)
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. The control unit is also known as
the nerve center of a computer system. Let's us consider an example of addition of two operands
by the instruction given as Add LOCA, RO. This instruction adds the memory location LOCA to the
operand in the register RO and places the sum in the register RO. This instruction internally
performs several steps.
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. The Memory unit can be
categorized in two ways namely, primary memory and secondary memory. It enables a processor
to access running execution applications and services that are temporarily stored in a specific
memory location. Primary storage is the fastest memory that operates at electronic speeds. It is
also known as the volatile form of memory, means when the computer is shut down, anything
contained in RAM is lost. Cache memory is also a kind of memory which is used to fetch the data
very soon. They are highly coupled with the processor. The most common examples of primary
memory are RAM and ROM. Secondary memory is used when a large amount of data and
programs have to be stored for a long-term basis. It is also known as the Non-volatile memory
form of memory, means the data is stored permanently irrespective of shut down. The most
common examples of secondary memory are magnetic disks, magnetic tapes, and optical disks.
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. Output devices are
pieces of equipment that are used to generate information or any other response processed by
the computer. These devices display information that has been held or generated within a
computer. The most common example of an output device is a monitor.
Registers
A Register is a collection of flip flops. A flip flop is used to store single bit digital data. For
storing a large number of bits, the storage capacity is increased by grouping more than
one flip flops. If we want to store an n-bit word, we have to use an n-bit register containing
n number of flip flops.
The register is used to perform different types of operations. For performing the
operations, the CPU use these registers. The faded inputs to the system will store into the
registers. The result returned by the system will store in the registers.
The data which is to be read out or written into the address location is contained in
the Memory Data Register.
The data is written in one direction when it is fetched from memory and placed into the
MDR. In write instruction, the data place into the MDR from another CPU register. This
CPU register writes the data into the memory. Half of the minimal interface between the
computer storage and the microprogram is the memory data address register, and the
other half is the memory data register.
(e) Index Register
The Index Register is the hardware element that holds the number. The number adds to
the computer instruction's address to create an effective address. In CPU, the index
register is a processor register used to modify the operand address during the running
program.
(f)Data Register
The data register is used to temporarily store the data. This data transmits to or from a
peripheral device.
(g)Shift Register
A group of flip flops which is used to store multiple bits of data and the data is moved
from one flip flop to another is known as Shift Register. The bits stored in registers
shifted when the clock pulse is applied within and inside or outside the registers. To form
an n-bit shift register, we have to connect n number of flip flops. So, the number of bits
of the binary number is directly proportional to the number of flip flops. The flip flops are
connected in such a way that the first flip flop's output becomes the input of the other
flip flop.
A Shift Register can shift the bits either to the left or to the right. A Shift Register, which
shifts the bit to the left, is known as "Shift left register", and it shifts the bit to the right,
known as "Right left register".
Register Transfer: Information transferred from one register to another is designated in symbolic
form by means of replacement operator.
R2 ← R1 (It denotes the transfer of the data from register R1 into R2.)
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.
There are the following operations which are performed by the registers:
Fetch:
It is used
o To take the instructions given by the users.
o To fetch the instruction stored into the main memory.
Decode:
The decode operation is used to interpret the instructions. In decode, the operation
performed on the instructions is identified by the CPU. In simple words, the decode operation
is used to decode the instructions.
Execute:
The execution operation is used to store the result produced by the CPU
into the memory. After storing this result, it is displayed on the user screen.
Bus
Bus is a subsystem that is used to transfer data and other information between devices. Means
various devices in computer like (Memory, CPU, I/O and Other) are communicate with each other
through buses. In general, a bus is said to be as the communication pathway connecting two or
more devices. A key characteristic of a bus is that it is a shared transmission medium, as multiple
devices are attached to a bus. A bus consists of multiple communication Pathways or lines which
are either in the form of wires or metal lines etched in a card or board (Printed Circuit Board).
Each line is capable of transmitting binary 1 and binary 0.
Bus Architecture
Address Lines:
Address Lines are collectively called as address bus. In any bus, the no. of lines in address is
usually 16, 20, 24, or more depending on type and architecture of bus. On these lines, CPU sends
out the address of memory location on I/O Port that is to be written on or read from. In short, it
is an internal channel from CPU to Memory across which the address of data (not data) is
transmitted. Here the communication is one way that is, the address is send from CPU to Memory
and I/O Port but not Memory and I/O port send address to CPU on that line and hence these lines
are unidirectional.
Control Lines:
Control Lines are collectively called as Control Bus. Control Lines are gateway used to
transmit and receives control signals between the microprocessor and various devices attached
to it. In other words, Control Lines are used by CPUs for Communicating with other devices within
the computer. As an example-CPU sends signals on the Control bus to enable the outputs of
address memory devices and port devices. Typical Control Lines signals are: Memory Read,
Memory Write, I/O Read, I/O Write, Bus Request, Bus Grant, etc.
Types of Bus
There is variety of Buses, but here I will describe only those that are widely used.
System Bus:
A Bus that connects major computer components (Processor, Memory, I/O) is called a
System Bus. It is a single computer bus among all Buses that connects all these components of a
computer system. And it is the only Bus, in which data lines, address, control lines all are present.
It is also known as "front side” Bus. It is faster than peripheral Bus (PCI, ISA, etc) but slower than
backside bus.
PCI (Peripheral Component Interconnect): PCI Bus connects the CPU and expansion
boards such as modem cards, network cards and sound cards. These expansion boards are
normally plugged into expansion slots on the motherboard. That’s why PCI bus is also known as
expansion bus or external Bus.
USB (Universal Serial Bus): Universal Serial Bus is used to attach USB devices like Pen
Drive, etc to CPU.
Local Bus:
Local Bus are the traditional I/O (Peripheral) buses such as ISA, MCA, or EISA Buses. Now
we will discuss about each in brief one by one.
ISA (Industry Standard Architecture Bus): The ISA Bus permits bus mastering i.e., it
enabled peripheral connected directly to the bus to communicate directly with other peripherals
without going through the processor. One of the consequences of bus mastering is Direct
Memory Access. Up to end of 1990s almost all PCs computers were equipped with ISA Bus, but
it was progressively replaced by the PCI Bus, which offer a better performance.
EISA (Extended Industry Standard Architecture): The EISA Bus use connectors that were
same size as the ISA connectors but with 4 rows of contacts instead of 2 for 32 bit addressing.
Bus Arbitration-
Bus Arbitration refers to the process by which the current bus master accesses and then leaves
the control of the bus and passes it to the another bus requesting processor unit. The controller
that has access to a bus at an instance is known as Bus master.
A conflict may arise if the number of DMA controllers or other controllers or processors try to
access the common bus at the same time, but access can be given to only one of those. Only one
processor or controller can be Bus master at the same point of time. To resolve these conflicts,
Bus Arbitration procedure is implemented to coordinate the activities of all devices requesting
memory transfers. The selection of the bus master must take into account the needs of various
devices by establishing a priority system for gaining access to the bus. The Bus Arbiter decides
who would become current bus master.
There are two approaches to bus arbitration:
1. Centralized Arbitration
In centralized bus arbitration, a single bus arbiter performs the required arbitration. The bus
arbiter may be the processor or a separate controller connected to the bus.
There are three different arbitration schemes that use the centralized bus arbitration approach.
There schemes are:
a) Daisy chaining
b) Polling method
c) Independent request
a) Daisy chaining
The system connections for Daisy chaining method are shown in fig below.
It is simple and cheaper method. All masters make use of the same line for bus request. In
response to the bus request the controller sends a bus grant if the bus is free. The bus grant signal
serially propagates through each master until it encounters the first one that is requesting access
to the bus. This master blocks the propagation of the bus grant signal, activities the busy line and
gains control of the bus. Therefore any other requesting module will not receive the grant signal
and hence cannot get the bus access.
b) Polling method
The system connections for polling method are shown in figure above.
In this the controller is used to generate the addresses for the master. Number of address line
required depends on the number of master connected in the system. For example, if there are 8
masters connected in the system, at least three address lines are required. In response to the bus
request controller generates a sequence of master address. When the requesting master
recognizes its address, it activated the busy line ad begins to use the bus.
c) Independent request
The figure below shows the system connections for the independent request scheme. In this
scheme each master has a separate pair of bus request and bus grant lines and each pair has a
priority assigned to it. The built in priority decoder within the controller selects the highest
priority request and asserts the corresponding bus grant signal.
2. Distributed Arbitration
No single processor or controller controls the network as an authority. Since all arbiters
participate actively to decide who will be the bus master, so this method is known as Distributed
Arbitration.
Sometimes it is also known as Democratic Arbitration because every arbiter follows the set of
rules and cooperates during the arbitration process of the bus.
The network decides a network master among all arbiters who calculates all the requests on the
basis of set of rules decided by the network. The result of the calculation decides the priority of
all arbiters and highest priority request becomes the bus master.
A digital system composed of many registers, and paths must be provided to transfer information
from one register to another. The number of wires connecting all of the registers will be excessive
if separate lines are used between each register and all other registers in the system.
A bus structure, on the other hand, is more efficient for transferring information between
registers in a multi-register configuration system.
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.
A bus system can also be constructed using three-state gates instead of multiplexers.
The three state gates can be considered as a digital circuit that has three gates, two of which are
signals equivalent to logic 1 and 0 as in a conventional gate. However, the third gate exhibits a
high-impedance state.
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 –
Read Operation-
The transfer of data from the Address Register into the Memory Buffer Register is known as the
Read Operation.
The read operation is represented by MBR ← [AR] M. It states that the Memory Unit M is
transferred from [AR] representing Address register to Memory Buffer Register (MBR).
Write Operation-
Write Operation is the transfer of new data into the memory.
The write operation is denoted by [AR] M ← R1. It states that the Memory M from Register R1
is transferred to Address Register([AR]).
Micro-operations:
The operation executed on the data store in registers are called micro-operations.
For RTL –
3) The numbering of bits in a register can be marked on the top of the box.
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.
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.
Computer architecture –
THE VON NEUMANN ARCHITECTURE –
Mathematician John von Neumann and his colleagues proposed the von Neumann architecture in
1945, which stated that a computer consists of: a processor with an arithmetic and logic unit (ALU)
and a control unit; a memory unit that can communicate directly with the processor using
connections called buses; connections for input/output devices; and a secondary storage for saving
and backing up data.
The central computation concept of this architecture is that instructions and data are both loaded
into the same memory unit, which is the main memory of the computer and consists of a set of
addressable locations. The processor can then access the instructions and data required for the
execution of a computer program using dedicated connections called buses – an address bus which
is used to identify the addressed location and a data bus which is used to transfer the contents to
and from a location.
There are a number of reasons why the von Neumann architecture has proven to be so successful.
It is relatively easy to implement in hardware, and von Neumann machines are deterministic and
introspectable. They can be described mathematically and every step of their computing process
is understood. The biggest challenge with von Neumann machines is that they can be difficult to
code. This has led to the growth of computer programming, which takes real-world problems and
explains them to von Neumann machines.
HARVARD ARCHITECTURE-
Another popular computer architecture, though less so than the von Neumann architecture, is
Harvard architecture. The Harvard architecture keeps instructions and data in separate memories,
and the processor accesses these memories using separate buses. The processor is connected to the
‘instructions memory’ using a dedicated set of address and data buses, and is connected to the
‘data memory’ using a different set of address and data buses. This architecture is used extensively
in embedded computing systems such as digital signal processing (DSP) systems, and many
microcontroller devices use a Harvard-like architecture.
Same physical memory address is used for Separate physical memory address is used
instructions and data. for instructions and data.
There is common bus for data and instruction Separate buses are used for transferring data
transfer. and instruction.
CPU cannot access instructions and CPU can access instructions and read/write
read/write at the same time. at the same time.
It is used in personal computers and small It is used in micro controllers and signal
computers. processing.
Stack Organization
Stack - A stack is a memory unit with an address register. This register influences the address
for the stack, which is known as Stack Pointer (SP). The stack pointer continually influences the
address of the element that is located at the top of the stack.
The main difference between stack pointer and program counter is that the stack pointer is a
register that stores the address of the last program request in a stack while the program counter is
a register that stores the address of the next instruction to be executed from the memory.
Inserting new items to the stack is called push whereas removing items from the stack is called
pop. For example, assume that there are three elements as A, B and C. The first items pushed to
the stack is A. Then B and C are added. B is on top of A while C is on top of A. Now the
topmost element is C. When removing the items, C pops out first, then B and finally A. The last
inserted items are popped out first. Therefore, a stack operates according to the last in-first out
manner. This is the basic operation of a stack.
A stack pointer, or a stack register, is a small register that helps to handle the stack. It stores the
address of the last program request. Here, the recently entered request resides at the top of the
stack. When inserting a program request to the stack, the stack pointer first increments by one.
Then, the request is pushed to the stack. When removing a program request from the stack, the
requests first pops out of the stack. Then, the stack pointer decrements by one. Likewise, the stack
pointer keeps track of the operations of the stack.
Stack pointer is also called a stack register while program counter is also called an instruction
pointer, instruction address register, and instruction counter.
Register Stack
The stack can be arranged as a set of memory words or registers. Consider a 64-word register
stack arranged as displayed in the figure. The stack pointer register includes a binary number,
which is the address of the element present at the top of the stack. The three-element A, B, and C
are located in the stack.
The element C is at the top of the stack and the stack pointer holds the address of C that is 3. The
top element is popped from the stack through reading memory word at address 3 and decrementing
the stack pointer by 1. Then, B is at the top of the stack and the SP holds the address of B that is
2. It can insert a new word; the stack is pushed by incrementing the stack pointer by 1 and inserting
a word in that incremented location.
The stack pointer includes 6 bits, because 26 = 64, and the SP cannot exceed 63 (111111
in binary). After all, if 63 is incremented by 1, therefore the result is 0(111111 + 1 =
1000000). SP holds only the six least significant bits. If 000000 is decremented by 1 thus
the result is 111111.
Therefore, when the stack is full, the one-bit register ‘FULL’ is set to 1. If the stack is null,
then the one-bit register ‘EMTY’ is set to 1. The data register DR holds the binary
information which is composed into or readout of the stack.
First, the SP is set to 0, EMTY is set to 1, and FULL is set to 0. Now, as the stack is not
full (FULL = 0), a new element is inserted using the push operation.
The push operation is executed as follows –
The top element from the stack is read and transfer to DR and thus the stack pointer is
decremented. If the stack pointer reaches 0, then the stack is empty and ‘EMTY’ is set
to 1. This is the condition when the element in location 1 is read out and the SP is
decremented by 1.
o The Operation code (Opcode) field which specifies the operation to be performed.
o The Address field which contains the location of the operand, i.e., register or
memory location.
o The Mode field which specifies how the operand will be located.
Addressing Modes-
The operation field of an instruction specifies the operation to be performed. And this operation
must be performed on some data. So, each instruction needs to specify data on which the
operation is to be performed. But the operand (data) may be in accumulator, general purpose
register or at some specified memory location. So, appropriate location (address) of data is
needed to be specified, and in computer, there are various ways of specifying the address of data.
These various ways of specifying the address of data are known as “Addressing Modes.”
So, Addressing Modes can be defined as “The technique for specifying the address of the
operands.” And in computer the address of operand i.e., the address where operand is actually
found is known as “Effective Address”.
Now, in addition to this, the two most prominent reason of why addressing modes are so
important, are:
1. First, the way the operand data are chosen during program execution is
dependent on the addressing mode of the instruction.
2. Second, the address field (or fields) in a typical instruction format are relatively
small and sometimes we would like to be able to reference a large range of locations, so
here to achieve this objective i.e., to fit this large range of location in address field, a
variety of addressing techniques has been employed. As they reduce the number of fields
in the addressing field of the instruction.
Thus, Addressing Modes are very vital in Instruction Set Architecture (ISA).
Now, before discussing various addressing modes, I should know some notations that will be
used in throughout of this section. These are:
A= Contents of an address field in the instruction
R= Contents of an address field in the instruction that refers to a register
EA= Effective Address (Actual address) of location containing the referenced operand.
(X)= Contents of memory location x or register X.
Implied Addressing Mode also known as "Implicit" or "Inherent" addressing mode is the
addressing mode in which, no operand (register or memory location or data) is specified in the
instruction. As in this mode the operand is specified implicit in the definition of instruction. For
Example: “Complement Accumulator” is an Implied Mode instruction because the operand in the
accumulator register is implied in the definition of instruction. In assembly language it is written
as:
In addition to this, all Register-Reference instruction that use an accumulator and Zero-Address
instruction in a Stack Organized Computer are implied mode instructions, because in Register
reference operand implied in accumulator and in Zero-Address instruction, the operand implied
on the Top of Stack.
In Immediate Addressing Mode operand is specified in the instruction itself. In other words, an
immediate mode instruction has an operand field rather than an address field, which contain
actual operand to be used in conjunction with the operand specified in the instruction. That is, in
this mode, the format of instruction is as follows:
For example
MVI 06 Move 06 to the accumulator
ADD 05 ADD 05 to the content of accumulator
In addition to this, this mode is very useful for initializing the register to a constant value.
It consists of 3-bit opcode, 12-bit address and a mode bit designated as (I). The mode bit (I) is
zero for Direct Address and 1 for Indirect Address.
a) Direct Addressing Mode-
Direct Addressing Mode is also known as “Absolute Addressing Mode”. In this mode the address
of data (operand) is specified in the instruction itself. That is, in this type of mode, the operand
resides in memory and its address is given directly by the address field of the instruction.
Means, in other words, in this mode, the address field contain the Effective Address of
operand i.e., EA=A
For Example
ADD A means add contents of cell A to accumulator
It would look like as shown below:
For Example
ADD (A) Means adds the content of cell pointed to contents of A to Accumulator.
It looks like as shown in figure below:
Thus in it, AC <-- M [M (A)] [M=Memory]
i.e., (A) =1350=EA
In Register Addressing Mode, the operands are in registers that reside within the CPU. That is,
in this mode, instruction specifies a register in CPU, which contains the operand. It is like Direct
Addressing Mode; the only difference is that the address field refers to a register instead of
memory location. i.e., EA=R
It looks like as:
For Example
MOV AX, BX Move contents of Register BX to AX
ADD AX, BX Add the contents of register BX to AX
Here, AX, BX are used as register names which is of 16-bit register.
Thus, for a Register Addressing Mode, there is no need to compute the actual address as the
operand is in a register and to get operand there is no memory access involved.
4. Register Indirect Addressing Mode:-
In Register Indirect Addressing Mode, the instruction specifies a register in CPU whose contents
give the operand in memory. In other words, the selected register contains the address of
operand rather than the operand itself. That is, i.e., EA=(R)
Means, control fetches instruction from memory and then uses its address to access Register and
looks in Register(R) for effective address of operand in memory. It looks like as:
For Example
MOV AL, [BX]
Code example in Register:
MOV BX, 1000H
MOV 1000H, operand
From above example, it is clear that, the instruction (MOV AL, [BX]) specifies a register [BX], and
in coding of register, we see that, when we move register [BX], the register contain the address
of operand(1000H) rather than address itself.
Here, we see that, in the Auto-decrement mode, the register R1 is decremented to 399 prior to
execution of the instruction, means the operand is loaded to accumulator, is of address 1099H in
memory, instead of 1088H.Thus, in this case effective address is 1099H and contents loaded into
accumulator is 700.
6. Displacement Based Addressing Modes:
Displacement Based Addressing Modes is a powerful addressing mode as it is a combination of
direct addressing and register indirect addressing mode i.e., EA=A+(R)
Means, Displacement Addressing Modes requires that the instruction have two address fields, at
least one of which is explicit means, one is address field indicate direct address and other
indicate indirect address. That is, value contained in one addressing field is A, which is used
directly and the value in other address field is R, which refers to a register whose contents are to
be added to produce effective address.
It looks like as shown in figure below:
There are three areas where Displacement Addressing modes are used. In other words,
Displacement Based Addressing Modes are of three types. These are:
Thus, the difference between Base and Index mode is in the way they are used rather than the
way they are computed. An Index Register is assumed to hold an index number that is relative
to the address part of the instruction. And a Base Register is assumed to hold a base address
and the direct address field of instruction gives a displacement relative to this base address.
Thus, the Base register addressing mode is used in computer to facilitate the relocation of
programs in memory. Means, when programs and data are moved from one segment of memory
to another, then Base address is changed, the displacement value of instruction do not change.
So, only the value of Base Register requires updating to reflect the beginning of new memory
segment.