Anda di halaman 1dari 6

INTRO TO MICROCOMPUTERS Page 1 of 6 SHAHEER TARIQ

INTRO TO MICROCOMPUTERS

Block Diagram of a typical Microcomputer:

Central Processing Unit (CPU):
The CPU is the brain of a computer. The main function of the CPU is to execute programs stored in the main memory by
fetching their instructions, examining them and then executing them one after another. Many tasks of the CPU are carried
out through the following distinct parts.
Clock Signals:
The system clock signals are contained in the control bus. These signals generate the appropriate clock periods during
which instruction executions are carried out by the microprocessor. The clock signals vary from one microprocessor to
another. Some microprocessors have an internal clock generator circuit to generate a clock signal. These microprocessors
require an external crystal or an RC network to be connected at the appropriate microprocessor pins for setting the
operating frequency. However, most microprocessors do not have the internal clock generator circuit and require an
external chip or circuit to generate the clock signal.

Address decoder:
Each I/O device has a unique address. When the CPU wants to send data to a device or receive data from it, it places the
device's address on the I/O bus. This address is decoded by the address decoder in the interface unit.

Read Only Memory (ROM):
Read only memory is one in which data is permanently stored. Switching the power OFF in a computer system does not
erase the contents of a ROM. It is non-volatile memory. Data stored in a ROM can be accessed as fast as in RAM made
with similar storage cells. Writing of data into a ROM memory is impossible after it is stored.
There are four types of ROMs (Masked ROM, PROM, UVEPROM and EEPROM) and in some of them the user can erase
and rewrite the contents of a read only memory in a special manner.


INTRO TO MICROCOMPUTERS Page 2 of 6 SHAHEER TARIQ

Random Access Memory (RAM):
Unlike ROM, we can read from or write into the RAM, so it is often called read/write memory. The numerical and character
data that are to be processed by the computer change frequently. These data must be stored in type of memory from
which they can be read by the microprocessor, modified through processing, and written back for storage. For this reason,
they are stored in RAM instead of ROM. But it is a volatile memory, i.e. it cannot hold data when power is turned off.

Input / Output port:
Embedded products are often designed to allow the user to provide inputs (or commands) to specify the operation to be
performed and to receive results related to the operation. This is made possible by I/O devices, also called peripheral
devices. Key switches, keypads, keyboards, magnetic and optical scanners, and sensors are among the most popular input
devices. LEDs, seven segment displays, LCDs, printers and CRT displays are among the most popular output devices.
The combination of a group of I/O pins (usually eight pins or less) along with its associated control, status, data, and data
direction registers are referred to as an I/O port. In an input operation, the CPU reads data from the data register. In an
output operation, the CPU places data on the data register, which will hold the data until it is fetched by the output device.

Internal structure (architecture) of a typical 8-bit CPU:
The primary function of a central processing unit is to execute sequences of instructions stored in a memory, which is
external to the central processing unit. When the functions of the processor are restricted, those processors become more
specialized processor such as I / 0 processor. Most of the times CPUs are microprocessors whose physical implementation
is a single VLSI chip. Figure shows a typical CPU structure and its connection to memory: The CPU contains different units
such as control unit, arithmetic logic unit, register unit, decoding unit which are necessary for the execution of instructions.

The sequence of operations
involved in processing an
instruction constitutes an
instruction cycle. This can be
subdivided into three major
phases: fetch cycle, decode
cycle and execute cycle. The
address of the next instruction
which is to be fetched from
memory is in the program
counter (PC). During fetch
phase CPU loads this address in
address register (AR). This is the
register which gives address to
the memory. Once the address
is available on the address bus,
the read command from
control unit copies the contents
of addressed memory location
to the instruction register (IR).
During decode phase, the
instruction in the IR is decoded
by instruction decoder. In the
next, i.e. execute phase CPU
has to perform a particular set
of micro-operation depending
on the instruction.
All these operations are
synchronized with the help of clock signal. The frequency of this signal is nothing but the operating frequency of CPU. Thus
the CPU is a synchronous sequential circuit and its clock period is the computer's basic unit of time.
INTRO TO MICROCOMPUTERS Page 3 of 6 SHAHEER TARIQ

Accumulator (A):
For an 8-bit microprocessor, the accumulator is typically an 8-bit register. It is used to store the result after most ALU
operations. These microprocessors have instructions to shift or rotate the accumulator 1 bit to the right or left through
the carry flag. The accumulator is typically used for inputting a byte into the accumulator from an external device or
outputting a byte to an external device from the accumulator.

Flag Register:
The flag register is a 16-bit register having 16 F/Fs, so it can store maximum 16-bit number.
When it is used for storing 16-bit number, all the 16 F/Fs of flag register are used, but only 9 F/Fs of flag registers are used
as flags. Some common flags:
Status Flags
Carry Flags
Auxiliary Carry Flags
Parity Flags
Zero Flags
Sign Flags
Overflow Flags
Control Flags

Instruction Register (IR):
The instruction register stores instructions. The contents of an instruction register are always decoded by the
microprocessor as an instruction. After fetching an instruction code from memory, the microprocessor stores it in the
instruction register. The instruction is decoded internally by the microprocessor, which then performs the required
operation. The word size of the microprocessor determines the size of the instruction register. For example, a 16-bit
microprocessor has a 16-bit instruction register.

Instruction Decoder:
The processor first fetches the op-code of instruction from memory and stores this op-code in the instruction register. It
is then sent to the instruction decoder. The instruction decoder decodes it and accordingly gives the timing and control
signals which control the register, the data buffers, ALU and external peripheral signals depending on the nature of the
instruction.

ALU:
The ALU, is the section of the processor that is involved with executing operations of an arithmetic or logical nature. It
works in conjunction with the register array for many of these, in particular, the accumulator and flag registers. The
accumulator holds the results of operations, while the flag register contains a number of individual bits that are used to
store information about the last operation carried out by the ALU. You can look at the ALU as comprising many
subcomponents for each specific task that it is required to perform. Some of these tasks and their appropriate
subcomponents are:
Addition and subtraction
Multiplication and division
Logical tests
Comparison
Bit shifting
INTRO TO MICROCOMPUTERS Page 4 of 6 SHAHEER TARIQ

Registers:
Registers are special purpose, high speed temporary memory units. These are temporary storage areas for holding various
types of information such as data, instructions, addresses and the intermediate results of calculations. Essentially, they
hold the information that the CPU is currently working on.
Registers can be thought of as CPU's working memory, a special additional storage location that offers the advantage of
speed. Registers work under the direction of the control unit to accept, hold and transfer instructions or data and perform
arithmetic or logical comparisons at high speed. Some special purpose registers:


Buffers:
A buffer contains data that is stored for a short amount of time, typically in the computer's memory (RAM). The purpose
of a buffer is to hold data right before it is used.
The contents of the stack pointer and program counter are loaded into the address buffer and address-data buffer.
These buffers are then used to drive the external address bus and address-data bus. As the memory and I/O chips are
connected to these buses, the CPU can exchange desired data to the memory and I/O chips. The address-data buffer is
not only connected to the external data bus but also to the internal data bus which consists of 8-bits. The address data
buffer can both send and receive data from internal data bus.

Control Unit:
The control unit is arguably the most complicated part of this model CPU, and is responsible for controlling much of the
operation of the rest of the processor. It does this by issuing control signals to the other areas of the processor, instructing
them on what should be performed next. The three main elements of the control unit are as follows:
Decoder
Timer or clock
Control logic circuits

Instruction Set:
A processor has a set of instructions that it understands, called as instruction set. An instruction set or an instruction set
architecture is a part of the computer architecture. It relates to programming, instructions, registers, addressing modes,
memory architecture, etc. An instruction set is the set of all the basic operations that a processor can accomplish. Examples
of some instructions are:
PUSH A
LD R1, A
ADD R1, B
The instructions in the instruction set are the language that a processor understands. All programs have to communicate
with the processor using these instructions. An instruction in the instruction set involves a series of logical operations (may
be thousands) that are performed to complete each task.
The instruction set is embedded in the processor (hard-wired), which determines the machine language for the processor.
All programs written in a high-level language are compiled and translated into machine code before execution, which is
INTRO TO MICROCOMPUTERS Page 5 of 6 SHAHEER TARIQ

understood by the processor for which the program has been coded. Two processors are different if they have different
instruction sets. A program run on one computer may not run on another computer having a different processor.
Purpose: To provide a means of creating (calling up) specific functions by means of a numerical code.

Addressing Modes:
A computer program is a sequence of instructions. Each instruction specifies the operation noted in the operation code
field on the data specified by the operands in the operand field. In order to enlarge the capability and computing power
of an instruction it is desirable to have different types of addressing capabilities in an instruction format.
Typical addressing modes:

1. Direct memory addressing:
The operand in this scheme is a memory address where the data is stored. So for a single address instruction Add 10 is
executed by adding the data word from location 10 to the data in the implied second operand.

2. Direct register addressing:
All computer systems are usually provided with some addressable registers. If there are K number of registers, then log2
K bits of the operand field denote the specific register operand holding the data word. So single address instruction like
Add 4 accesses the data word from the register number 4 and adds to the data of implied second operand.

3. Indirect memory addressing:
In this scheme the operand address specifies another memory location where the desired data element is located.

4. Indirect register addressing:
In this scheme the register operand Rj in the instruction specifies the memory address where the operand data is located.
It needs one memory access and one register access to get the operand data.

5. Implied Mode:
In this mode, the operands are specified implicitly in the defining instruction. For example, the instruction "complement
AC' is an implied mode instruction because the operand in an AC register is implied in defining instruction. In fact, all
register reference instructions that use an AC are implied mode instruction. Zero address add instruction is another
example of "implied mode instruction" since operands are implied to be on top of the stack. For example, ADD, here top
two elements of stack will be fetched out of the stack, added and the answer will be at the top of the stack.

6. Immediate Mode:
In this mode no address of operand is given. The instruction itself contains the operand to be executed. So in this mode
we have operand field instead of address field. These instructions are used for directly loading a register with a value. For
example, ADD 10, will increment the value stored in the accumulator by 10.

Bus structure:
CPU sends data, instructions and information to the components inside the computer as well as to the peripherals and
devices attached to it. Bus is a set of information and signals to travel between components inside or outside of a
computer. The different components of computer, i.e., CPU, I/O unit and memory unit are connected with each other by
a bus. The data, instructions and the signals are carried between the different components via a bus.

The microcomputers system bus contain 3 busses which carry all data, address and control information involved in
program execution.

1. Address Bus:
Used by the CPU to select memory locations
Used by the input and output ports to be active at a given time
In address bus information transfer takes place only in one direction, from microprocessor to memory or I/Os. So
this is called a unidirectional
INTRO TO MICROCOMPUTERS Page 6 of 6 SHAHEER TARIQ

2. Data Bus:
Where all the data and instructions travel
from the CPU to the memory or any
input/output port or vice versa
In the data bus, data can flow in both
directions. So this is called a bidirectional
bus.

3. Control Bus:
Used by the CPU to inform the memory or
the input/output port that it is ready to
perform data transfer may it be a read or a
write operation
The control bus consists of a number of
signals that are used to synchronize the
operation of the individual microcomputer elements. The microprocessor sends some of these control signals to
the other elements to indicate the type of operation being performed. Each microcomputer has a unique set of
control signals.

Interrupts:
An interrupt is a process of data transfer through which an external device or a peripheral informs the CPU that it is ready
for communication and it requests attention of the CPU. The CPU completes the current execution and then serves the
interrupt depending on the priority of the interrupts. Types of Interrupts:
Internal Interrupts:
These interrupts occur when an instruction being executed is terminated before the time it had been allocated to get
completely executed. For example, whenever we try to divide a number by 0 an error message occurs during the
execution of instruction. The execution is terminated there and an error message is shown on the screen. Some other
examples are: an overflow, an invalid op-code, etc.
External Interrupts:
These interrupts are caused by I/O devices or peripherals. These are generated by an external device for requesting the
transfer of data, indicating power failure, etc. The differences between internal interrupts and external interrupts are as
follows:
1. The internal interrupts are synchronous with the program while external interrupts are not.
2. The internal interrupts are generated due to some condition violated by the main program itself while external
interrupts are generated by peripherals.
3. The external interrupts do not depend on the re-execution of the same program because they are generated externally
but internal interrupts will be generated at the same place each time.
Software Interrupts:
A software interrupt is not initiated by hardware (as internal and external interrupts). They are generated when an
appropriate instruction is executed. This interrupt depends on the users. They can introduce this interrupt wherever they
like by writing an instruction that causes it.

Anda mungkin juga menyukai