A computer has three main components
1) Central Processing Unit (CPU) or Central Processor
3) I/O Devices
The CPU in turn has three parts
1) Arithmatic and Logic Unit (ALU)
3) Control Unit (CU)
Arithmatic and Logic Unit (ALU)
This is a small memory unit. Registers are used by the processor for temporary storage and manipulation of data and innstructions. A register is a set of flip-flop. A flip-flop is an electronic circuit, which at any point of time stores either 0 or 1, which is any of the two states of a switch ON or OFF.
A register is mostly of different sizes and capacities : 8 bit, 16 bit, 32 bit, etc. Each register has a specific function in the CPU.
Given below are few commonly known registers:
the ALU requires temporary registers or memory locations for all its operations. An accumulator is one of the main registers of the ALU, used to store data and perform arithmetic and logic operations. The results of the operations are stores automatically in this register.
Program Counter (PC)
A PC is used as a memory pointer. It stores the address of the next instruction to be executed. this register is used to sequence the execution of instructions.
An IR holds the instruction until it is decoded.
the address of a stack top is held in the stack pointer. A stack is a sequence of memory locations. It is used to save the contents of a register during the execution of a program. the memory location of an occupied potion is known as stack top.
Given below are some of the registers for a basic computer and their functions:
Symbol Name Function
DR Data Register Holds memory operand
AR Address Register Holds address for memory
AC Accumulator Processor Register
IR Instruction Register Holds instruction code
PC Program Counter Holds address of next instruction
TR Temporary Register Holds Temporary data
INPR Input Register Holds Input Character
OUTPR Output Register Holds Output Character
Control Unit (CU)
This circuit is responsible for the entire gamut of functions of the ALU. It receives instructions from memory and executes them after decoding them. Timing and control signals are generated by this circuit and sent to other circuits for the execution of the any program. It also transfers data between memory and I/O devices.
Let us discuss how the ALU functions while executing a program. A program is a set of instructions stored in a proper sequence in memory.
The ALU has to perform two main steps:
1) Execution of an instruction
2) Fetching the next instruction
The total time taken for the execution of an instruction is known as Instruction Cycle. (IC). A Fetch Cycle(FC) is the time that fetch operation takes to fetch the machine code of the instruction from memory. The FC is of fixed duration.
An Instruction Cycle consists of the Fetch cycle and the Execution Cycle. This is depicted in the following diagram: