Micro Unit 1
Micro Unit 1
Chapter Objectives
General-purpose Computers and High Performance Systems
Embedded Computing
The CPU
Chapter Objectives
Input / Output
The Registers
Chapter Objectives
The Control Unit Instructions and Data The Control Logic
Microprocessor Instructions
Micro cycles
SECTION 1: INTRODUCTION
MICROPROCESSORS
History of Computation
Mechanical Age: B.C. to 1800s
500 B.C. Babylonians invented abacus, first mechanical calculator 1642 Blaise Pascal invented calculator using wheels and gears 1823 Charles Babbage created Analytical Engine capable of storing data using punch cards
History of Computation
Electrical Age: 1800s to 1970s
Triggered by advent of electric motor (conceived by Faraday) Motor driven adding machines based on Pascals idea
History of Computation
1896 Hollerith formed Tabulating Machine Company (Todays IBM) 1946 ENIAC (Electronics Numerical Integrator and Calculator) First general purpose programmable electronic machine Used 17000 vacuum tubes, 500 miles of wires, weighed 30 tons. Performed 100K operations/second, programmed by rewiring)
History of Computation
Integrated Circuits Age: 1960s to present
Triggered by development of transistor at Bell Labs, 1948
1958 IC technology invented by Jack Kilby of Texas Instruments 1971 Worlds first microprocessor, Intel 4004, 4-bit bus 4K 4-bit(nibble) memory, 50 KIPs, 2300 transistors, 10 m technology 1972 first 8-bit P, Intel 8008, 16K bytes, 50 KIPs
History of Computation
1973 Intel 808, 64K bytes, 500 KIPS, 6000 transistors, 6 m followed by other 8-bit Ps lke Motorola MC6800 (1974) and Z-8
1978 Intel 8086, 16-bit P, 1M bytes, 2.5 MIPs Used 4-bytes instruction cache to speed up execution time Base for 80286 P, also 16-bit with 16M bytes
History of Computation
1986 Intel 80386, 32-bit P, 32-bit data and address busses 4G bytes, 16 to 33 MHz, 275000 transistors, 1 m
1989 Intel 80486, like 80386 with numeric coprocessor. 4G bytes + 8Kb cache, 25 to 50 MHz, 1.2M transistors, 1 and 0.8 m
Advancement continues with Intel, AMD, Motorola, and other Ps
Convenience
Large memory, smaller size, and lower weight
Power Dissipation
Portable computers and wireless services
Reliability
Noise tolerance in adverse environments and temperatures
Cost
Get more done for the money
THE CPU
Central Processing Unit (CPU) - system component responsible for processing the instructions that control the flow of information in the system causing the transformation of data Early CPUs consisted of several components. In the 1970s VLSI technology allowed CPUs and additional circuitry to be fabricated on a single chip
THE CPU
MICROPROCESSOR
When the CPU is fabricated as a single chip (or as a part of a single chip) then that chip is known as a microprocessor
MICROPROCESSORS
4-Bit 8-Bit 16-Bit
32-Bit
64-Bit
Microprocessors are classified by their word size - the number of bits which can be stored and operated on as a single unit inside their CPU
MICROPROCESSORS
Used to replace equivalent hardwired logic Unit cost is lower than direct logic when volumes are high
Overall UnIt Cost Component Cost per unIt: Random CPU CPU Number of unIts produced LogIc
(general) (custom)
MICROPROCESSORS
Microprocessors require more attention to software design whereas hardware design is important in direct logic designs
MICROPROCESSORS
Speed generally lower than direct logic Direct logic must be redesigned for any modification whereas microprocessors can form entire families of products by changing the software
Random logic
Specific Hardware High Low Difficult Redesign always Very fast
Microprocessor
General Software Low High Relatively easy (Families of Products) Alike Moderate
MICROPROCESSOR SYSTEMS
Microprocessor-based systems can generally be divided into two distinct groups:
General-purpose Computers Microcontrollers
GENERAL-PURPOSE COMPUTERS
These computer systems are designed to be as versatile as possible Consist of generalised microprocessor and expandable PCB mainboard 1000s of uses and applications!
High performance systems are used to run computationally intensive and data processing applications Much more expensive than the average PC (specialized software and small volumes)
MICROCONTROLLERS
PIC
Replaces equivalent random logic design When fabricated as a single chip which can be programmed on a PCB it is called a PIC (Programmable In-circuit Controller)
MICROCONTROLLERS
Do not require excellent CPU performance Software is not generally as sophisticated as that for general-purpose computers Unit costs much lower than that of general microprocessor systems
MICROCONTROLLERS
Main factors in selecting a microprocessor for a micro-controller:
cost power consumption overall system chip count external interfacing features on-chip additional support circuits (DACs, ADCs, timers, )
Examples
Personal digital assistant (PDA). Printer. Cell phone. Automobile: engine, brakes, dash, etc. Television. Household appliances. PC keyboard (scans keys).
Early History
Late 1940s: MIT Whirlwind computer was designed for real-time operations.
Originally designed to control an aircraft simulator.
Microprocessor Varieties
Micro-controller: includes I/O devices, onboard memory. Digital signal processor (DSP): microprocessor optimized for digital signal processing.
Application Examples
Simple control: front panel of microwave oven, etc. Canon EOS 3 has three microprocessors.
32-bit RISC CPU runs autofocus and eye control systems.
Analog TV: channel selection, etc. Digital TV: programmable CPUs + hardwired logic.
EMBEDDED SYSTEMS
Typical embedded system applications
EMBEDDED COMPUTING
Since the start of the computing age (1940s1950s) computers have been embedded in applications An embedded system is an infrastructure, including programmable computers, which contains a microprocessor but which is not itself a general-purpose computing system The application characteristics influence the design of the infrastructure
SECTION 2
PROGRAMMABLE COMPUTERS
CPU MEMORY
A separate memory which can hold CPU instructions is what defines a programmable computer
MEMORY
Instructions and Data reside in the same memory banks Simple and Economical
Harvard ARCHITECTURE
INPUT CPU OUTPUT
INSTRUCTION MEMORY
DATA MEMORY
Fetch instruction and fetch/store data at the same time (Performance improvements) More expensive and specialized
These main units are connected by busses which enables data to flow between them
MICROPROCESSOR PROGRAMMING
High-Level Language (e.g. C++) Assembly Language Binary Machine Code Instructions
Instruction Flow CU CCR MEMORY Control Signals
IR ALU CPU
MEMORY
Very large array of cells each of which can hold one BInary digiT (BIT) The number of bits which can be accessed simultaneously is called a word usually expressed in bytes (8 bits) The size of memory in bytes is always a power of 2 (usually expressed in K bytes) Each word has a distinct address
MEMORY
A CPU must provide the address of the data it wishes to access to the memory device Both instructions and data may reside in the same memory bank - the only difference between them being how they are interpreted by the CPU Memory devices can be classified as
read only, read/write, volatile and non-volatile
INPUT/OUTPUT
INPUT MICRO
I/O provides the only means by which a microprocessor can communicate with the outside world (A system without I/O is useless) I/O is accessed via ports which are accessed in a similar manner to memory
EXTERNAL BUSSES
These connect the CPU to external systems such as I/O devices and memory banks Busses can be divided into data, address and control lines
OPTIMIZATIONS
Additional external busses can help increase system performance (for example, the Harvard architecture)
Additional internal busses can allow CPU instructions to be executed concurrently Optimizations greatly complicate the design of a microprocessor system and its CPU
SECTION 3
What is a Microprocessor?
Simplest form: Clocked Sequential Circuit Responds to: A known Series of Binary Signals
Specific Signal sets can force the microprocessor to do specific things. These sets are called instructions. A sequence of Instructions is called a program and the generation is of the program is called machine-code programming.
Registers
Made up of number of flip-flips connect in parallel and clocked simultaneously.
Registers
Information is latched in the registers Can be moved internally to other registers or components, or it could move to an external device to the microprocessor Register width is related to memory width, usually by a factor of 2
E.g. If memory is 16 bits wide, then the some of the registers will be 16 and others 32 bits wide.
Micro-Operations
Register have combination logic associated with them to perform simple functions and are called micro-operations. There are many types of micro-operations and the registers wont usually be able to perform all of them
Load, Clear, Complement, Increment, Decrement, Shift Right, Shift Left, Serial Load Left, Serial Load Right and many more!
Micro-Operations
Notation:
Rn is the most significant bit (MSB) R0 is the least significant bit (LSB) Ri is any bit
Examples:
R <- R-1 : Decrement Ri+1 <- Ri ; R0 <- 0 : Shift Left
Micro-Operations
The ALU
Used to perform arithmetic and logic operations on the contents of registers Dedicated unit and performs more complex operations than the registers
The ALU
Typical Functions:
Addition Subtraction Logic And/OR/XOR Complement Increment
The outputs are connected directly to the bus and tri-state buffered. Because it takes time to set up the registers, an ALU operation is slower than a registers micro operation.
Control Unit
Contains the hardware instruction logic Decodes and monitors instruction execution Arbiter for the resources in the CPU
SECTION 4
Note: Instructions and Data share the same Data Bus path for accessed memory as the process to retrieve the information is exactly the same! The operation of the CPU determines the content
Control Logic
A small sequential circuit or state machine
Fetch Cycle:
Instruction read from memory and applied to control logic inputs
Execute Cycle:
Control signals are generated appropriately
Control Logic
A: Accumulator
Drives input of ALU Logic operations can take place here
General Registers
General purpose use within the processor and are assumed to be the same as the accumulator.
In the simple machine we assume the PC can increment and the SP can increment or decrement itself.
Microprocessor Instructions
Instructions complete certain tasks and must include certain bits on information to complete these tasks:
1. The Operation (Opcode)
The instructions such as add Or where the data can be found if the data is in memory For instructions such as add which take two inputs Where to put the data after the instruction has completed
4. Destination
5. Next instruction
Microprocessor Instructions
Cannot be stored in a single memory location (8 bits) so reduction is needed
Requirement 5 omitted:
Assume next instruction follows on immediately after the current instruction!
Microprocessor Instructions
Example:
Add C (Instruction = 81Hex) 1. 2. 3. 4. 5. Operation: Addition Source 1: Accumulator (Implied) Source 2: Register C Destination: Accumulator (Implied) Next instruction: Followed on (Implied)
Microprocessor Instructions
Even after such simplification, commands that require memory access to perform the instruction will need to use more than 8 bits These commands are known as multi-byte instructions The first byte is then the Opcode and the following bytes supply the extra information.
Microcycles (1)
The execution of each instruction is made of of smaller operations called microcycles Each microcycle takes one clock cycle to perform Represents one register manipulation or one data transfer Notation:
Destination<-Source
MAR <- PC or IR <- MDR PC <- PC + 1 or SP <- SP - 1
Microcycles (2)
If memory must be accessed, it cannot be done in one clock cycle. The appropriate registers need to be accessed and the memory requested. This is done by:
MAR <- source register MDR <- memory(MAR)
Microcycles (3)
Each microcycle involving transfer of data internally uses the internal bus and only one such cycle can occur at a time If an operation involves a register manipulation or external memory, then it can occur at the same time as an internal bus operation
InstructionsSummary
To summaries, the instruction cycle is made up of two sections:
Fetch the instruction and any necessary operands Execute the instruction
InstructionsExample
"Add the contents of the accumulator to the contents of memory location 2100, and leave the result of the addition in the accumulator". Assume:
Opcode is A2 (hex) Little endian
Instruction Fetch
MAR PC
PC PC + 1
Opcode address
PC points to the 1st operand
MDRmemory(MAR)
IR MDR
Cycle IV Va Vb
Description Operand address into MAR PC points to 2nd operand Get 1st operand byte
VI
VII
DP(L) MDR
MAR PC PC PC + 1 MDRmemory(MAR) DP(H) MDR MAR DP MDRmemory(MAR) tempR MDR A A plus tempR
VIIIa VIIIb IX X
Point to next opcode Get 2nd operand byte Put into MSbyte of DP Address of operand data into MAR
XI XII XIII
Get operand data byte Put into tempR of ALU Use ALU to add A and tempR
Notes
Four machine cycles were used to perform the instruction First three are FETCH cycles A total of 13 clock cycles are used for the four machine cycles The PC is used to point to the next byte to be fetched, and is incremented by 1 automatically during (simultaneous with) every memory fetch PC increment is by register manipulation
Notes
The first fetch (the opcode fetch cycle) is the same for all instructions Any further fetch cycles are dictated by the opcode itself
Opcode is now in the IR and influences the operation of the control logic