Computer Organization And Architecture
The instruction cycle is the time required by the CPU to execute one single instruction. The instruction cycle is also commonly referred to as machine cycle but there is a difference between these two CPU operations.
The computer system’s main function is to execute the program. The computer program consist of set of instructions . The central processing unit ( CPU ) is responsible to execute these program instructions.
It is important to first understand some related topics before we start the discussion on the concept of instruction cycle.
In this article , you will learn what is instruction cycle , how it is related to the machine cycle . We will discuss some fundamental concepts such as what are program instructions , the CPU Clock Speed and Instruction Cycle.
Let us first start by understanding the some basic fundamental important concepts necessary to understand how instruction cycle works.
Computer Organization And Architecture
Table Of Contents
What Is Computer Program ?
The computer system needs a set of instructions which directs the computer to perform the desired operations. This set of instruction which computer can interpret and execute is called a computer program.
The computer program is an essential component of every computer system. The choice of the programming language depends upon the type of the software being developed.
The computer program written in any high level programming language needs to be converted into machine readable format in binary.
The machine code instructions in binary is low level set of program instructions that can be directly executed by the computer system.
What Is Program Instruction ?
The computer program consist of a set of program statements also called as program instructions. Each program instruction performs a specific task.
The computer program use different types of program instructions as per the program logic and algorithm.
For example, the program instruction can either perform input and output operations or arithmetic calculations or some logical decision making operation.
During the program compilation process , each program instruction is converted into machine code instruction in binary.
Depending upon the type of the programming language , the program compiler converts the entire program into an executable code. In case of interpreted language , this conversion takes place line by line.
What Is Central Processing Unit ?
The central processing unit ( CPU ) is the brain and the processing engine of the computer system. The CPU provides the real processing power to the system.
The main function of the CPU is to execute the computer program and control all the operations performed by the computer system.
Microprocessor ( CPU )
The CPU internally consist of number of units and each unit perform a specific task. The CPU internal units include Memory Unit ( MU ) , Arithmetic Logic Unit ( ALU ), and Control Unit ( CU ).
The CPU executes the computer program instructions by repetitively performing a process called machine cycle.
CPU Micro Architecture
CPU Instruction Set Architecture ( ISA )
Each micro processor chip implements and supports a set of binary commands that the CPU can decode and execute .
This set of commands is hardwired into the microprocessor’s circuitry during processor chip manufacturing process. This set of commands implemented by the CPU is called instruction set architecture ( ISA ).
Instruction Set Architecture
Instruction Set Architecture
And for this reason , the compiler compiles the program for a specific platform. The program compiler generates an executable code that can be executed on a specific platform.
What Is Instruction Format ?
The computer program consist of number of instructions which directs the CPU to perform specific operation. However , the CPU needs to know the details such as which operation is to be performed and on which data .
The CPU starts the program execution by fetching the program instructions one by one from the main memory RAM. The control unit of the CPU decodes the program instruction.
The control unit of the CPU decodes the instruction based on the instruction format . It is the instruction format which provides the details of the operation to be performed and the data on which the operation is to be performed.
The instruction for format defines the structure of the program instruction that can be decoded by the CPU and then perform the desired operation on the data.
The instruction format essentially consist of three parts which includes OPCODE , OPERAND and the addressing MODE.
Program Instruction Format
Machine Instruction Format
What Is Operation Code ?
In microprocessor architecture the OPCODE is part of the machine instruction that specifies which operation is to be performed by the CPU while executing the instruction.
The OPCODE directs the control unit of the CPU to operate on the data ( OPERAND ) as supported by the instruction set architecture ( ISA ) of the processor chip.
What Is OPERAND ?
In microprocessor architecture the OPERAND simply means the data on which the CPU performs the desired operation.
The OPERAND is part of the machine instruction that specifies either the data itself or a reference to the data such as memory address which contains the actual data.
The CPU decodes the OPERAND part of the machine instruction as specified in the addressing mode. There are different types of addressing modes used in the instruction format.
What Is Addressing Mode ?
In microprocessor architecture, the addressing mode is part of the machine instruction that specifies the rules for the CPU while operating on the OPERAND part of the machine instruction.
The addressing mode part of the machine instruction format allows to specify whether the OPERAND value is a direct data Or It is an indirect referencing.
The OPERAND bits can either represent a direct value , or main memory address or CPU register number. It is the addressing mode that indicates the type of the OPERAND value.
Instruction Format - Addressing Mode
If the addressing mode is specified as indirect then the OPERAND contains a memory address that points to the actual data.
The machine code instruction format can use ten different types of addressing modes depending upon the type of the instruction.
What Is Machine Cycle ?
The operating system loads the executable copy of the program code and the data that needs to be processed into the main memory RAM. The main memory contains the set of program instructions in the form of machine instructions .
The CPU is responsible to execute these machine instructions. In order to perform any task , the CPU has to repetitively perform a sequence of steps. These sequence of steps is called a machine cycle.
The machine cycle is the basic operation of the microprocessor to perform any activity. The CPU continuously performs the machine cycle in order to execute the program instructions one by one.
The machine cycle consist of sequence of four steps. These four CPU operations includes Fetch , Decode , Execute and Store. In order to execute one single program instruction , the CPU might need one or more machine cycles.
Machine Cycle Steps
What Is Instruction Cycle ?
In simple words , the instruction cycle is the time taken by the CPU to fetch and execute one single machine instruction .
The computer program contains different types of instructions. Depending up on the complexity of the program instruction , the CPU might need one or more machine cycles to execute one single instruction.
And therefore , the machine cycle is a part of the instruction cycle . However , in computing world , the machine cycle and instruction are used to indicate the instruction execution mechanism of the CPU.
CPU Clock Speed And Instruction Cycle
The processor is driven by an internal clock which generates the steady stream of clock pulses . For each clock pulse , the CPU performs part of the execution.
And therefore , faster the clock speed , faster will be the execution speed of the CPU. The clock speed is measured Hertz . The CPU speed is measured in Gigahertz ( GHz ).
CPU Clock Cycle
Instruction Cycle Steps
What Is Instruction Pipelining ?
The hardware industry is inventing new technologies to improve the processor speed. The processor speed has significantly improved since its inception.
The pipelined architecture or instruction pipelining has significantly improved the CPU speed. The instruction pipelining helps the CPU to process more number of instructions for the same number of clock cycles.
The CPU can execute the instructions in two modes. These two modes are pipelined and non-pipelined processing mode that depending upon the CPU architecture.
What Is Instruction Pipelining ?
We can compare the concept of instruction pipelining that is similar to the technique used in production on the assembly line.
In assembly line, the production process is divided into suitable number of jobs for simultaneous production . This production methodology allows the faster production rate.
Similarly , in pipelined architecture , each instruction is divided into fixed number of stages such as fetch , decode and execute. For each clock cycle , the CPU completes one stage of the instruction.
The pipeline processing allows the CPU to simultaneously process number of instruction. And therefore , the CPU can execute the program instructions in less number of clock cycles.
Non-Pipeline Instruction Execution
The CPU can process more number of instructions in parallel. Whereas, in non-pipelined architecture, the CPU executes only one instruction at a time. However , most modern processor supports the instruction pipelining.
In instruction pipelining , for each clock cycle , the CPU completes one part of the instruction. This could be either fetch operation , decode operation or execute operation.
One round of machine cycle needs twelve clock cycles. And one instruction cycle needs anywhere between one to four machine cycles depending upon the complexity of the instruction.
Pipeline Instruction Execution
What is Pipelined Architecture ?
In pipelined architecture , the CPU can simultaneously process some part of the number of instructions in parallel.
And as a result , the CPU can optimize on the sequence of instruction execution. Therefore , in pipelined architecture , less number of clock cycles required to execute the same number of instructions.
What is Non-Pipelined Architecture ?
In non-pipelined architecture , the CPU can execute program instruction only one after another . The CPU lacks the ability to process number of instructions in parallel.
And as a result , the CPU cannot optimize on the sequence of instruction execution . For this reason in non-pipelined architecture , more number of clock cycles required to execute the same number of instructions as compared to pipelined instructions.
Join The Best Seller
Computer Science Online Course
This is the most comprehensive and unique Computer Science And Programming Fundamentals course Online which will give you in depth understanding of most important fundamental concepts in computer science And Programming .