UNIT - III Remaining Notes
UNIT - III Remaining Notes
Control Unit
The Control Unit is the part of the computer’s central processing unit (CPU), which directs the operation
of the processor. It was included as part of the Von Neumann Architecture by John von Neumann. It is
the responsibility of the control unit to tell the computer’s memory, arithmetic/logic unit, and input and
output devices how to respond to the instructions that have been sent to the processor. It fetches internal
instructions of the programs from the main memory to the processor instruction register, and based on this
register contents, the control unit generates a control signal that supervises the execution of these
instructions.
Examples of devices that require a CU are:
Control Processing Units(CPUs)
Graphics Processing Units(GPUs)
A computer consists of a set of components or modules. A module is a separate unit of software and
hardware. Information is exchanged through these modules. Basically, there are three types of modules:
Processor module
The processor reads instructions and data, writes out data after processing and uses control signals to
control the overall operations of the system. It also receives interrupt signals.
Memory module
It consists of N words of equal length. Each word is assigned a unique numerical address(0, 1, 2…..N-1).
A word of data can be read from or written into the memory. The nature of the operation is indicated by
the read and write control signals. The location for the operation is specified by an address.
I/O module
There are two operations, read and write. I/O module may control more than one external device. A user
can refer to each of the interfaces to an external device as port and each can be assigned a unique address.
There are also external data paths for the input and output of data with an external device. I/O module
may be able to send interrupt signals to the processor.
VII. Instruction Set Architecture & Instruction Execution Cycle
Computer function:
The basic function performed by a computer is execution of a program, which consists of a set of
instructions stored in memory. Instruction processing consists of two steps: The processor reads (fetches)
instructions from memory one at a time and executes each instruction. Program execution consists of
repeating the process of instruction fetch and instruction execution.
A program residing in the memory unit of a computer consists of a sequence of instructions. These
instructions are executed by the processor by going through a cycle for each instruction.
This image represents the basic operation cycle of a computer’s central processing unit (CPU), often
referred to as the instruction cycle or fetch-decode-execute cycle. Let's break it down:
Components:
Key Steps:
Combinations:
Green (Fetch Phase): Highlights the steps where the instruction is fetched from memory.
Blue (Decode Phase): Shows the decoding of the instruction.
Orange (Execute Phase): Where the actual operation based on the instruction is performed.
Conditions: Represent the decision-making points that guide the flow of execution based on the
type of instruction.
Instruction Fetch and Execute:
At the beginning of each instruction cycle, the processor fetches an instruction from
memory. The program counter (PC) holds the address of the instruction to be fetched next, the processor
always increments the PC after each instruction fetch so that it will fetch the next instruction in sequence.
For example, consider a computer in which each instruction occupies one 16-bit word of
memory. If the program counter is set to location 300. The processor will next fetch the instruction at
location 300. On next instruction cycles, it will fetch instructions from locations 301,302,303,and so on.
The fetched instruction is loaded into a register in the processor known as the instruction
register (IR). The processor interprets the instruction and performs the required action. In general, these
actions fall into four categories:
Processor-memory: Data may be transferred from processor to memory or from memory to processor.
Processor-I/O: Data may be transferred to or from a peripheral device by transferring between the
processor and an I/O module.
In the interrupt cycle, the processor checks to see if any interrupts have occurred. If no
interrupts are pending, the processor proceeds to the fetch cycle and fetches the next instruction of the
current program. If an interrupt is pending, the processor does the following:
• It suspends execution of the current program being executed and saves its context
• It sets the program counter to the starting address of an interrupt handler routine.
The processor now proceeds to the fetch cycle and fetches the first instruction in the interrupt handler
program, which will service the interrupt. When the interrupt handler routine is completed, the processor
can resume execution of the user program at the point of interruption.
Types of Interrupts:
Program Interrupts: Generated by some condition that occurs as a result of an instruction execution,
such as arithmetic overflow, division by zero, attempt to execute an illegal machine instruction, or
reference outside a user’s allowed memory space.
Timer Interrupts: Generated by a timer within the processor. This allows the operating system to
perform certain functions on a regular basis.
Performance:
The most important measure of the performance of a computer is how quickly it can execute
programs. The speed with which a computer executes program is affected by the design of its hardware.
For best performance, it is necessary to design the compiles, the machine instruction set, and the hardware
in a coordinated way.
Processor clock:
Processor circuits are controlled by a timing signal called clock. The clock designer the regular
time intervals called clock cycles. To execute a machine instruction the processor divides the action to be
performed into a sequence of basic steps that each step can be completed in one clock cycle. The length P
of one clock cycle is an important parameter that affects the processor performance.
VIII. Register Transfer Language
Computer registers:
Data Register(DR) : hold the operand(Data) read from memory.
Accumulator Register(AC): general purpose processing register.
Instruction Register(IR): hold the instruction read from memory.
Temporary Register(TR): hold a temporary data during processing.
Address Register(AR): hold a memory address, 12 bit width.
Program Counter(PC): It hold the address of the next instruction to be read from memory after the
current instruction is executed.
o Instruction words are read and executed in sequence unless a branch instruction is encountered »A
branch instruction calls for a transfer to a nonconsecutive instruction in the program.
o address part of a branch instruction is transferred to PC to become the address of the next instruction.
Input Register(INPR): receive an 8-bit character from an input device.
Output Register(OUTR): hold an 8-bit character for an output device.
These digital modules are interconnected with some common data and control paths to form a complete
digital system.
Moreover, digital modules are best defined by the registers and the operations that are performed on the
data stored in them.
The operations performed on the data stored in registers are called Micro-operations.
The internal hardware organization of a digital system is best defined by specifying:
In a computer system, data transfer takes place between processor registers and memory and between
processor registers and input-output systems. These data transfer can be represented by standard notations
given below:
Register Transfer
The term Register Transfer refers to the availability of hardware logic circuits that can perform a given
micro-operation and transfer the result of the operation to the same or another register.
Most of the standard notations used for specifying operations on various registers are stated below.
o Typically, most of the users want the transfer to occur only in a 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.
o It is more convenient to specify a control function (P) by separating the control variables from the
register transfer operation. For instance, the following statement defines the data transfer
operation under a specific control function (P).
P: R2 ← R1
The following image shows the block diagram that depicts the transfer of data from R1 to R2.
Here, the letter 'n' indicates the number of bits for the register. The 'n' outputs of the register R1 are
connected to the 'n' inputs of register R2.
A load input is activated by the control variable 'P' which is transferred to the register R2.
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.
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:
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:
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).
Arithmetic Micro-operations:
In general, the Arithmetic Micro-operations deals with the operations performed on numeric data
stored in the registers.
1. Addition
2. Subtraction
3. Increment
4. Decrement
5. Shift
Binary Adder:
The Add micro-operation requires registers that can hold the data and the digital components that
can perform the arithmetic addition.
A Binary Adder is a digital circuit that performs the arithmetic sum of two binary numbers provided with
any length.
A Binary Adder is constructed using full-adder circuits connected in series, with the output carry from
one full-adder connected to the input carry of the next full-adder.
The following block diagram shows the interconnections of four full-adder circuits to provide a 4-bit
binary adder.
o The augend bits (A) and the addend bits (B) are designated by subscript numbers from right to
left, with subscript '0' denoting the low-order bit.
o The carry inputs starts from C0 to C3 connected in a chain through the full-adders. C4 is the
resultant output carry generated by the last full-adder circuit.
o The output carry from each full-adder is connected to the input carry of the next-high-order full-
adder.
o The sum outputs (S0 to S3) generates the required arithmetic sum of augend and addend bits.
o The n data bits for the A and B inputs come from different source registers. For instance, data bits
for A input comes from source register R1 and data bits for B input comes from source register
R2.
o The arithmetic sum of the data inputs of A and B can be transferred to a third register or to one of
the source registers (R1 or R2).
Binary Adder-Subtractor:
The Subtraction micro-operation can be done easily by taking the 2's compliment of addend bits
and adding it to the augend bits.
The Arithmetic micro-operations like addition and subtraction can be combined into one common circuit
by including an exclusive-OR gate with each full adder.
The block diagram for a 4-bit adder-subtractor circuit can be represented as:
o When the mode input (M) is at a low logic, i.e. '0', the circuit act as an adder and when the mode
input is at a high logic, i.e. '1', the circuit act as a subtractor.
o The exclusive-OR gate connected in series receives input M and one of the inputs B.
o When M is at a low logic, we have B⊕ 0 = B.
The full-adders receive the value of B, the input carry is 0, and the circuit performs A plus B.
o When M is at a high logic, we have B⊕ 1 = B' and C0 = 1.
The B inputs are complemented, and a 1 is added through the input carry. The circuit performs
the operation A plus the 2's complement of B.
Binary Incrementer
The increment micro-operation adds one binary value to the value of binary variables stored in a
register. For instance, a 4-bit register has a binary value 0110, when incremented by one the value
becomes 0111.
The increment micro-operation is best implemented by a 4-bit combinational circuit incrementer. A 4-bit
combinational circuit incrementer can be represented by the following block diagram.
o A logic-1 is applied to one of the inputs of least significant half-adder, and the other input is
connected to the least significant bit of the number to be incremented.
o The output carry from one half-adder is connected to one of the inputs of the next-higher-order
half-adder.
o The binary incrementer circuit receives the four bits from A0 through A3, adds one to it, and
generates the incremented output in S0 through S3.
o The output carry C4 will be 1 only after incrementing binary 1111.
The term addressing modes refers to the way in which the operand of an instruction is specified.
The addressing mode specifies a rule for interpreting or modifying the address field of the instruction
before the operand is actually executed.