Вы находитесь на странице: 1из 62

1.

Terminologies
System
 The word ‘system’ is used to describe any
organization or device that includes three features:
Input, Output, and process.

Often there are many inputs and outputs. Some of


the outputs are required and some are waste
products. To a greater or lesser extent, all processes
generate some waste heat.
An example of a system
 A motor car will usually require fuel, water for cooling
purposes and a battery to start the engine and provide for
the lights and instruments.

 Its process it to burn the fuel and extract the energy to


provide transportation for people and goods.

 The outputs are the wanted movement and the unwanted


pollutants such as gases, heat, water vapor and noise.

NB: It is quite possible for systems to have smaller


systems inside or embedded within them.
Microprocessor
 A microprocessor is a very small electronic circuit
typically 1⁄2 inch (12 mm) across.
 It is easily damaged by moisture or abrasion so to offer
it some protection it is encapsulated in plastic or
ceramic.

 The size, shape and number of pins on the


microprocessor depend on the amount of data that it
is designed to handle.

 Without a surrounding circuit and applied voltages it


is quite useless. It will just lie on your workbench
staring back at you.
A microprocessor system
 The inputs and outputs of a microprocessor are a
series of voltages that can be used to control external
devices.

The process involves analyzing the input voltages and


using them to ‘decide’ on the required output voltages.

The decision is based on previously entered


instructions.
Integrated circuit
It is an electronic circuit fabricated out of a solid block
of semiconductor material.

This design of circuit, often called a solid state circuit,


allows for very complex circuits to be constructed in a
small volume.

 An integrated circuit is also called a ‘chip’.


Microprocessor-based system
This is any system that contains a micro-processor.

It does not necessarily have anything to do with


computing.

In fact, despite all the hype, computers use only a


small proportion of all the microprocessors
manufactured.
MPU and CPU
An MPU is a Microprocessor Unit or microprocessor.

A CPU is a Central Processing Unit. This is the central


‘brain’ of a computer and can be (usually is) made from
one or more microprocessors.

The IBM design for the ‘Blue Gene’ supercomputer


includes a million processors!
Microcomputer
The particular microprocessor-based systems that
happen to be used as a computer are called
microcomputers.

The additional circuits required for a computer can be


built into the same integrated circuit giving rise to a
single chip microcomputer.
Fig. Microcomputer
Microcontroller

This is a complete microprocessor-based control


system built onto a single chip.

It is small and convenient but doesn’t do anything that


could not be done with a microprocessor and a few
additional components.
2. Internal organization of computers
 The internal working of every computer can be broken
down into three parts: CPU(central processing unit),
memory, and I/O (input/output) devices.

 The function of CPU is to execute (process) information


stored in memory.

 The function of I/O devices such as the keyboard and video


monitor is to provide a means of communicating with the
CPU.

 The CPU is connected to memory and I/O through strips


of wire called a bus.
Bus
 The bus inside a computer carries information from place
to place just a street bus carries people from place to place.

 In every computer there are three types of buses: address


bus, data bus, and control bus.

 For a device (memory or I/O) to be recognized by the CPU,


it must be assigned an address.

 The address assigned to a given device must be unique; no


two devices are allowed to have the same address.
The CPU puts the address on the address bus, and the
decoding circuitry finds the device. Then the CPU uses
the data bus either to get data from that device or to
send data to it.

The control buses are used to provide read or write


signals to the device to indicate if the CPU is asking for
information or sending it information.

Of the three buses, the address bus and data bus
determine the capability of a given CPU.
Since data buses are used to carry information in and
out of a CPU, the more data buses available, the better
the CPU.

But the increase in the number of data buses increases


the cost of construction. More data buses mean a more
expensive CPU and computer.

The average size of data buses in CPUs varies between


8 and 64.
Data buses are bidirectional, since the CPU must use
them either to receive or to send data.

The processing power of a computer is related to the


size of its buses, since an 8-bit bus can send out 1 byte
a time, but a 16-bit bus can send out 2 bytes at a time,
which is twice as fast.
Since the address bus is used to identify the devices
and memory connected to the CPU, the more address
buses available, the larger the number of devices that
can be addressed.

The number of address buses for a CPU determines


the number of locations which is always equal to 2x,
where x is the number of address lines, regardless of
the size of the data bus.
For example, a CPU with 16 address lines can provide
a total of 216 or 64K bytes of addressable memory.

Each location can have a maximum of 1 byte of data.


This is due to the fact that all general-purpose
microprocessor CPUs are what is called byte
addressable.

The address bus is unidirectional bus, which means


that the CPU uses the address bus only to send out
addresses.
3. Internal working of computers
A program stored in memory provides instructions to
the CPU to perform an action.

It is the function of the CPU to fetch these instructions


from memory and execute them.

To perform the actions of fetch and execute, all CPUs


are equipped with resources such as registers, ALU,
program counter, and instruction decoder.
Registers
The CPU uses registers to store information
temporarily. The information could be two values to be
processed , or the address of the value needed to be
fetched from memory.

Registers inside the CPU can be 8-bit, 16-bit, 32-bit, or


even 64-bit registers, depending on the CPU.

The disadvantage of more and bigger registers is the


increased cost of such a CPU.
ALU
The CPU also has what is called the ALU (arithmetic
logic unit).

The ALU section of the CPU is responsible for


performing arithmetic functions such as add, subtract,
multiply, and divide, and logic functions such as AND,
OR, and NOT.
Program Counter
Every CPU has what is called a program counter. The
function of the program counter is to point to the
address of the next instruction to be executed.

As each instruction is executed, the program counter is


incremented to point to the address of the next
instruction to be executed.

 It is the contents of the program counter that are


placed on the address bus to find and fetch the desired
instruction.
Instruction Decoder
 The function of the instruction decoder is to interpret the
instruction fetched into the CPU.

 One can think of the instruction decoder as a kind of


dictionary, storing the meaning of each instruction and
what steps the CPU should take upon receiving a given
instruction.

 Just as a dictionary requires more pages the more words it


defines, a CPU capable of understanding more instructions
requires more transistors to design.
Example
 Assume that an imaginary CPU has registers A, B, C, and D.

 It has an 8-bit data bus and a 16-bit address bus. Therefore,


the CPU can access memory from addresses 0000 to
FFFFH.

 The action to be performed by the CPU is to put


hexadecimal value 21 into register A, and then add to
register A values 42H and 12H.

 Assume that the code for the CPU to move a value to


register A is 1011 0000 (B0H) and the code for adding a
value to register A is 0000 0100(04H).
 The necessary steps and code to perform them are as
follows:

 If the program to perform the actions listed above is


stored in memory locations starting at 1400H, the
following would represent the contents for each
memory address location:
The actions performed by the CPU to run the program above
would be as follows:

 The CPU’s program counter can have a value between 0000


and FFFFH.

 The program counter must be set to be the value 1400H,


indicating the address of the first instruction code to be
executed.

 After the program counter has been loaded with the


address of the first instruction, the CPU is ready to execute.
 The CPU puts 1400H on the address bus and sends it
out.

 The memory circuitry finds the location while the CPU


activates the READ signal, indicating to memory that
it wants the byte at location 1400H.

 This causes the contents of memory location 1400H,


which is B0, to be put on the data bus and brought into
the CPU.
 The CPU decodes the instruction B0 with the help of its
instruction decoder dictionary.

 When it finds the definition for that instruction it knows it


must bring into register A of the CPU the byte in the next
memory location.

 Therefore, it commands its controller circuitry to do exactly


that.

 When it brings in the value 21H from memory location


1401H, it makes sure that the doors of all registers are
closed except register A.

 Therefore, when value 21H comes into the CPU it will go


directly into register A.
 after completing one instruction the program counter
points to the address of the next instruction to be executed,
which is in this case is 1402H.

 Address 1402H is sent out on the address bus to fetch the


next instruction.

 From memory location 1402H it fetches code 04H. After


decoding, the CPU knows that it must add to the contents
of register A the byte sitting at the next address (1403H).

 After it brings the value (in this case 42H) into the CPU, it
provides the contents of register A along with this value to
the ALU to perform the addition.
 It then takes the result of the addition from the ALU’s
output and puts it in register A.

 Meanwhile the program counter becomes 1404H, the


address of the next instruction.

 Address 1404H is put on the address bus and the code is


fetched into the CPU, decoded, and executed.

 This code is again adding a value to register A. The program


counter is updated to 1406H.

 Finally the contents of address 1406H are fetched in and


executed.
 This HALT instruction tells the CPU to stop incrementing
the program counter and asking for the next instruction.

 In the absence of the HALT, the CPU would continue


updating the program counter and fetching instructions.

 Now suppose that address 1403H contained value 04H


instead of 42H. How would the CPU distinguish between
data 04H to be added and code 04H?

 Remember that code 04 for this CPU means move the next
value into register A.

 Therefore, the CPU will not try to decode the next value. It
simply moves the contents of the following location into
register A, regardless of its value.
4. History of the 80x86 family
In 1978, Intel Corporation introduced a 16-bit
microprocessor called the 8086.

It has a capacity of 1MB of memory exceeded the


8080/8085’s capability of handling a maximum of
64KB of memory.

The 8086 was a pipelined processor, as opposed to the


non-pipelined 8080/8085.
The 8086 is a microprocessor with a 16-bit data bus
internally and externally, meaning that all registers are
16 bits wide and there is a 16-bit data bus to transfer
data in and out of the CPU.

But at that time all peripherals were designed around


an 8-bit microprocessor. In addition, a printed circuit
board with a 16-bit data bus was much more
expensive.

There for Intel came out with the 8088 version.


8088 is identical to the 8086 as far as programming is
concerned, but externally it has an 8-bit data bus of a
16-bit bus. It has the same memory capacity, 1MB.

Intel introduced the 80286 in 1982. Its features


included 16-bit internal and external data buses; 24
address lines, which give 16MB of memory; and most
significantly, virtual memory.

The 80286 can operate in one of two modes: real mode


or protected mode. Real mode is simply a faster
8088/8086 with the same maximum of 1MB of
memory.
 Protected mode allows for 16MB of memory but is also
capable of protecting the operating system and programs
from accidental or deliberate destruction by a user.

 With the introduction of the 80486 in 1989, Intel put a


greatly enhanced version of the 80386 and math co-
processor on a single chip plus additional features such as
cache memory.

 Cache memory is a static RAM with a very fast access time.

 All programs written for the 8086/88 will run on 286, 386,
486 computers.
Fig. Some of the 8086 family
5. Important concepts
Pipelining

 There are two ways to make the CPU process information


faster: increase the working frequency or change the
internal architecture of the CPU.

 The first option is technology dependent, meaning that the


designer must use whatever technology is available at the
time, with consideration for cost.
 The technology and materials used in making IC’s
determine the working frequency, power consumption, and
the number of transistors packed into a single-chip
microprocessor.

 The second option for improving the processing power of


the CPU has to do with the internal working of the CPU.

 In the 8085 microprocessor, the CPU could either fetch or


execute at a given time.

 The idea of pipelining in its simplest form is to allow the


CPU to fetch and execute at the same time.
Fig. Pipelined vs. non-pipelined cycles
 Intel implemented the concept of pipelining in the
8088/8086 by splitting the internal structure of the
microprocessor into two sections: the execution unit (EU)
and the bus interface unit (BIU).

 The BIU accesses memory and peripherals while the EU


executes instructions previously fetched.

 The BIU has a buffer, or queue. The buffer is 4 bytes long in


the 8088 and 6 bytes in the 8086.

 The BIU fetches a new instruction whenever the queue has


room for 2 bytes in the 6-byte 8086 queue, and for 1 byte in
the 4 byte 8088 queue.
 When jump instruction is executed, the BIU starts to fetch
information from the new location in memory and
information in the queue that was fetched previously is
discarded.

 In this situation the EU must wait until the BIU fetches the
new instruction. This is referred to as a branch penalty.

 In a pipelined CPU, this means that too much jumping


around reduces the efficiency of a program.

 Pipelining in the 8088/86 has two stages: fetch and execute,


but in more powerful computers it can have many stages.
The noise problem
 If the input of a microprocessor is held at a constant
voltage, say 4V, as in the following figure and do this in
practice, then careful measurements would show that the
voltage is not of constant value but is continuously
wandering above and below the mean level.
These random fluctuations are called electrical noise
and degrade the performance of every electronic
circuit.

We can take steps to reduce the effects but preventing


it altogether is, so far, totally impossible.
Most microprocessors use a power supply of 5 V
or 3.3V. If we are going to persuade the
microprocessor to count from 0 to 9, as we do,
using voltages available on a 5 V supply would give
0.5V per digit:
 If we were to instruct our microprocessor to perform the
task 4 + 4 = 8, by pressing the ‘4’ key we could generate a 2
V signal which is then remembered by the microprocessor.

 The + key would tell it to add and pressing the ‘4’ key again
would then generate another 2V signal.

 So, inside the microprocessor we would see it add the 2 V


and then another 2 V and, hence, get a total of 4V.

 The microprocessor could then use the list shown to


convert the total voltage to the required numerical result of
8.
This seemed to work nicely – but we ignored
the effect of noise. The exact voltage
memorized by the microprocessor would be a
matter of chance.
 The first time we pressed key 4, the voltage just
happened to be at 1.5 V but the second time we were
luckier and the voltage was at the correct value of 2V.

 Inside the microprocessor: 1.5 V + 2V = 3.5V and using


the table, the 3.5 V is then converted to the number 7.
So our microprocessor reckons that 4 + 4 = 7.

 Since the noise is random, it is possible, of course, to


get a final result that is too low, too high or even
correct.
 We have seen that a 5 V supply would accommodate a 10-
digit counting system if each digit was separated by 0.5 V
or, using the more modern choice of 3.3V, the digits would
be separated by only 0.33V.

 The number 6 for example would have a value of 3 V and


the number 7 would be represented by 3.5V.

 If the noise voltage were to increase the 3 V to over 3.25V,


the number is likely to be misread as 7.

 The highest acceptable noise level would therefore be


0.25V. This is not very high and errors would be common.

 If we used a supply voltage of 3.3V, the situation would get


even worse.
So why don’t we just increase the operating voltage to
say, 10V, or 100 V? The higher the supply voltage the
less likely it is that electrical noise would be a problem.

This is true but the effect of increasing the supply


would be to require thicker insulation and would
increase the physical size of the microprocessor and
reduce its speed.

If we reduce the number of digits then a wider voltage


range can be used for each value and the errors due to
noise are likely to occur less often.
 We have chosen to use only two digits, 0 and 1, to provide
the maximum degree of reliability.

 A further improvement is to provide a safety zone between


each voltage.

 Instead of taking our supply voltage of 3.3 V and simply


using the lower half to represent the digit 0 and the top
half for 1, we allocate only the lower third to 0 and the
upper third to 1.

 This means that the noise level will have to be at least 1.1 V
(one-third of 3.3 V) to push a level 0 digit up to the
minimum value for a level 1.
Nibble, Byte, and Word
All the information entering or leaving a
microprocessor is in the form of a binary signal, a
voltage switching between the two bit levels 0 and 1.

Bits are passed through the microprocessor at very


high speed and in large numbers and we find it easier
to group them together.

Nibble: A group of four bits. It is half a byte.


Byte: A byte is simply a collection of 8 bits.
Word
 A number of bits can be collected together to form a ‘word’.
Unlike a byte, a word does not have a fixed number of bits
in it.

 The length of the word or the number of bits in the word


depends on the microprocessor being used.

 If the microprocessor accepts binary data in groups of 32 at


a time then the word in this context would include 32 bits.
If a different microprocessor used data in smaller handfuls,
say 16 at a time, then the word would have a value of 16
bits.
The word is unusual in this context in as much as its
size or length will vary according to the situations in
which it is discussed.

The most likely values are 8, 16, 32 and 64 bits but no


value is excluded.

Long word

In some microprocessors where a word is taken to mean


say 16 bits, a long word would mean a group of twice the
normal length, in this case 32 bits.
Exercise
1. Express the decimal number 568.23 as a sum of the values of
each digit.
2. Convert the binary number 10111101.011 to decimal.
3. Convert the decimal number 39.3 125 to binary.
4. Add the binary numbers 1111 and 1100.
5. Subtract the binary number 101 from 110.
6. Multiply 1101 x 1010.
7. Divide 1100 by 100.
8. Determine the 2's complement of the binary number
00010110.
9. Express + 19 and - 19 in sign-magnitude, 1's complement,
and 2's complement (express it as an 8-bit number).
10. Determine the decimal value of the sign-magnitude number
01110111.
11. Determine the decimal value of the 1's complement number
11101011.
12. Determine the decimal value of the 2's complement number
11010111.
13. Convert the hexadecimal number 6803 to binary.
14. Convert 60A16 to decimal.
15. Convert the decimal number 650 to hexadecimal.

Вам также может понравиться