COA Unit 1
COA Unit 1
o A computer organization describes the functions and design of the various units of a
digital system.
o A general-purpose computer system is the best-known example of a digital system.
Other examples include telephone switching exchanges, digital voltmeters, digital
counters, electronic calculators and digital displays.
o Computer architecture deals with the specification of the instruction set and the
hardware units that implement the instructions.
o Computer hardware consists of electronic circuits, displays, magnetic and optic storage
media and also the communication facilities.
o Functional units are a part of a CPU that performs the operations and calculations called
for by the computer program.
o 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 five main components namely, Input unit, Central Processing Unit,
Memory unit Arithmetic & logical unit, Control unit and an Output unit.
Input unit
o Input units are used by the computer to read the data. The most commonly used input
devices are keyboards, mouse, joysticks, trackballs, microphones, etc.
o 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.
Memory unit
o 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.
o The Memory unit can be categorized in two ways namely, primary memory and
secondary memory.
o It enables a processor to access running execution applications and services that are
temporarily stored in a specific memory location.
o Primary storage is the fastest memory that operates at electronic speeds. Primary
memory contains a large number of semiconductor storage cells, capable of storing a bit
of information. The word length of a computer is between 16-64 bits.
o It is also known as the volatile form of memory, means when the computer is shut down,
anything contained in RAM is lost.
o Cache memory is also a kind of memory which is used to fetch the data very soon. They
are highly coupled with the processor.
o The most common examples of primary memory are RAM and ROM.
o Secondary memory is used when a large amount of data and programs have to be
stored for a long-term basis.
o It is also known as the Non-volatile memory form of memory, means the data is stored
permanently irrespective of shut down.
o The most common examples of secondary memory are magnetic disks, magnetic tapes,
and optical disks.
Control unit
o 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.
o The control unit is also known as the nerve center of a computer system.
o 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.
Output Unit
o 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.
o 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.
o The most common example of an output device is a monitor.
Buses
A bus is a set of wires. The elements of the computer are linked to the buses. It can
transfer data from one element to another, the source element outputs data onto the
bus. The destination element then inputs this information from the bus. As the
complexity of a computer system improves, it becomes more effective (in methods of
minimizing connections) at using buses instead of a direct connection between each
pair of devices.
Buses use less area on a circuit board and need less power than a huge number of
direct connections. It can also need fewer pins on the chip or chips that includes the
CPU. The system has three buses as shown in the figure. The uppermost bus is the
address bus. When the CPU reads data or instructions from or writes data to memory,
it should determine the address of the memory location it needs to access.
It outputs this address to the memory bus, memory inputs this address from the
address bus and uses it to access the suitable memory location. Each I/O device
including a keyboard, monitor, or disk drive, has a specific address as well.
When accessing an I/O device, the CPU locates the address of the device on the
address bus. Each device can read the address off of the bus and specify whether it is
the device being accessed by the CPU.
Data is shared via the data bus. When the CPU fetches information from memory, it
first outputs the memory address on its address bus. Therefore memory outputs the
data onto the data bus, the CPU can read the information from the data bus. When
writing data to memory, the CPU first outputs the address onto the address bus,
therefore outputs the data onto the data bus.
The control bus is different from the other two buses. The address bus includes n lines,
which associate to transit one n-bit address value. The lines of the data bus work
simultaneously to send a single, multi-bit value.
In contrast, the control bus is a collection of individual control signals. These signals
indicate whether data is to be read into or written out of the CPU, whether the CPU is
accessing memory or an I/O device, and whether the I/O device or memory is read to
transfer data.
Although this bus is shown in the figure, it is a set of unidirectional signals. These
signals are output from the CPU to the memory and I/O subsystems, even though a few
are output by these subsystems to the CPU. A system can have an order of buses. For
instance, it can use its address, data, and control buses to access memory and an I/O
controller. The I/O controller can access all I/O devices using a second bus known as
the I/O bus or a local bus.
Bus architecture
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.
There are three types of buses.
1. Address bus –
It is a group of conducting wires which carries address only.Address bus is
unidirectional because data flow in one direction, from microprocessor to
memory or from microprocessor to Input/output devices (That is, Out of
Microprocessor).
Length of Address Bus of 8085 microprocessor is 16 Bit (That is, Four
Hexadecimal Digits), ranging from 0000 H to FFFF H, (H denotes
Hexadecimal). The microprocessor 8085 can transfer maximum 16 bit
address which means it can address 65, 536 different memory location.
The Length of the address bus determines the amount of memory a system
can address.Such as a system with a 32-bit address bus can address 2^32
memory locations.If each memory location holds one byte, the addressable
memory space is 4 GB.However, the actual amount of memory that can be
accessed is usually much less than this theoretical limit due to chipset and
motherboard limitations.
2. Data bus –
It is a group of conducting wires which carries Data only.Data bus is
bidirectional because data flow in both directions, from microprocessor to
memory or Input/Output devices and from memory or Input/Output devices
to microprocessor.
Length of Data Bus of 8085 microprocessor is 8 Bit (That is, two
Hexadecimal Digits), ranging from 00 H to FF H. (H denotes Hexadecimal).
When it is write operation, the processor will put the data (to be written) on
the data bus, when it is read operation, the memory controller will get the
data from specific memory block and put it into the data bus.
The width of the data bus is directly related to the largest number that the
bus can carry, such as an 8 bit bus can represent 2 to the power of 8 unique
values, this equates to the number 0 to 255.A 16 bit bus can carry 0 to
65535.
3. Control bus –
It is a group of conducting wires, which is used to generate timing and
control signals to control all the associated peripherals, microprocessor uses
control bus to process data, that is what to do with selected memory
location. Some control signals are:
Memory read
Memory write
I/O read
I/O Write
Opcode fetch
If one line of control bus may be the read/write line.If the wire is low (no
electricity flowing) then the memory is read, if the wire is high (electricity is
flowing) then the memory is written.
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 another bus
requesting processor unit. The controller that has access to a bus at an
instance is known as a 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 in time. To resolve these conflicts, the 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 the current bus master.
There are two approaches to bus arbitration:
1. Centralized bus arbitration –
A single bus arbiter performs the required arbitration.
Advantages:
Simplicity and Scalability.
The user can add more devices anywhere along the chain, up to a certain
maximum value.
Disadvantages:
The value of priority assigned to a device depends on the position of the
master bus.
Propagation delay arises in this method.
If one device fails then the entire system will stop working.
Advantages –
This method does not favor any particular device and processor.
The method is also quite simple.
Disadvantages –
Adding bus masters is difficult as increases the number of address lines of
the circuit.
If one device fails then the entire system will not stop working.
(iii) Fixed priority or Independent Request method –
In this, 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.
Advantages –
This method generates a fast response.
Disadvantages –
Hardware cost is high as a large no. of control lines is required.
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.
Note: The number of multiplexers needed to construct the bus is equal to the number of bits
in each register. The size of each multiplexer must be 'k * 1' since it multiplexes 'k' data
lines. For instance, a common bus for eight registers of 16 bits each requires 16
multiplexers, one for each line in the bus. Each multiplexer must have eight data input lines
and three selection lines to multiplex one significant bit in the eight registers.
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.
o The outputs generated by the four buffers are connected to form a single bus
line.
o Only one buffer can be in active state at a given point of time.
o The control inputs to the buffers determine which of the four normal inputs will
communicate with the bus line.
o A 2 * 4 decoder ensures that no more than one control input is active at any
given point of time.
Memory Transfer
Most of the standard notations used for specifying operations on memory transfer are
stated below.
o The transfer of information from a memory unit to the user end is called
a Read operation.
o The transfer of new information to be stored in the memory is called
a Write operation.
o A memory word is designated by the letter M.
o We must specify the address of memory word while writing the memory transfer
operations.
o The address register is designated by AR and the data register by DR.
o Thus, a read operation can be stated as:
1. Read: DR ← M [AR]
o The Read statement causes a transfer of information into the data register (DR)
from the memory word (M) selected by the address register (AR).
o And the corresponding write operation can be stated as:
1. Write: M [AR] ← R1
o The Write statement causes a transfer of information from register R1 into the
memory word (M) selected by address register (AR).
General Register Organization
A set of flip-flops forms a register. A register is a unique high-speed storage area in the
CPU. They include combinational circuits that implement data processing. The
information is always defined in a register before processing. The registers speed up
the implementation of programs.
Registers implement two important functions in the CPU operation are as follows −
It can support a temporary storage location for data. This supports the directly
implementing programs to have fast access to the data if required.
It can save the status of the CPU and data about the directly implementing
program.
Example − Address of the next program instruction, signals get from the external
devices and error messages, and including different data is saved in the registers.
If a CPU includes some registers, therefore a common bus can link these registers. A
general organization of seven CPU registers is displayed in the figure.
The CPU bus system is managed by the control unit. The control unit explicit the data
flow through the ALU by choosing the function of the ALU and components of the
system.
Consider R1 ← R2 + R3, the following are the functions implemented within the CPU −
MUX A Selector (SELA) − It can place R2 into bus A.
MUX B Selector (SELB) − It can place R3 into bus B.
ALU Operation Selector (OPR) − It can select the arithmetic addition (ADD).
Decoder Destination Selector (SELD) − It can transfers the result into R1.
The multiplexers of 3-state gates are performed with the buses. The state of 14 binary
selection inputs determines the control word. The 14-bit control word defines a micro-
operation.
The encoding of register selection fields is specified in the table.
Encoding of Register Selection Field
001 R1 R1 R1
010 R2 R2 R2
011 R3 R3 R3
100 R4 R4 R4
101 R5 R5 R5
110 R6 R6 R6
111 R7 R7 R7
There are several micro-operations are implemented by the ALU. Few of the operations
implemented by the ALU are displayed in the table.
Encoding of ALU Operations
01010 OR A and B OR
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 −
Example: MOV AL, 35H (move the data 35H into AL register)
Register mode: In register addressing the operand is placed in one of 8 bit
or 16 bit general purpose registers. The data is in the register that is
specified by the instruction.
Here one register reference is required to access the data.
The 8086 CPUs let you access memory indirectly through a register using
the register indirect addressing modes.
MOV AX, [BX](move the contents of memory location s
addressed by the register BX to the register AX)
Auto Indexed (increment mode): Effective address of the operand is the
contents of a register specified in the instruction. After accessing the
operand, the contents of this register are automatically incremented to point
to the next consecutive memory location.(R1)+.
Here one register reference,one memory reference and one ALU operation
is required to access the data.
Example:
Add R1, (R2)+ // OR
R1 = R1 +M[R2]
R2 = R2 + d
Useful for stepping through arrays in a loop. R2 – start of array d – size of an
element
Auto indexed ( decrement mode): Effective address of the operand is the
contents of a register specified in the instruction. Before accessing the
operand, the contents of this register are automatically decremented to point
to the previous consecutive memory location. –(R1)
Here one register reference,one memory reference and one ALU operation
is required to access the data.
Example:
Add R1,-(R2) //OR
R2 = R2-d
R1 = R1 + M[R2]
Auto decrement mode is same as auto increment mode. Both can also be used
to implement a stack as push and pop . Auto increment and Auto decrement
modes are useful for implementing “Last-In-First-Out” data structures.
Direct addressing/ Absolute addressing Mode (symbol [ ]): The
operand’s offset is given in the instruction as an 8 bit or 16 bit displacement
element. In this addressing mode the 16 bit effective address of the data is
the part of the instruction.
Here only one memory reference operation is required to access the data.