Syllabus
Syllabus
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.
Computer architecture deals with the specification of the instruction set and the hardware units that
implement the instructions.
Computer hardware consists of electronic circuits, displays, magnetic and optic storage media and
also the communication facilities.
Functional units are a part of a CPU that performs the operations and calculations called for by the
computer program.
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
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: 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.
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. 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.
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.
Arithmetic & logical unit: 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
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.
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.
Data Bus: As the name suggests, data bus is used for transmitting the data /
instruction from CPU to memory/IO and vice-versa. It is bi-directional. The width
of a data bus refers to the number of bits (electrical wires) that the bus can carry
at a time. Each line carries 1 bit at a time. So, the number of lines in data bus
determine how many bits can be transferred parallelly. The width of data bus is
an important parameter because it determines how much data can be
transmitted at one time. The wider the bus width, faster would be the data flow
on the data bus and thus better would be the system performance.
Examples-
A 32-bit bus has thirty two (32) wires and thus can transmit 32 bits of data at a time.
A 64-bit bus has sixty four (64) wires and thus can transmit 64 bits of data at a time.
8
Address Bus : As the name suggests, address bus is used to carry address from
CPU to memory/IO devices. It is used to identify the particular location in
memory. It carries the source or destination address of data i.e. where to store or
from where to retrieve the data. It is uni-directional.
9
Example- When CPU wants to read or write data, it sends the memory read or
memory write control signal on the control bus to perform the memory read
or write operation from the main memory and the address of the memory
location is sent on the address bus.
If CPU wants to read data stored at the memory location (address) 4, the CPU send the value
4 in binary on the address bus.
The width of address bus determines the amount of physical memory addressable
by the processor.
Inother words, it determines the size of the memory that the computer can use.
The wider is the address bus, the more memory a computer will be able to use.
The addressing capacity of the system can be increased by adding more address lines.
Examples-
An address bus that consists of 16 wires can convey 216 (= 64K) different addresses.
An address bus that consists of 32 wires can convey 232 (= 4G) different addresses.
Control Bus : As the name suggests, control bus is used to transfer the control
and timing signals from one component to the other component. The CPU uses
control bus to communicate with the devices that are connected to the computer
system. The CPU transmits different types of control signals to the system
components. It is bi-directional.
Typical control signals hold by control bus
Memory read – Data from memory address location to be placed
on data bus. Memory write – Data from data bus to be placed on
memory address location. I/O Read – Data from I/O address
location to be placed on data bus.
I/O Write – Data from data bus to be placed on I/O address location.
Other control signals hold by control bus are interrupt, interrupt acknowledge,
bus request, bus grant and several others. The type of action taking place on
the system bus is indicated by these control signals.
Example-
10
When CPU wants to read or write data, it sends the memory read or memory write
control signal on the control bus to perform the memory read or write operation
from the main memory. Similarly, when the processor wants to read from an I/O
device, it generates the I/O read signal.
11
Bus Arbitration is the procedure by which the active bus master accesses the bus,
relinquishes control of it, and then transfers it to a different bus-seeking processor
unit. A bus master is a controller that can access the bus for a given instance.
A conflict could occur if multiple DMA controllers, other controllers, or
processors attempt to access the common bus simultaneously, yet only one is
permitted to access. Bus master status can only be held by one processor or
controller at once. By coordinating the actions of all devices seeking memory
transfers, the Bus Arbitration method is used to resolve these disputes
There are two approaches to bus arbitration:
Centralized Bus Arbitration - In which the necessary arbitration is carried out by a lone
bus arbitrator.
Distributive Bus Arbitration - In which every device takes part in choosing the new bus
master. A 4bit identification number is allocated to each device on the bus. The created ID
will decide the device's priority
a) Centralized Bus Arbitration Methodologies : There are three methods of Centralized
Bus Arbitration, which are listed below:
i. Daisy Chaining method: It is a simple and cheaper method where all the bus masters
use the same line for making bus requests. 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, therefore any other
requesting module will not receive the grant signal and hence cannot access the bus.
During any bus cycle, the bus master may be any device – the processor or any DMA
controller unit, connected to the bus.
Advantages:
12
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.
ii. Polling or Rotating Priority method: In this, the controller is used to generate the
address for the master(unique priority), the number of address lines required depends
on the number of masters connected in the system. The controller generates a sequence
of master addresses. When the requesting master recognizes its address, it activates the
busy line and begins to use the bus.
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.
In this scheme each device on the bus is assigned a4-bit identification number.
The number of devices connected on the bus when one or more devices request for the
control of bus, they assert the start-arbitration signal and place their 4-bit ID numbers on
arbitration lines, ARB0 through ARB3.
These four arbitration lines are all open-collector. Therefore, more than one device can place
their 4-bit ID number to indicate that they need to control of bus. If one device puts 1 on the
bus line and another device puts 0 on the same bus line, the bus line status will be 0. Device
reads the status of all lines through inverters buffers so device reads bus status 0as logic 1.
Scheme the device having highest ID number has highest priority.
When two or more devices place their ID number on bus lines then it is necessary to identify
the highest ID number on bus lines then it is necessary to identify the highest ID number
from the status of bus line. Consider that two devices A and B, having ID number 1 and 6,
respectively are requesting the use of the bus.
Device A puts the bit pattern 0001, and device B puts the bit pattern 0110. With this
combination the status of bus-line will be 1000; however because of inverter buffers
code seen by both devices is 0111.
Each device compares the code formed on the arbitration line to its own ID, starting from
the most significant bit. If it finds the difference at any bit position, it disables its drives at
that bit position and for all lower-order bits.
It does so by placing a 0 at the input of their drive. In our example, device detects a
different on line ARB2 and hence it disables its drives on line ARB2, ARB1 and ARB0.
This causes the code on the arbitration lines to change to 0110. This means that device B
has won the race.
The decentralized arbitration offers high reliability because operation of the bus is
not dependent on any single device.
1.5. 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.
A processor register may hold an instruction, a storage address, or any data (such as bit
sequence or individual characters).
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.
Following is the list of some of the most common registers used in a basic computer:
The Memory unit has a capacity of 4096 words, and each word contains 16 bits.
The Data Register (DR) contains 16 bits which hold the operand read from the memory
location.
The Memory Address Register (MAR) contains 12 bits which hold the address for the
memory location.
The Program Counter (PC) also contains 12 bits which hold the address of the next
instruction to be read from memory after the current instruction is executed.
The Accumulator (AC) register is a general purpose processing register.
The instruction read from memory is placed in the Instruction register (IR).
The Temporary Register (TR) is used for holding the temporary data during the processing.
The Input Registers (IR) holds the input characters given by the user.
The Output Registers (OR) holds the output after processing the input data.
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).
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
Most of the standard notations used for specifying operations on memory transfer
are stated below.
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:
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:
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).
1.7. Processor organizations
Processor Organizations:
Implementation of Stack
1. Register Stack
2. Memory Stack.
Register Stack
A stack can be organized as a collection of finite number of registers that are used
to store temporary information during the execution of a program. The stack
pointer (SP) is a register that holds the address of top of element of the stack.
Memory Stack
The addressing modes refer to how someone can address any given memory
location. Five different addressing modes or five ways exist using which this can
be done.
You can find the list below, showing the various kind of addressing modes:
Implied Mode
Immediate Mode
Register Mode
Register Indirect Mode
Autodecrement Mode
Autoincrement Mode
Direct Address Mode
Indirect Address Mode
Indexed Addressing Mode
Before getting into discussing the addressing modes, one must understand more
about the “effective address” term.
Register Mode
In the register mode, the operands exist in those registers that reside within a CPU.
In this case, we select a specific register from a certain register field in the given
instruction. The k-bit field is capable of determining one 2k register.