Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Introduction to Microprocessors
Microprocessor:
A single chip that contains a whole CPU Has the ability to fetch and execute instructions stored in memory Has the ability to access external memory, external I/O and other peripherals Examples: Intel P4 or AMD Athlon in desktops/notebooks ARM processor in Apple iPod
Microprocessor:
The key element of all computers, providing the mathematical and decision making ability Current state-of-the-art uPs (Pentium, Athlon, SPARC, PowerPC) contain complex circuits consisting of tens of millions of transistors They operate at ultra-fast speeds doing over a billion operations very second Made up from a semiconductor, Silicon
Microprocessor Generations:
First generation: 1971-78
Behind the power curve (16-bit, <50k transistors)
Fourth Generation: 1990 Architectural and performance leadership (64-bit, > 1M transistors, Intel/AMD translate into RISC internally)
History of Microprocessors:
1974 the first real useful 8-bit microprocessor is released by Intel the 8080 Motorola introduces the 6800 series Zilog has the Z80 1975 GM and Ford begin to put microcontrollers in cars Many cars today have over 100 microcontrollers TI gets into the microprocessor business with calculators and digital watches 1977 Apple II is released using MOS 6502 (similar to motorola 6800). Apple II dominated from 1977 to 1983 1978 Intel introduces the first 16-bit processor, the 8086 Motorola follows with the 68000 which is ultimately used in the first Apple Macintosh
History of Microprocessors:
1981 IBM enters the PC making market and uses the Intel 8088 proliferation of the home computer 1982-1985 Intel introduces the 32-bit 80286 and 80386 1989 80486 is being used in PCs, able to run Microsoft Windows 1992 Apple, IBM and Motorola begin to make PowerMac and PowerPCs using Motorola chips 1993 Pentium chip is released
Integrated Circuits:
Commonly known as an IC or a chip A tiny piece of Silicon that has several electronic parts on it Most of the size of an IC comes form the pins and packaging; the actual Silicon occupies a very small piece of the volume The smallest components on an IC are much smaller than the thickness of a human hair
A microprocessor system?
uPs are powerful pieces of hardware, but not much useful on their own Just as the human brain needs hands, feet, eyes, ears, mouth to be useful; so does the uP A uP system is uP plus all the components it requires to do a certain task A microcomputer is 1 example of a uP system
uP Building Blocks
Microprocessor
Data Cache
Memory Bus
RAM
I/O
Instruction Cache
Computer Buses:
Address bus: carries the address of a unique memory or input/output (I/O) device Data bus: carries data stored in memory (or an I/O device) to the CPU or from the CPU to the memory (or I/O device) Control bus: is a collection of control signals that coordinate and synchronize the whole system
The MPU communicates with Memory and I/O using the System Bus:
Address bus
Unidirectional Memory and I/O Addresses
Data bus
Bidirectional Transfers Binary Data and Instructions
Control bus
Read and Write timing signals
Instruction Decoder:
This unit receives the programming instructions and decodes them into a form that is understandable by the processing units, i.e. the ALU or FPU
Registers:
Both ALU & FPU have a very small amount of superfast private memory placed right next to them for their exclusive use. These are called registers
The ALU & FPU store intermediate and final results from their calculations in these registers Processed data goes back to the data cache and then to main memory from these registers
Control Unit:
The brain of the uP Manages the whole uP Tasks include fetching instructions & data, storing data, managing input/output devices
Microcontroller:
Microcontroller is a single chip micro computer made through VLSI fabrication. A microcontroller also called an embedded controller because the microcontroller and its support circuits are often built into, or embedded in, the devices they control. A microcontroller is available in different word lengths.(4bit,8bit,16bit,32bit,64bit and 128 bit)
Any device that measures, stores, controls, calculates, or displays information must have a microcontroller chip inside. The largest single use for microcontrollers is in automobile industry (microcontrollers widely used for controlling engines and power controls in automobiles). You can also find microcontrollers inside keyboards, mouse, modems, printers, and other peripherals. In test equipments, microcontrollers make it easy to add features such as the ability to store measurements, to create and store user routines, and to display messages and waveforms. Consumer products that use microcontrollers include digital camcorders, optical players, LCD/LED display units, etc.
A microcontroller internally consists of all features required for a computing system and functions as a computer without adding any external digital parts in it. Most of the pins in the microcontroller chip can be made programmable by the user. A microcontroller has many bit handling instructions that can be easily understood by the programmer. A microcontroller is capable of handling Boolean functions. Higher speed and performance. On-chip ROM structure in a microcontroller provides better firmware security. Easy to design with low cost and small size.
Microcontroller structure:
CPU:
CPU is the brain of a microcontroller . CPU is responsible for fetching the instruction, decodes it, then finally executed. CPU connects every part of a microcontroller into a single system. The primary function of CPU is fetching and decoding instructions. Instruction fetched from program memory must be decoded by the CPU.
Memory:
The function of memory in a microcontroller is same as microprocessor. It is used to store data and program. A microcontroller usually has a certain amount of RAM and ROM (EEPROM, EPROM, etc) or flash memories for storing program source codes.
Serial ports:
Serial ports provide various serial interfaces between microcontroller and other peripherals like parallel ports.
Timers/counters:
This is the one of the useful function of a microcontroller. A microcontroller may have more than one timer and counters. The timers and counters provide all timing and counting functions inside the microcontroller. The major operations of this section are perform clock functions, modulations, pulse generations, frequency measuring, making oscillations, etc. This also can be used for counting external pulses.
DAC perform reversal operation of ADC conversion. DAC convert the digital signal into analog format. It usually used for controlling analog devices like DC motors, various drives, etc.
Interrupt control:
The interrupt control used for providing interrupt (delay) for a working program. The interrupt may be external (activated by using interrupt pin) or internal (by using interrupt instruction during programming).
Advantages of Microcontrollers:
a) Microcontrollers act as a microcomputer without any digital parts. b) As the higher integration inside microcontroller reduce cost and size of the system. c) Usage of microcontroller is simple, easy for troubleshoot and system maintaining. d) Most of the pins are programmable by the user for performing different functions. e) Easily interface additional RAM, ROM,I/O ports. f) Low time required for performing operations.
Disadvantages of Microcontrollers: a) Microcontrollers have got more complex architecture than that of microprocessors. b)Only perform limited number of executions simultaneously. c) Mostly used in micro-equipments. d) Cannot interface high power devices directly.
Applications:
Microcontrollers are widely used in modern electronics equipments. Some basic applications of microcontroller is given below. a) Used in biomedical instruments. b) Widely used in communication systems. c) Used as peripheral controller in PC. d) Used in robotics. e) Used in automobile fields.
Microprocessor Vs Microcontroller
Microprocessor Vs Microcontroller
It has many instructions to move data It has one or two instructions to move data between memory and CPU. between memory and CPU.
It has one or two bit handling instructions. It has many bit handling instructions.
Access times for memory and I/O devices are Less access time for built in memory and I/O more. devices. The system requires more hardware It is more flexible in design point of view Has single memory map for data and code Less number of pins are malfunctioned Less hardware reducing increasing the reliability Less flexible Has a separate memory map for data and code More pins are malfunctioned PCB size and
Microprocessors
1 2 3 4 5 6 7 8 It is only a general purpose computer CPU
Microcontrollers
It is a micro computer itself inside the
Memory, I/O ports, timers, interrupts are not All are integrated available inside the chip microcontroller chip
This must have many additional digital Can function as a micro computer components to perform its operation without any additional components. Systems become bulkier and expensive. Not capable for handling Boolean functions Higher accessing time required Very few pins are programmable Very few number of bit handling instructions Make the system simple, economic and compact Handling Boolean functions Low accessing time Most of the pins are programmable Many bit handling instructions
Instruction Set:
The set of machine instructions that a uP recognizes and can execute the only language uP knows An instruction set includes low-level, a single step-ata-time instructions, such as add, subtract, multiply, and divide Each uP family has its unique instruction set
Bigger instruction-sets mean more complex chips (higher costs, reduced efficiency), but shorter programs
Programming Software:
Machine Language: Binary Instructions Difficult to decipher and write Error-prone All programs converted into machine language for execution
Instruction 10000000 00101000 00011011 Hex 80 28 1B Mnemonic ADD B ADD A, R0 ABA Description Add reg B to Acc Add Reg R0 to Acc Add Acc A and B Processor Intel 8085 Intel 8051 Motorola 6811
A word length of 8bit can have 256 combinations of 8 bit thus a language of 256 words.
It is difficult to write program in sets of 0 and 1. Manufacturers have devised English-like language words to represent binary instruction. Programmers can write programs called assembly language programs.
Assembly Language:
Machine instructions represented mnemonics One-to-one correspondence Efficient execution and use of memory Machine-specific
in
Assembly languages are machine dependent. Cannot be ported to another machine. Difficulty was overcome by using higher level
languages.
High-Level Languages: BASIC, C, and C++ Written in statements of spoken languages Machine independent Easy to write and troubleshoot Larger memory and less efficient execution
Con:
Microcode became more difficult to test and debug as systems became more complex requiring numerous patches to fix bugs. Programmers werent using the more complex instructions sets in favor of smaller instructions that accomplished the same result. The use of memory operands caused structural hazards preventing concurrent execution of instructions. (pipelining)
Observations leading to RISC methodology: Only 20% of the available instructions were being used. Transistors currently allocated to these complex instruction sets could be better utilized elsewhere to gain performance.
RISC Methodology:
Reduce the instruction set by eliminating all but the most necessary instructions Replace the complex instructions with groups of smaller ones
Advantages of RISC:
RISC uses only register to register operations Only LOAD and STORE operations have access to memory Separation of LOAD and STORE instructions allows the compiler to shift these operations around for maximum efficiency during execution. Simple instructions require fewer transistors which make the chips easier to design and cheaper to produce
The difference between CISC and RISC becomes evident through the basic computer performance equation: CPU TIME = time/program = [ (instructions/program) x (cycles/instruction) x (time/cycle) ]
RISC systems shorten execution time by reducing the clock cycles per instruction (i.e. simple instructions take less time to interpret)
CISC systems shorten execution time by reducing the number of instructions per program
RISC:
To multiply two numbers, first load each operand from a location in main memory (locations 1:1 through 6:4) into one of the six registers (A, B, C, D, E, or F). Once loaded, they can be multiplied by the execution unit (or ALU).
1. 2. 3. 4.
LOAD [A, 2:3] LOAD [B, 5:2] MULT [A, B] STORE [2:3, A]
CISC:
CISC rolls up this instruction set into one compact instruction to be handled by the decoder. MULT [2:3, 5:2] Microcode engine within the CPU decodes the complex instructions and executes microcode programs to carry out the task
Complexity in microcode
0 1 2 3 4 5 6 7 8 9
Hexadecimal
base = 16 16 symbols (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)
Decimal (base 10) numbers are expressed in the positional notation 100
Decimal (base 10) numbers are expressed in the positional notation 1000
Why binary ?
Because this system is natural for digital computers The fundamental building block of a digital computer the switch possesses two natural states, ON & OFF. It is natural to represent those states in a number system that has only two symbols, 1 and 0, i.e. the binary number system
Convert 75 to Binary
2 2 2 2 2 2 2 75 37 18 9 4 2 1 0
remainder
1 1 0 1 0 0 1
1001011
Check
1001011 = 1x20 + 1x21 + 0x22 + 1x23 + 0x24 + 0x25 + 1x26 = 1 + 2 + 0 + 8 + 0 + 0 + 64 = 75
0 0 1 0 0 1 1
1100100
Logic Gates
Let x, y, z be Boolean variables. Boolean variables can only have binary values i.e., they can have values which are either 0 or 1
For example, if we represent the state of a light switch with a Boolean variable x, we will assign a value of 0 to x when the switch is OFF, and 1 when it is ON
OR +
AND *
NOT
AND Gate
Truth Table for the AND Operation (z true when both x & y true)
x
0
y
0
z=xy
0 1
1
1 0
1
x
0
y
0
z=xy
0
0 1
1
1 0
1
0 0
1
AND Gate:
Logic Gate:
x y x*y = z
Truth Table:
x 0
x y
y 0
z 0
Series Circuit:
0 1 1
1 0 1
0 0 1
x*y = z
xy
OR Gate
x
0
y
0
z=x+y
0 1
1
1 0
1
x
0
y
0
z=x+y
0
0 1
1
1 0
1
1 1
1
OR Gate:
Logic Gate:
X X+Y = Z
Truth Table:
X
X 0
Y 0
Z 0
Parallel Circuit:
0 1 1
Z
1 0 1
1 1 1
y
xy
NOT Gate
x
0
y = x
x
0
y = x
1
NOT Gate:
Logic Gate: (also called an inverter) x Y or x
Truth Table:
x 0
y 1
1
Single-throw Double-pole Switch: x Y or x
The not gate is often called an "Inverter". It has one input and one output. The little circle attached to any gate indicates that the output is logically negated or inverted
x y
NAND
NOR
NAND Gate
A 0
B 0
Y=AB 1
1
0 1
1
1 0
NAND
1 1
NOR Gate
A 0
B 0
Y= AB 1
1
0 1
0
0 0
NOR
1 1
XOR Gate
XOR
Truth Table for the XOR Operation (z true when x or y true, but not both)
x
0
y
0
z=xy
0 1
1
1 0
1
x
0
y
0
z=xy
0
0 1
1
1 0
1
1 1
0
x y
Answer: (x+y)y
__
122
x+y
(x+y)y
y
x y
Answer: xy
___ __
x y
xy
xy