Professional Documents
Culture Documents
Coal Lab Exeersice-1
Coal Lab Exeersice-1
Coal Lab Exeersice-1
1. Processors's Structure
Identify the different components of a CPU and their functions. Draw a block
diagram of a CPU and label each component?
CPU consist of 3 parts
Arithmetic Logic Unit (ALU) , Control Unit (CU) and Storage unit.
The CPU is like the heart/brain of the computer. The user does not get the desired output, without the
necessary option taken by the CPU. The Central processing unit (CPU) is responsible for the processing
of all the instructions which are given by the user to the computer system .
Control Unit
When the control unit receives an instruction set or information, it converts the instruction set to
control signals then; these signals are sent to the central processor for further processing. The control
unit understands which operation to execute, accurately, and in which order.
Arithmetic Logic Unit
The arithmetic and logical unit is the combinational digital electronic circuit that can perform arithmetic
operations on integer binary numbers.It presents the arithmetic and logical operation. The outputs of
ALU will change asynchronously in response to the input. The basic arithmetic and bitwise logic
functions are supported by ALU.
Storage Unit
It is used to store data as well address of current execution via registers and L1 cache.
Address Bus
The address bus is another set of electrical lines or wires that is used to specify the memory location or
the I/O (Input/Output) device to which data needs to be transferred or retrieved. In other words, it is
used to indicate the location of data.
Control Bus
The control bus is a set of lines used for control signals that manage the operation of various
components within the computer system. These control signals include read, write, memory enable, I/O
request, and various other control commands.
Control signals are essential for coordinating the timing and sequence of actions within the system, such
as when to read or write data, when to execute certain operations, and when to signal external devices
for input or output.
The control unit oversees instruction flow within the CPU. It fetches instructions from memory using the
program counter, decodes them to determine the operation and operands, and generates control
signals for execution. It manages the execution of instructions, coordinates data transfers using the
buses, and ensures instructions are executed in the correct sequence, thus facilitating efficient data
processing in the computer.
Instruction Decode: The control unit decodes the instruction to understand the operation and operands
involved. It generates control signals to execute the instruction.
Execution: It coordinates the execution of the instruction by controlling the Arithmetic Logic Unit (ALU)
and other relevant components in the CPU. It ensures that operations occur in the right sequence.
Memory Access: If the instruction involves data transfer to or from memory, the control unit uses the
address bus to specify the memory location and the data bus for data transfer.
Write-back: After execution, the control unit updates registers or memory as needed.
By consistently repeating these steps, the control unit manages the orderly execution of instructions,
ensuring that tasks are performed according to the program's instructions.
4.Introduction to assembly language
Write a simple assembly language code for adding 2 numbers and compare to its
high level languages equivalent code.
Assembly code
dosseg
.model small
.stack 100h
.data
.code
main proc
mov bl,2
mov dl,3
add dl,bl
add dl,48 ;ascii adjustment
mov ah,2
int 21h
mov ah,4ch
int 21h
main endp
end main
C++ Code
#include<iostream>
using namespace std;
void main()
{
cout<<2+3;
}
Both display 5 in result but C++ (high level language) code is easy to write and implement as compared
to assembly code
Addressing modes:
Immediate Mode: Values are directly specified in the instruction, e.g., MOV AX, 42 loads the value 42
into register AX.
Register Mode: Operands are stored in registers, offering fast access, e.g., ADD AX, BX adds the values in
registers AX and BX.
Direct Mode: Memory locations are directly accessed using addresses, e.g., MOV AL, [0x1234] loads the
value at memory address 0x1234 into register AL.
6.Components of CPU
Experiment with the arithmetic and logic operations of ALU .Investigate the role
of the control unit in managing CPU organization.
In an ALU (Arithmetic Logic Unit), arithmetic operations include addition, subtraction, multiplication, and
division, while logic operations involve bitwise operations like AND, OR, and NOT. The ALU performs
these operations based on control signals from the control unit.
The control unit manages CPU organization by coordinating instruction fetching, decoding, execution,
and memory access. It generates control signals that direct data flow within the CPU, ensuring
instructions are executed in the correct order and coordinating interactions with memory and
peripherals. It's a key component for efficient CPU operation.