What is a ‘Program’?
A sequence of steps/instructions (written in logical order to perform a specific task).For each step, an arithmetic/logical operations are performed on data.
For each operation, a different set of control signals is needed.
Its executed in the CPU, which interprets each line of code, and generates appropriate control signals to get the task done.
There are two approaches to writing a program:
- Hardwired
- Software
1. Hardwired Program
The process of connecting the various components in the desired configuration as a form of programming e.g. in microcontrollers.
The resulting ‘program’ is in the form of hardware and is termed as a hardwired program. (e.g. program is burnt/loaded into the IC).
Hardwired systems are fast but inflexible (main disadvantage).
2. Software Program
With general-purpose hardware, the system accepts data and control signals and produces results. (can perform multipurpose tasks)
Thus, instead of rewiring the hardware for each new program, the programmer merely needs to supply a new set of control signals.
To supply these control signals, the general-purpose hardware needs a segment that can accept a code and generate control signals.
Programming is now much easier, all we need to do is provide a new sequence of codes/instructions. Hardware interprets them and generates a unique set of control signals.
This programming using a sequence of codes/instruction is Software.
Components of the CPU
Two major components of the system:
- An instruction interpreter (Control Unit).
- A module of general-purpose arithmetic and logic functions (ALU)
These two constitute the CPU (Central processing unit).
A function of Control Unit
For each operation, a unique code is provided.
e.g. ADD, MOVE
A hardware segment accepts the code and issues the control signals.
I/O Components
A module is a Computer circuit consisting of an assembly of electronic components (as of computer hardware)
Data and instructions must be put into the system. For this, we need some sort of Input module.
This module contains basic components of accepting instructions and data in some form and converting them into an internal form of signals usable by the system.
A means of reporting results is needed, and this is in the form of an output module.
Taken together, these are referred to as the I/O components.
Main Memory (RAM)
An input device will bring instructions and data in sequentially.
But a program is not invariably executed sequentially; it may jump around (e.g. using program flow control instructions).
Similarly, operations on data may require access to more than just one element (operand) at a time in a predetermined sequence.
Thus temporary storage of both code/inst. and results/data is needed.
This module is called memory, or main memory called (RAM).
RAM (Random access memory) is directly accessed by the CPU.
This memory could be used to store both instructions and data.