1st Year Chapter 3
1st Year Chapter 3
SHORT QUESTIONS
Q 1: WHAT IS THE FUNCTION OF ALU IN THE COMPUTER?
Ans:
• Arithmetic operations
• Logical operations
! = not equal to
A processor may have more than one ALU than can speed up the operations.
Ans:
There is circuitry in the control unit which uses electrical signals to instruct the whole computer system
for carrying out or executing, already stored program instructions. Its name clearly shows that it controls
and co-ordinates computer components. It extracts instructions from memory and decodes and
executes them. In fact, it regulates the flow of information through the processor. In short, it can be
said, this component receives, decodes, stores results and manages execution of data that flows
through the CPU. Its communication with both arithmetic unit and memory is certain.
Q 3: WHAT IS A MICROPROCESSOR?
Ans:
Microprocessor or CPU (Central Processor Unit) is also called a processor .It is an important part of every
computer system. Just like human brain it controls all operations inside system unit .It is the fastest
component than all other components of computer system.
1. ALU
2. CU
3. Cache
4. Registers
5. Internal Buses
Now day’s two major companies manufacture CPUs for PCs i.e. INTEL and AMD.
Ans:
Every component in computer motherboard is connected with every other component through printed
electrical lines. These electrical lines are called system bus.
“Combination of electrical lines which are used to travel data from one component to another”
1. Data Bus
2. Address Bus
3. Control Bus
System bus is also called external bus because this is not inside CPU.
Every bus (Data, Address, and Control) has its specific function.
Ans:
Memory Buffer Register is a special purpose register. It is also called memory data register. It major
work is to make processor and memory, work independently. It holds (stores) the contents of that
memory location which needs to be moved from memory to other components or from other
components to memory. It works as a buffer. Before saving a data it is stored in MBR and then it goes to
Ans:
Being a central and most important component of a computer system, the CPU can perform arithmetic
and logical operations like addition, subtraction, less than, greater than etc. It also controls the overall
functions of computer system by using Control units. It performs following functions to process an
instruction:
1. Fetch
2. Decode
3. Execute
4. Store
ANS:
When referring to the computer processor, an instruction is a segment of code that contains steps that
need to be executed by the computer processor. For a computer to do something, instructions have to
be given to the computer processor so it knows how to do what it is being asked to do.
For example, if you were to ask the computer to draw a square, it would need a set of instructions on
how to draw the square, so it can complete the task.
ANS:
Opcode is the portion of a machine language instruction that specifies the operation to be performed.
Like here MOV specifies the movement of 1000H in the AX register.
ATIF FAHEEM KHAN
3|Page
CHAPTER – 3 CENTRAL PROCESSING UNIT
Operand is a quality on which operation is performed. Here AX and 1000H are the operands.
Example 2: ADD 45
Q 9: SHOW COMPUTER INSTRUCTION FORMAT WITH THE HELP OF DIAGRAM AND LABEL ITS PARTS.
ANS:
An instruction consists of an opcode, usually with some additional information such as where operands
come from, and where results go. There are three basic types of instruction format:
Zero-Address Instruction
The instruction contains only op code. It takes only one byte in memory.
Example: ADD
One-Address Instruction
op code address1
Example: ADD B
Two-Address Instruction
op code operands
ANS:
(Complex instruction set compilers) focuses on finishing a task in few lines of assembly code.
This instruction when executed will load two numbers and multiply them up and then store the
result in a register.
MULT here is a complex instruction and here we don't require much of loading and storing
elements from the computer's memory rather they (CISC instructions) act directly on it. IT
emphasizes on multi clock instructions.
(Reduced instruction set computing) here instead of complex instruction we go for simple
instructions one by one which could be completed in a single clock. so, here instead of MULT as
a single instruction, there are a series of loading and storing instructions
Example: LOAD A, 3:4
LOAD B, 6:5
PROD A, B
STORE A,
Differentiating CISC and RISC
CISC: Compiler has to do a little job while translating HLL to assembly since the statements are
quite small. The main difficulty is creating complex instruction sets on hardware directly. There
is a very small use of RAM.
RISC: As we have already seen more no. of instructions mean more use of memory and much
work is meant for compiler too but at the same time RISC instructions require less hardware and
here we have scope for pipelining (executing more than one instruction during a single clock
cycle) too.
LONG QUESTIONS
ATIF FAHEEM KHAN
5|Page
CHAPTER – 3 CENTRAL PROCESSING UNIT
ANS:
CPU stands for Central Processing Unit. It is also called a Central processor, or microprocessor, or
processor or the brain of the computer. A computer's CPU handles all instructions it receives from
hardware and software running on the computer. It is the main unit which is responsible for executing
instructions and data.
There is electronic circuit board in arithmetic logic unit which executes all arithmetic and logical
operations. Its function is clear from its name. It performs arithmetic calculations like as
addition, subtraction, multiplication and division as well as comparisons. The unit can compare
numbers, letters, or special characters. There can be more than one Arithmetic logic unit in a
CPU.
There is circuitry in the control unit which uses electrical signals to instruct the whole computer
system for carrying out or executing, already stored program instructions. Its name clearly
shows that it controls and co-ordinates computer components. It extracts instructions from
memory and decodes and executes them. In fact it regulates the flow of information through
the processor. In short, it can be said, this component receives, decodes, stores results and
manages execution of data that flows through the CPU. Its communication with both arithmetic
unit and memory is certain.
Registers are temporary storage areas which are responsible for holding the data that is to be
processed. They store the instructions and data in a processor. This data is further used by
Control Unit. There are some registers that are set aside for specific tasks, these generally
include a program counter, stack, and flags.
ANS:
Registers:
Registers are temporary storage areas which are responsible for holding the data that is to be
processed. They store the instructions and data in a processor.
General Purpose Register are the registers which are used for storing data as well as addresses. They are
combined data and address registers.
1. AX (Accumulator): This is accumulator register. It is used in arithmetic, logic and data transfer
instructions. In manipulation and division, one of the numbers involved must be in AX or AL.
16 Bit AX Register
2. BX (Base Register): This is base register. BX register is an address register. It usually contain a
data pointer used for based, based indexed or register indirect addressing.
16 Bit BX Register
3. CX (Count Register): This is Count Register. This serves as a loop counter. Program loop
constructions are facilitated by it. Count register can also be used as a counter in string
manipulation and shift/rotate instruction.
16 Bit CX Register
4. DX (Data Register): This is data register. Data register can be used as a port number in I/O
operations. It is also used in multiplication and division.
16 Bit DX Register
These registers hold the state of the program. They are used by the control unit to control the
operations of CPU and by the operating system to control the execution of the programs.
1. Instruction Register (IR): It is the part of Control unit. The instruction register holds the
instruction currently being executed. It is also called Current Instruction Register (CIR).
2. Memory Data Register (MDR): The memory data register (also known as the memory buffer
register or data buffer) holds the piece of data that has been fetched from memory. It works as
a buffer allowing the processor and memory units to act independently.
3. Memory Address Register (MAR): The memory address register holds the address of the next
piece of memory to be fetched. It basically holds the memory location of data that needs to be
accessed.
4. Program Counter (PC): The program counter holds the location of the next instruction to be
fetched from memory. It is automatically incremented by 1 between supplying the address of
the next instruction and the instruction being executed.
ANS:
The CPU moves data around the computer on pathways that interconnect it to all the other components
on the motherboard. These pathways are called ‘buses’.
1. Data Bus
The data bus can be a very busy pathway. Data bus is the most common type of bus. It is used to
transfer data between different components of computer. The number of lines in data bus
affects the speed of data transfer between different components. The data bus consists of 8, 16,
32, or 64 lines. A 64-line data bus can transfer 64 bits of data at one time.
2. Address Bus.
The components pass memory addresses to one another over the address bus. Many
components are connected to one another through buses. Each component is assigned a unique
ID. This ID is called the address of that component. If a component wants to communicate with
another component, it uses address bus to specify the address of that component. The address
bus is a unidirectional bus. It can carry information only in one direction. It carries address of
memory location from microprocessor to the main memory.
3. Control Bus
Control bus is used to transmit different commands or control signals from one component to
another component. Suppose CPU wants to read data from main memory. It will use control is
also used to transmit control signals like ASKS (Acknowledgement signals). A control signal
contains the following:
• Timing information: It specifies the time for which a device can use data and address bus.
• Command Signal: It specifies the type of operation to be performed.
Suppose that CPU gives a command to the main memory to write data. The memory sends
acknowledgement signal to CPU after writing the data successfully. CPU receives the signal and
then moves to perform some other action.
ANS:
An instruction is an order given to a computer processor by a computer program. At the lowest level,
each instruction is a sequence of 0s and 1s that describes a physical operation the computer is to
perform (such as "Add"). An instruction has two fields:
1. Operation Code: It represents that the action that the processor executes.
2. Operand Code: It defines that parameters of the action.
Ans:
Instruction cycle is the time period during which one instruction is fetched from memory and executed
when a computer is given an instruction in machine language. This cycle is also called the machine cycle.
There are typically four stages of an instruction cycle that the CPU carries out:
1. Fetch instruction: Read instruction code from address in Program Counter (PC) and place in
Instruction Register (IR). ( IR ← Memory[PC] )
2. Decode instruction: Hardware determines what the opcode/function is, and determines which
registers or memory addresses contain the operands.
3. Execute: Perform the function of the instruction. If arithmetic or logic instruction, utilize the ALU
circuits to carry out the operation on data in registers. This is the only stage of the instruction
cycle that is useful from the perspective of the end user.
4. Store result in memory if necessary: If destination is a memory address, initiate a memory write
cycle to transfer the result from the CPU to memory. Depending on the situation, the CPU may
or may not have to wait until this operation completes. If the next instruction does not need to
access the memory chip where the result is stored, it can proceed with the next instruction
while the memory unit is carrying out the write operation.