MICROPROCESSOR PROGRAMMING AND INTERFACING

37
MICROPROCESSOR PROG RAMMIN G AND INTERFACING 09/15/2013 1

description

MICROPROCESSOR PROGRAMMING AND INTERFACING. Today's Lecture. Quick Overview what we already discuss. Intel Microprocessors basic Concepts Instruction Set of Microprocessor Pin Configuration of 8086/8088 up. Introduction:. What is a Microprocessor?. - PowerPoint PPT Presentation

Transcript of MICROPROCESSOR PROGRAMMING AND INTERFACING

Page 1: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

MICROPROCESSOR PROGRAMMING AND INTERFACING

1

Page 2: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

Today's Lecture• Quick Overview what we already discuss.• Intel Microprocessors basic Concepts• Instruction Set of Microprocessor • Pin Configuration of 8086/8088 up

2

Page 3: MICROPROCESSOR PROGRAMMING AND INTERFACING

Introduction:

09/1

5/20

13

3

What is a Microprocessor?

What is a Microcontroller?

A microprocessor (abbreviated as µP or uP) is an electronic computers central processing unit (CPU) made from miniaturized transistors and other circuit elements on a single semiconductor integrated circuit (IC). It performs arithmetic, logic and control operations. It contains a control unit, an arithmetic & logic unit, registers and links to store data and connect to peripherals.

Dedicated to performing one task. Integrates the memory and other features of a microprocessor.

Page 4: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

Intel ‘Family’ of Microprocessors

• 4004 - 1971• 8008 - 1972• 8080 - 1974• 8086/88 - 1978• 80286 - 1982• 80386 - 1985• 80486 - 1989

• Intel® Pentium® processor Extreme – 2006• Intel® Core™ Duo Processors - 2006

4

Pentium - 1993 P Pro - 1995 P II - 1998 P III - 1999 P IV - 2000 P M - 2003 P 4 HT - 2004. P D - 2005

Page 5: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/15/2013

Intel 4004 – 4Bit (1971)

5

The World's First Single Chip Microprocessor (2,300 transistors )invented by Intel engineers Federico Faggin, Ted Hoff, and Stan Mazor.

Page 6: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

Intel 8008 – 8Bit (1972)

6

Page 7: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/15/2013

Intel 8080 – 16Bit (1978)

7

Page 8: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

8

Intel Pentium

Intel 8086

Page 9: MICROPROCESSOR PROGRAMMING AND INTERFACING

Applications:

09/1

5/20

13

9

Low-end – Simple control use. (Traffic Lights.) High-end –

• Complicated Controllers .(Robotics, Avionics etc.)• Data Processing. (CPU)

Control – Where the processor is used to control/perform actions. Data Processing – Data Manipulation and Calculations.

Application Types:

Uses:

Most applications we use are high-end and use microprocessors for both Control and Data Processing.

Page 10: MICROPROCESSOR PROGRAMMING AND INTERFACING

Complexity

09/1

5/20

13

10

Microelectronic Device Complexity:

SSI (Small Scale Integration) - Less than 10 gates MSI (Medium Scale Integration) - Between 10 gates

and 100 gates. LSI (Large Scale Integration) - Between 100 and a

10000 gates VLSI (Very Large Scale Integration) - Greater then

10000 gatesAlmost all current applications require VLSI.

Page 11: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

Computer Architecture

11

• A modern meaning of the term computer architecture covers three aspects of computer design:

– instruction set architecture,

– computer organization and

– computer hardware.

• Instruction set architecture - ISA refers to the actual programmer

visible machine interface such as instruction set, registers, memory organization and exception (i.e. interrupt) handling.

One can think of a ISA as a hardware functionality of a given computer.

Page 12: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

Computer Organization and Hardware

12

• Computer organization includes the high-level aspects of a design, such as the memory system, the bus structure, and the design of the internal CPU (where arithmetic, logic, branching and data transfers are implemented).

• Computer hardware refers to the specifics of a machine, included the detailed logic design and the packaging technology of the machine.

• A computer organization and computer hardware are two

components of the implementation of a machine.

Page 13: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

Tasks of Computer Architects

13

• Computer architects must design a computer to meet functional requirements as well as price, power, and performance goals. Often, they also have to determine what the functional require- ments are, which can be a major task. • Once a set of functional requirements has been

established, the architect must try to optimize the design. Here are three major application areas and their main requirements:– Desktop computers: focus on optimizing cost-performance

as measured by a single user, with little regard for program size or power consumption, – Server computers – focus on availability, scalability, and throughput cost-performance, – Embedded computers – driven by price and often power issues, plus code size is important.

Page 14: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

Rapid Rate of Improvements

14

• Today, less than one thousand dollars purchases a personal computer that has more performance, more main memory, and more disk storage than a computer bought in 1980 for one million dollars.

• For many applications, the highest-performance microcom- puters of today outperform the supercomputers of less than 10 years ago.

• This rapid rate of improvement has come from two forces:

– technology used to build computers and

– innovations in computer design.

Page 15: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

Technology Trends

15

• Integrated circuit logic technology – a growth in transistor

count on chip of about 55% per year.• Semiconductor RAM – density increases by 40% to 60% per year, while cycle time has improved very slowly, decreasing by about one-third in 10 years. Cost has decreased at rate about the rate at which density increases.• Magnetic disc technology – disk density has been recently improving more then 100% per year, while prior to 1990 about 30% per year.• Network technology – Latency and bandwidth are important, though recently bandwidth has been primary focus. Internet infrastructure in the U.S. has been doubling in bandwidth every year.

Page 16: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

Developments in Computer Design

16

• During the first 25 years of electronic computers both forces, technology and innovations in computer design made major contributions.

• Then, during the 1970’s, computer designers were largely dependent upon integrated circuit technology, with roughly 35% growth per year in processor performance.

• In the last 20 year, the combination of innovations in computer design and improvements in technology has led sustained growth in performance at an annual rate of over 55%. In this period, the main source of innovations in computer design has come from RISC-style pipelined processors.

Page 17: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

How CPUs get faster

17

Scientific American Nov 04

Page 18: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

Growth in Microprocessor Performance

18

Page 19: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

Approaches to Instruction Set Architecture

19

• For many years the interaction between ISA and implementat- ions was believed to be small, and implementation issues were not a major focus in designing instruction set architecture.

• In the 1980’s, it becomes clear that both the difficulty of designing processors and performance inefficiency of processors could be increased by instruction set architecture complications.

• Two main approaches of ISA:

– RISC (Reduced Instruction Set Computer) architecture

– CISC (Complex Instruction Set Computer) architecture.

Page 20: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

RISC Architecture

20

After 1985, most computers announced have been of RISC architecture. RISC designers focused on two critical performance techniques in computer design:

– the exploitation of instruction-level parallelism, first through pipelining and later through multiple instruction issue,– the use of cache, first in simple forms and later using sophisticated organizations and optimizations.

RISC – Reduced Instruction Set Computer

RISC architecture goals are ease of implementation (with emphasis on concepts such as advanced pipelining) and compatibility with highly optimized compilers.

Page 21: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

21

RISC ISA Characteristics• All operations on data apply to data in registers and typically change the entire register;• The only operations that affect memory are load and store operations that move data from memory to a register or to memory from a register, respectively; • A small number of memory addressing modes;

• The instruction formats are few in number with all instructions typically being one size;

• Large number of registers;

These simple properties lead to dramatic simplifications in the implementation of advanced pipelining techniques, which is why RISC architecture instruction sets were designed this way.

Page 22: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

22

CISC ArchitectureCISC – Complex (and Powerful) Instruction Set Computer

VAX processor was a good example of CISC architecture. Forexample: accounting for all addressing modes and limiting to byte, word (16 bits) and long (32 bits), there are more than 30,000 versions of integer add in VAX. ( Virtual Address Extension)

CISC goals, such as simple compilers and high code density, led to the powerful instructions, powerful addressing modes and efficient instruction encoding.

Question: What is today the main example of CISC architecture processor?Answer: Intel IA-32 processors (found in over 90% desktop computers).

Page 23: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

IA - 32• 1978: The Intel 8086 is announced (16 bit architecture)• 1980: The 8087 floating point coprocessor is added• 1982: The 80286 increases address space to 24 bits, +instructions• 1985: The 80386 extends to 32 bits, new addressing modes• 1989-1995: The 80486, Pentium, Pentium Pro add a few instructions

(mostly designed for higher performance)• 1997: 57 new “MMX” instructions are added, Pentium II (8-Regs)• 1999: The Pentium III added another 70 instructions (SSE)• 2001: Another 144 instructions (SSE2)• 2003: AMD (Advanced Micro Device (CYRIx)) extends the architecture to increase

address space to 64 bits,widens all registers to 64 bits and other changes (AMD64)

• 2004: Intel capitulates and embraces AMD64 (calls it EM64T) and addsmore media extensions

• “This history illustrates the impact of the “golden handcuffs” of compatibility

“adding new features as someone might add clothing to a packed bag”

“an architecture that is difficult to explain and impossible to love” 23

Page 24: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

Intel IA-32 Processors

24

• Since 1995, Pentium processors consist of a front end processor and a RISC-style processor.

• The improvements in technology have allowed the latest Intel IA-32 processors (of CISC architecture) to adopt many innovations first pioneered in the RISC design.

A microinstruction is a simple instruction used in sequence to implement a more complex instruction. Microinstructions look very much as RISC instructions.• Then, the RISC-style processor executes

microinstructions.

• The front end processor fetches and decodes Intel IA-32 complex instructions and maps them into microinstructions.

• Intel IA-32 processors, from 80386 processor in early 80’s to Pentium IV today are of CISC architecture. All Intel IA-32 processors are having as a core the identical instruction set architecture designed in early 1980’s.

Page 25: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

25

What Is This Course About?

In this course we are going to learn basic principles of processor and memory design using functionality of MIPS processor, i.e. we shall design processor-memory system with (a subset of) MIPS instruction set architecture.

Somewhere some time ago, I read that MIPS processor is thebest-selling RISC processor that powers everything from Nintendo game machines and Cisco networking routers to Silicon Graphics’ high-end servers and supercomputers.

What does MIPS stand for?

Answer: Microprocessor without Interlocked Pipeline Stages. MIPS processor is one of the first RISC processors.

Page 26: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/15/2013

Instructions:• Language of the Machine• We’ll be working with the MIPS instruction set architecture

• similar to other architectures developed since the 1980's• Almost 100 million MIPS processors manufactured in 2002• used by NEC, Nintendo, Cisco, Silicon Graphics, Sony, …

26

1400

1300

1200

1100

1000

900

800

700

600

500

400

300

200

100

01998 2000 2001 20021999

OtherSPARCHitachi SHPowerPCMotorola 68KMIPSIA-32ARM

Page 27: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

Why learn this stuff?• You want to call yourself a “Electronic scientist”• You want to build software people use (need performance)• You need to make a purchasing decision or offer “expert” advice

• Both Hardware and Software affect performance:• Algorithm determines number of source-level statements• Language/Compiler/Architecture determine machine instructions

(Chapter 2 and 3)• Processor/Memory determine how fast instructions are executed

(Chapter 5, 6, and 7)

• Assessing and Understanding Performance in Chapter 4

27

Page 28: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

What is a computer?• Components:

• input (mouse, keyboard)• output (display, printer)• memory (disk drives, DRAM, SRAM, CD)• network

• Our primary focus: the processor (datapath and control)• implemented using millions of transistors• Impossible to understand by looking at each transistor• We need...

28

Page 29: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

Abstraction

• Delving into the depths reveals more information

• An abstraction omits unneeded detail, helps us cope with complexity

What are some of the details that appear in these familiar abstractions? 29

Page 30: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

How do computers work?• Need to understand abstractions such as:

• Applications software• Systems software• Assembly Language• Machine Language• Architectural Issues: i.e., Caches, Virtual Memory, Pipelining• Sequential logic, finite state machines• Combinational logic, arithmetic circuits• Boolean logic, 1s and 0s• Transistors used to build logic gates (CMOS)• Semiconductors/Silicon used to build transistors• Properties of atoms, electrons, and quantum dynamics

• So much to learn!

30

Page 31: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

Instruction Set Architecture• A very important abstraction

• interface between hardware and low-level software• standardizes instructions, machine language bit patterns, etc.• advantage: different implementations of the same architecture• disadvantage: sometimes prevents using new innovations

True or False: Binary compatibility is extraordinarily important?

• Modern instruction set architectures:• IA-32, PowerPC, MIPS, SPARC, ARM, and others

31

Page 32: MICROPROCESSOR PROGRAMMING AND INTERFACING

Microcomputer System

09/1

5/20

13

32

Microprocessor(CPU)

Timing

Bus Control

logic

Interface Memory Module

InterfaceMass

Storage Device

Interface I/O Devices

Page 33: MICROPROCESSOR PROGRAMMING AND INTERFACING

Components

09/1

5/20

13

33

Hardware : CPU – Microprocessor Unit (MPU)

Logical, Arithmetic computations and control operations

Timer –Produces evenly spaced clock pulsesNeeded for synchronization. – Now Integrated

Memory Modules – Multiple They hold both data and instructions.

I/O Subsystem – External Devices and mass storage.

Bus System – Communication lines

Interface – Allows connection of Bus to devices. Buffering and decoding are two major functions.

Page 34: MICROPROCESSOR PROGRAMMING AND INTERFACING

09/1

5/20

13

34

Software: System Software

Collection of programs needed in the creation, preparation and execution of other programs ( Operating Systems – Windows XP)

High-Level Language – Instructions that are closer to English and the mental model used by programmers to solve problems. Translated to machine language using Compiler or Interpreter.

Programming:

User SoftwareSoftware which helps solve different problems and provides user level functionality. ( Applications – Microsoft Power Point)

Machine Language – Is understood and run by computer Assembly Language – Closely linked to Machine language, more readable for humans, Usually 1-1 mapping, translated to machine language using Assembler

Page 35: MICROPROCESSOR PROGRAMMING AND INTERFACING

Operations

09/1

5/20

13

35

CPU/Microprocessor should support :1. Assignment and Arithmetic expression2. Unconditional Branches3. Conditional Branches (Relational & Logical

Expression)4. Looping5. Arrays and other Data Structures6. Subroutines7. I/O Operations

Page 36: MICROPROCESSOR PROGRAMMING AND INTERFACING

Typical Microprocessor Architecture

09/1

5/20

13

36

I/O Control Logic

Control Unit

Program Counter (PC )

Instructions Register

Processor Status Word (PSW)

Stack Pointer (SP)

Working Registers

Address Registers..

Arithmetic Registers..

Arithmetic Logic Unit (ALU)

Page 37: MICROPROCESSOR PROGRAMMING AND INTERFACING

Reasons for using Microprocessors

09/1

5/20

13

37

Cost Flexibility Development Time Speed Reliability