Mca Unit 1
Mca Unit 1
CO
Course Outcomes K - Level
No’s
and Project
Management
(SEPM)
and Project
Management
(SEPM)
reference instruction, I/O interruption, Adder and Subtractor circuits, Booth Multiplication
Algorithm, Pipelining Review, control hazards and the motivation for caches, cache
and Project
Management
(SEPM)
and Project
Management
(SEPM)
Micro Architecture
Describes how a particular processor will handle and implement instructions from ISA.
and Project
System design Management
(SEPM)
It includes the other entire hardware component within the system such as virtualization,
multiprocessing.
System design
Software interface Processor Design 10
8 9 Memory
Instruction set architecture
and Project
Management
(SEPM)
and Project
Management
(SEPM)
It is used for entering data and programs from user to computer system for
processing.
Most commonly used input device are keyboard and mouse.
2. Output unit:
It is used for displaying the results produced by the system after processing.
Most commonly used output devices are monitor, printer, plotter etc.
and Project
Management
(SEPM)
•It is used for storing data and instruction before and after processing.
•It is divided into primary memory and secondary memory.
•RAM and ROM
Software components
1. System software
2. Application software
1. System software:
Project
interpreters, debuggers and operating system
Manage
Department of Computer Science and Engineering
Software Components
2. Application software:
Operating system:
OS Is a collection of routines that tells the computer what to do under a variety of
conditions.
Instructions take a vital role for the proper working of the computer.
An appropriate program consisting of a list of instructions is stored in the
memory so that the tasks can be started.
The memory brings the Individual instructions into the processor, which executes
the specified operations.
Data which is to be used as operands are moreover also stored in the memory.
and Project
Management
(SEPM)
Example:
Add LOCA, R0
This instruction adds the operand at memory location LOCA to the operand which
will be present in the Register R0.
Example can be written as follows:
Load LOCA, R1
Add R1, R0
First instruction sends the contents of the memory location LOCA into processor
Register R0
Meanwhile the second instruction adds the contents of Register R1 and R0 and
places the output in the Register R1.
The memory and the processor are swapped and are started by sending the address
of the memory location to be accessed to the memory unit and issuing the
appropriate control signals.
and Project
The data is then transferred to or from the memory.
Management
(SEPM)
Each instruction of cpu has specific information field which are required to execute
and Project
Management
(SEPM)
Ex: ADD, SUB, AND, XOR, SHIFT, ADI,INR, DCR, CMP etc…
The data has transfer between memory and register. Ex: STR
and Project
Management
(SEPM)
The data has transfer between cpu register and I/O devices. Ex: LOAD,STORE,
MOVE.
and Project
Management
(SEPM)
and Project
Management
(SEPM)
and Project
Management
(SEPM)
and Project
Management
(SEPM)
and Project
Management
(SEPM)
It is also known as indirect addressing; a register act as a pointer to an operand located at the memory
The address of the operand is the sum of the offset value and the base value. The size of the operand is
limited to 16 bits.
r0 A=10
R1 B =20 -----
OPCODE addressing 000lk
field b=50 R2 C=20
and Project r3 Jhgk
Management
Effective address r4 50 ----
B 000ka
(SEPM)
purtner
Department of Computer Science and Engineering
Addressing modes Cont…
and Project
Management
(SEPM)
It is the memory address which (mostly) embedded in the instructions. It is specifically used for J-type
instructions, j and jal.
The instruction format is 6 bits of opcode and 26 bits for the immediate value.
The effective address will always be a word aligned.
OPCODE addressing
field a=20 memory
A=20
B=10
3=20
and Project
Management
(SEPM) puter
A
and Project
Management
(SEPM)
The instruction contains the address of memory which refers the address of the operand.
7) Auto increment addressing mode:
After accessing the operand, the content of this register are incremented to address the next location
Example: Mov R0,(R2)+
•R2=20
8) Auto decrement addressing mode
The content of register specified in the instruction are first decremented and then
used an effective address of the operand
Example : Mov – (R0),R2
and Project
Management
(SEPM)
Instructions are kept in computers as a series of high and low electric signals
and represented as number.
Each piece of an instruction can be considered as an individual number .
Placing these number side by side forms the instruction.
Instruction format:
A form of representation of an instruction composed of fields of binary numbers.
In MIPS ISA instructions fall into 3 categories:
1. R- format: register format
2. I-format: intermediate format
3. J – format: Jumpand
format
Project
Management
(SEPM)
and Project
Management
(SEPM)
and Project
Management
(SEPM)
It is connected to the address lines of the system bus. It specifies the address in memory for a read or
write operation.
It is connected to the data lines of the system bus. It contains the value to be stored in memory or the
last value read from the memory.
Program Counter(PC) :
Fetch:
The CPU retrieves the instruction from memory.
The instruction is typically stored at the address specified by the program counter
(PC).
The PC is then incremented to point to the next instruction in memory.
Decode:
The CPU interprets the instruction and determines what operation needs to be
performed.
This involves identifying the opcode and any operands that are needed to execute
the instruction
Execute:
The CPU performs the operation specified by the instruction.
and Project
This may involve reading or writing data from or to memory, performing
Management
arithmetic or logic operations
(SEPM)on data, or manipulating the control flow of the
program.
4.Fetch operands:
The operands needed for an instruction are fetched during a separate cycle
before the execute cycle.
This is called the fetch operands cycle.
5.Store results
some CPUs, the results of an instruction are stored during a separate cycle after
the execute cycle.
This is called the store results cycle.
6.Interrupt handling:
In some CPUs, interrupt handling may occur during any cycle of the instruction
cycle. and Project
An interrupt is a signalManagement
that the CPU receives from an external device or
(SEPM)
software that requires immediate attention.
When an interrupt occurs, the CPU suspends the current instruction and
executes an interrupt handler to service the interrupt.
Department of Computer Science and Engineering
Memory Reference
The commands or instructions which are in the custom to generate a reference to the memory and
approval to a program to have an approach to the commanded information and that states as to from
where the data is cache continually.
AND
The AND instruction implements the AND logic operation on the bit collection from the register and
the memory word that is determined by the effective address.
ADD
and Project
Management
The ADD instruction adds the content of the memory word that is denoted by the effective address to
(SEPM)
the value of the register.
STA
This saves the content of the register into the memory word that is defined by the
effective address.
The output is next used to the common bus and the data input is linked to the bus. It
needed only one micro-operation.
BUN
The Branch Unconditionally (BUN) instruction can send the instruction that is
determined by the effective address.
They understand that the address of the next instruction to be performed is held by the
PC and it should be incremented by one to receive the address of the next instruction in the
sequence. and Project
Management
If the control needs to implement
(SEPM) multiple instructions that are not next in the sequence,
it can execute the BUN instruction.
BSA
BSA stands for Branch and Save return Address.
These instructions can branch a part of the program (known as subroutine or
procedure).
When this instruction is performed, BSA will store the address of the next
instruction from the PC into a memory location that is determined by the
effective address.
ISZ
The Increment if Zero (ISZ) instruction increments the word determined by
effective address.
If the incremented cost is zero, thus PC is incremented by 1.
A negative value is saved in the memory word through the programmer.
It can influence the zero value after getting incremented repeatedly.
and Project
Thus, the PC is incremented and the next instruction is skipped.
Management
(SEPM)
The method that is used to transfer information between internal storage and
CPU that it is ready for communication and requests the attention of the CPU.
and Project
Management
(SEPM)
The binary information that is received from an external device is usually stored in the
memory unit.
The information that is transferred from the CPU to the external device is originated from
the memory unit.
CPU merely processes the information but the source and target is always the memory unit.
Data transfer between CPU and the I/O devices may be done in different modes.
Data transfer to and from the peripherals may be done in any of the three possible
ways
1.Programmed I/O.
2.Interrupt- initiated I/O.
3.Direct memory access( DMA).
and Project
Management
(SEPM)
and Project
Management
(SEPM)
The data transfer between a fast storage media such as magnetic disk and memory
Thus we can allow the peripherals directly communicate with each other using the
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.
and Project
Management
The DMA controller takes over the
(SEPM)
buses to manage the transfer directly between
Inform the CPU that the device has 1 byte to transfer (i.e. bus grant request)
and Project
Management
Block schematic
(SEPM) of half-adder
The truth table of a half-adder, showing all possible input combinations and the
corresponding outputs are shown below.
Inputs Outputs
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
and Project
Management
(SEPM)
Logic Implementation of Half-adder
and Project
Management
(SEPM)
Block schematic of full-adder
The full adder circuit overcomes the limitation of the half-adder, which can be used to add two bits
only. There are three input variables, eight different input combinations are possible.
Inputs Outputs
A B Cin Sum (S) Carry (Cout)
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
and Project
1
Management1 1 1 1
(SEPM)
Truth Table:
and Project
Implementation of full adder with two half-adders and an OR gate
Management
(SEPM)
A half-subtractor is a combinational circuit that can be used to subtract one binary digit
from another to produce a DIFFERENCE output and a BORROW output.
The BORROW output here specifies whether a ‗1‘ has been borrowed to perform the
subtraction.
Truth Table
Input Output
and Project
Man A B Difference (D) Borrow (Bout)
0 0 0 0
1 1 0 0
and Project
Management
(SEPM)
Inputs Outputs
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1
and Project
Management
(SEPM)
•The booth algorithm is a multiplication algorithm that allows us to multiply the two
signed binary integers in 2's complement, respectively.
•It is also used to speed up the performance of the multiplication process. It is very
efficient too.
•It works on the string bits 0's in the multiplier that requires no additional bit only
shift the right-most string bits and a string of 1's in a multiplier bit weight 2 k to
weight 2m that can be considered as 2k+ 1 - 2m.
BOOTH MULTIPLICATION ALGORITHM
and Project
Management
(SEPM)
In the above flowchart, initially, AC and Qn + 1 bits are set to 0, and the SC is a sequence
counter that represents the total bits set n, which is equal to the number of bits in the
multiplier.
There are BR that represent the multiplicand bits, and QR represents the multiplier bits.
After that, we encountered two bits of the multiplier as Q n and Qn + 1, where Qn represents
the last bit of QR, and Qn + 1 represents the incremented bit of Qn by 1.
Suppose two bits of the multiplier is equal to 10; it means that we have to subtract the
multiplier from the partial product in the accumulator AC and then perform the arithmetic
shift operation (ashr).
and Project
Management
(SEPM)
If the two of the multipliers equal to 01, it means we need to perform the addition of the
multiplicand to the partial product in accumulator AC and then perform the arithmetic
shift operation (ashr), including Qn + 1.
The arithmetic shift operation is used in Booth's algorithm to shift AC and QR bits to the
right by one and remains the sign bit in AC unchanged.
And the sequence counter is continuously decremented till the computational loop is
repeated, equal to the number of bits (n).
and Project
Management
(SEPM)
Booth algorithm gives a procedure for multiplying binary integers in signed 2’s
complement representation in efficient way, i.e., less number of additions/subtractions
required.
It operates on the fact that strings of 0’s in the multiplier require no addition.
and Project
Management
(SEPM)
Normal Multiplication
and Project
Management
(SEPM)
Normal Multiplication
Booth algorithm requires examination of the multiplier bits and shifting of thepartial
product.
Prior to the shifting, the multiplicand may be added to the partial product,subtracted
from the partial product, or left unchanged
and Project
Management
(SEPM)
and Project
Management
(SEPM)
Booth multiplication
and Project
Management
(SEPM)
Booth multiplication
and Project
Management
(SEPM)
and Project
Management
(SEPM)
and Project
Management
(SEPM)
and Project
Management
(SEPM)
and Project
Management
(SEPM)
INSTRUCTIONS FETCH
The IF stage is responsible for obtaining the requested instruction from memory.
The instruction and the program counter are stored in the register as temporary
storage.
DECODE INSTRUCTION
The DI stage is responsible for decoding the instruction and sending out the
various control lines to the other parts of the processor.
and Project
Management
(SEPM)
CALCULATE OPERANDS
and Project
Management
(SEPM)
• The FO and EI stages are responsible for storing and loading values to and from
memory.
• They also responsible for input and output from the processor respectively
and Project
Management
(SEPM)
and Project
Management
(SEPM)
discarded.
and Project
Management
(SEPM)
As a result, when the decision to execute one instruction is reliant on the result of
Cache memory is a small-sized type of volatile computer memory that provides high-
speed data access to a processor and stores frequently used computer programs,
applications and data.
and Project
Management
(SEPM)
When a read request is received from the processor, the contents of the memory
location are transferred into the cache one word at a time.
When the program references any of the locations in this block, the desired
contents are read directly from the cache.
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 block in the main
memory.
The correspondence between the main memory blocks and cache is specified by
a mapping function.
and Project
Management
(SEPM)
MAPPING FUNCTIONS:
There are three types of mapping techniques used in cache memory system
Direct mapping
Associative mapping
Set associative mapping
and Project
Management
(SEPM)
Direct mapping:
The simplest way to determine cache locations in which to store memory blocks
is the direct mapping technique.
Consider a cache of 128 blocks.
The jth block in main memory is mapped onto block j modulo 128 of the cache.
Thus, whenever one of the main memory blocks 0, 128, 256… is loaded in the
cache, it is stored in cache block 0. Block1, 129, 257… are stored in cache block
1, and so on.
and Project
Management
(SEPM)
and Project
Management
(SEPM)
Associative mapping
The main memory block can be placed into any cache block position. In this
case, 12 tag bits are required to identify a memory block when it is resident in the
cache.
The tag bits of an address received from the processor are compared to the tag
bits of each block of the cache to see if the desired block is present.
This is called the associative mapping technique. COMPUTER
ARCHITECTURE 15
It gives complete freedom
and in choosing the cache location in which to place the
Project
Management
memory block. (SEPM)
Thus, the space in the cache can be used more efficiently.
Mapping method.
and Project
Management
(SEPM)
and Project
Management
(SEPM)
In this case, memory blocks 0, 64, 128,….4032 map into cache set 0, and
they can occupy either of the two block positions within this set.
Having 64 sets means that the 6 bit set field of the address determines
which set of the cache might contain the desired block.
The tag field of the address must then be associatively compared to the tags
of the two blocks of the set to check if the desired block is present.
This two way associative
and search
Project is simple to implement.
Management
(SEPM)
Types of Locality
Temporal locality
Spatial locality
Temporal locality:
Temporal locality means recently executed instructions are executed very
soon.
Spatial locality :
Spatial locality means that instructions in close proximity to a recently
executed instruction (with respect to the instructions addresses) are also likely
and Project
to be executed soon Management
(SEPM)
and Project
Management
(SEPM)
and Project
Management
(SEPM)
A superscalar CPU can execute more than one instruction per clock cycle.
and Project
Management
(SEPM)
Digital signal processing systems are more likely to use very-long instruction
and Project
word (VLIW) processors.
Management
(SEPM)