CO2: 1. Concept of Program Execution/Interpretation
CO2: 1. Concept of Program Execution/Interpretation
1. Fetch the contents of the memory location pointed at by the PC. The contents of this location
are interpreted as an instruction to be executed. Hence, they are stored in the instruction
register (IR). Symbolically this can be written as:
IR = [ [PC] ]
PC = [PC] + 1
3. Carry out the actions specified by the instruction stored in the IR.
R0 <- R1
R0 <- R1 + R2
A <- B
Control function: we can do this by structuring the RTL expression to indicate the controlling
condition. Ex: P: A<- B
Control logic or unit will generate the load signal then only the data from B will be stored in
A within one clock cycle.
Micro-Ops Transfer Serial
Serial transfer is used to specify that a collection of bits are to be moved, but that the
transfer is to occur one bit at a time
The control unit or logic will generate shift signal then only the individual bits will be
shifted from A to B and B to A.
Memory transfers are similar to register transfers, but…Memory to register transfers are
called read operations, while register to memory transfers are called write operations.
RTL expressions for a read operation, assuming the use of an address registers:
AR <- address
DR <- M[AR]
AR <- address
DR <- value
M[AR] <- DR
4. Control Unit
To execute an instruction, the control unit of the CPU must generate the required control
signal in the proper sequence.
To generate the control signal in proper sequence, a wide variety of techniques exist. Most
of these techniques, however, fall into one of the two categories,
• Hardwired Control
• Micro-programmed Control
Hardwired Control:
In this hardwired control techniques, the control signals are generated by means of
hardwired circuit. The main objective of control unit is to generate the control signal in
proper sequence.
In micro-programmed control unit, the logic of the control unit is specified by a micro-
program.
Control word is defined as a word whose individual bits represent the various control
signals.
It is used to store data and instructions. Computer memory is the storage space in the
computer, where data is to be processed and instructions required for processing are stored.
The memory is divided into large number of small parts called cells. Each location or cell has a
unique address.
Cache Memory
Primary Memory/Main Memory or Internal Memory
Secondary Memory or External memory
Cache Memory:
Cache memory is a very high speed semiconductor memory which can speed up the CPU. It acts
as a buffer between the CPU and the main memory. It is used to hold those parts of data and
program which are most frequently used by the CPU.
Advantages
The advantages of cache memory are as follows −
Cache memory is faster than main memory.
It consumes less access time as compared to main memory.
It stores the program that can be executed within a short period of time.
It stores data for temporary use.
Disadvantages
The disadvantages of cache memory are as follows −
Primary memory holds only those data and instructions on which the computer is currently
working. It has a limited capacity and data is lost when power is switched off. It is generally
made up of semiconductor device. These memories are not as fast as registers. The data and
instruction required to be processed resides in the main memory. It is divided into two
subcategories RAM and ROM.
1. RAM: It is a read/write memory which stores data until the machine is working. Random
Access Memories are volatile in nature. As soon as the computer is switched off, the contents
of memory are also lost.
2. ROM: Read only memories are non-volatile in nature. The storage is permanent, but it is
read only memory. We cannot store new information in ROM.
EPROM (Erasable and Programmable Read Only Memory): Erase data by UV rays.
EEPROM (Electrically Erasable Programmable ROM): Erase and write through electrical pulses.
6. CPU-memory interaction
1. New
2. Ready
3. Running
4. Blocked / Waiting
5. Exit
New: When a new process is created, then this new process is in the new state.
Ready: All those processes that are loaded on RAM and waiting for CPU are in ready state.
Running: All processes that are running on the CPU are in running state.
Blocked: All processes that leave the CPU and move to the waiting state are in the blocked
state. When CPU becomes free, processes from blocked state again move to the ready
state, and from ready to Running state.
Exit / Terminated: A process that is terminated from CPU and RAM is in exit state.
Uni-Program:
Memory
Multi-Program:
Cache Memory
It is the fact that CPU is a faster device and memory is a relatively slower device.
Memory access is the main bottleneck for the performance efficiency. If a faster memory
device can be inserted between main memory and CPU, the efficiency can be increased.
The faster memory that is inserted between CPU and Main Memory is termed as Cache
memory.
If the processor finds that the memory location is in the cache, a cache hit has occurred
and data is read from cache.
If the processor does not find the memory location in the cache, a cache miss has
occurred. For a cache miss, the cache allocates a new entry and copies in data from main
memory, and then the request is fulfilled from the contents of the cache.
The performance of cache memory is frequently measured in terms of a quantity
called Hit ratio.
Hit ratio = hit / (hit + miss) = no. of hits/total accesses
We can improve Cache performance using higher cache block size, higher associativity,
reduce miss rate, reduce miss penalty, and reduce the time to hit in the cache.
Cache memory mapping:
It is a method of loading the data of main memory into cache memory. In more technical
sense content of main memory is brought into cache memory which is referenced by the
CPU. This can be done in three ways –
1. Direct mapping
2. Associative mapping
3. Block-set-associative mapping
The virtual address space is used to develop a process. The special hardware unit , called
Memory Management Unit (MMU) translates virtual address to physical address. When the
desired data is in the main memory, the CPU can work with these data. If the data are not in
the main memory, the MMU causes the operating system to bring into the memory from the
disk.
The conversion of the virtual or logical address into the physical address is done
by a special hardware unit known as MMU (Memory Management Unit). When
the required data are found in the main memory, then they are fetched to the
cache memory for further processing. If required data are not found in the main
memory, the MMU with the help of operating system brought the data from
secondary storage to main memory.