COMP3221: Microprocessors and Embedded Systems Lecture 2: Instruction Set Architecture (ISA) Lecturer: Hui Wu Session.

Slides:



Advertisements
Similar presentations
CH10 Instruction Sets: Characteristics and Functions
Advertisements

Chapter 3 Instruction Set Architecture Advanced Computer Architecture COE 501.
1 Lecture 3: Instruction Set Architecture ISA types, register usage, memory addressing, endian and alignment, quantitative evaluation.
INSTRUCTION SET ARCHITECTURES
1 ECE462/562 ISA and Datapath Review Ali Akoglu. 2 Instruction Set Architecture A very important abstraction –interface between hardware and low-level.
INTRODUCTION TO THE ARM PROCESSOR – Microprocessor Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat.
Khaled A. Al-Utaibi  Computers are Every Where  What is Computer Engineering?  Design Levels  Computer Engineering Fields  What.
COMP3221: Microprocessors and Embedded Systems
Chapter 4 Processor Technology and Architecture. Chapter goals Describe CPU instruction and execution cycles Explain how primitive CPU instructions are.
What is an instruction set?
Unit -II CPU Organization By- Mr. S. S. Hire. CPU organization.
Processor Types And Instruction Sets Barak Perelman CS147 Prof. Lee.
Overview of Microprocessors
Computer Organization and Assembly language
Computers Central Processor Unit. Basic Computer System MAIN MEMORY ALUCNTL..... BUS CONTROLLER Processor I/O moduleInterconnections BUS Memory.
CEG 320/520: Computer Organization and Assembly Language Programming1 CEG 320/520 Computer Organization and Assembly Language Programming.
CSE378 MIPS ISA1 MIPS History MIPS is a computer family –R2000/R3000 (32-bit); R4000/4400 (64-bit); R8000; R10000 (64-bit) etc. MIPS originated as a Stanford.
Cisc Complex Instruction Set Computing By Christopher Wong 1.
Instruction Set Architecture
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CS-334: Computer.
Homework Problems 1. M1 runs the program P in 1.4 * 9 * ns or ns M2 runs the program P in 1.6*9800*10ns or ns Hence M2 is faster by.
Computers organization & Assembly Language Chapter 0 INTRODUCTION TO COMPUTING Basic Concepts.
1 Instruction Set Architecture (ISA) Alexander Titov 10/20/2012.
Chapter Six Sun SPARC Architecture. SPARC Processor The name SPARC stands for Scalable Processor Architecture SPARC architecture follows the RISC design.
Computer Architecture and Organization
Computer Architecture EKT 422
Introduction to Microprocessors
MICROOCESSORS AND MICROCONTROLLER:
Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown.
Microarchitecture. Outline Architecture vs. Microarchitecture Components MIPS Datapath 1.
Lecture 7: Overview Microprocessors / microcontrollers.
What is a program? A sequence of steps
Group # 3 Jorge Chavez Henry Diaz Janty Ghazi German Montenegro.
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
Ass. Prof. Dr Masri Ayob TK 2123 Lecture 14: Instruction Set Architecture Level (Level 2)
The Processor & its components. The CPU The brain. Performs all major calculations. Controls and manages the operations of other components of the computer.
Instruction Sets: Characteristics and Functions  Software and Hardware interface Machine Instruction Characteristics Types of Operands Types of Operations.
INSTRUCTION SET PRINCIPLES. Computer Architecture’s Changing Definition  1950s to 1960s: Computer Architecture Course = Computer Arithmetic  1970s to.
Computer Operation. Binary Codes CPU operates in binary codes Representation of values in binary codes Instructions to CPU in binary codes Addresses in.
CSC 221 Computer Organization and Assembly Language Lecture 06: Machine Instruction Characteristics.
Computer Architecture & Operations I
Computer Architecture & Operations I
Microprocessor and Microcontroller Fundamentals
COMP2121: Microprocessors and Interfacing
COMP2121: Microprocessors and Interfacing
COMP3221: Microprocessors and Embedded Systems
1 Overview of Microprocessors A. Parveen. 2 Lecture overview Introduction to microprocessors Instruction set architecture Typical commercial microprocessors.
MIPS History MIPS is a computer family
ECEG-3202 Computer Architecture and Organization
Chapter 9 Instruction Sets: Characteristics and Functions
MIPS History MIPS is a computer family
Computer Instructions
ECEG-3202 Computer Architecture and Organization
What is Computer Architecture?
Introduction to Microprocessor Programming
What is Computer Architecture?
What is Computer Architecture?
Computer Architecture
MIPS History MIPS is a computer family
Review In last lecture, done with unsigned and signed number representation. Introduced how to represent real numbers in float format.
CPU Structure CPU must:
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

COMP3221: Microprocessors and Embedded Systems Lecture 2: Instruction Set Architecture (ISA) Lecturer: Hui Wu Session 1, 2005

COMP3221/9221: Microprocessors and Embedded Systems 2 Instruction Set Architecture (ISA) ISA is the interface between hardware and software For (machine language) programmers (and compiler writers) Don’t need to know (much) about microarchitecture Just write or generate instructions that match the ISA For hardware (microarchitecture) designers Don’t need to know about the high level software Just build a microarchitecture that implements the ISA Software Hardware C program ISA level ISA program executed by hardware FORTRAN 90 program FORTRAN 90 program compiled to ISA program C program compiled to ISA program

COMP3221/9221: Microprocessors and Embedded Systems 3 What makes an ISA? Memory models Registers Data types Instructions

COMP3221/9221: Microprocessors and Embedded Systems 4 What makes an ISA? #1: Memory Models Memory model: how does memory look to CPU? Issues 1. Addressable cell size 2. Alignment 3. Address spaces 4. Endianness

COMP3221/9221: Microprocessors and Embedded Systems 5 1. Addressable Cell Size Memory has cells, each of which has an address Most common cell size is 8 bits (1 byte) But not always! AVR Instruction memory has 16 bit cells Note – the data bus may be wider i.e. retrieve several cells (addresses) at once

COMP3221/9221: Microprocessors and Embedded Systems 6 2. Alignment Many architectures require natural alignment, e.g. –4-byte words starting at addresses 0,4,8, … –8-byte words starting at addresses 0, 8, 16, …

COMP3221/9221: Microprocessors and Embedded Systems 7 Alignment (cont.) Alignment often required because it is more efficient Example – Pentium II –Fetches 8 bytes at a time from memory (8-byte wide data bus) –Addresses have 36 bits, but address bus only has 33 bits –But, alignment is NOT required (for backwards compatibility reasons) 4-byte word stored at address 6 is OK Must read bytes 0 to 7 (one read) and bytes 8 to 15 (second read) then extract the 4 required bytes from the 16 bytes read

COMP3221/9221: Microprocessors and Embedded Systems 8 3. Address Spaces Princeton architecture or Von Neumann architecture (most used). –A single linear address space for both instructions and data –e.g bytes numbered from 0 to »(may not be bytes – depends on addressable cell size) Harvard architecture –Separate address spaces for instructions and data –AVR AT90S8515 Data address space: up to 2 16 bytes Instruction address space: bit words

COMP3221/9221: Microprocessors and Embedded Systems 9 AVR Address Spaces 16 Bits 32 General purpose Working Registers 0x0000 0x1F 64 Input/Output Registers Internal SRAM (128~4K bytes) External SRAM 0x20 0x5F End Address 0x0000 End Address Program Memory Data Memory 0x60 8 bits Program Flash Memory (1K bytes~128K bytes)

COMP3221/9221: Microprocessors and Embedded Systems 10 AVR Address Spaces (cont.) 8 bits 0x0000 End address Data EEPROM Memory EEPROM Memory (64~4K bytes)

COMP3221/9221: Microprocessors and Embedded Systems Endianness Different machines may support different byte orderings Two orderings: –Little endian – little end (least significant byte) stored first (at lowest address) Intel microprocessors (Pentium etc) –Big endian – big end stored first SPARC, Motorola microprocessors Most CPUs produced since ~1992 are “bi-endian” (support both) –some switchable at boot time –others at run time (i.e. can change dynamically)

COMP3221/9221: Microprocessors and Embedded Systems 12 What makes an ISA? #2: Registers Two types –General purpose Used for temporary results etc –Special purpose, e.g. Program Counter (PC) Stack pointer (SP) Input/Output Registers Status Register

COMP3221/9221: Microprocessors and Embedded Systems 13 Registers (cont.) Some other registers are part of the microarchitecture NOT the ISA Instruction Register (IR) Memory Address Register (MAR) Memory Data Register (MDR) –i.e. programmer doesn’t need to know about these (and can’t directly change or use them)

COMP3221/9221: Microprocessors and Embedded Systems 14 AVR Registers General purpose registers are quite regular –Exception: a few instructions work on only the upper half (registers 16-31) Bit limitations in some instructions (e.g. only 4 bits to specify which register) There are many I/O registers –Not to be confused with general purpose registers –Some instructions work with these, others with general purpose registers – don’t confuse them When X is needed as an index register, R26 and R27 are not available as general registers. In AVR devices without SRAM, the registers are also the only memory – can be tricky to manage

COMP3221/9221: Microprocessors and Embedded Systems 15 What makes an ISA? #3: Data Types Numeric –Integers of different lengths (8, 16, 32, 64 bits) Possibly signed or unsigned –Floating point numbers, e.g. 32 bits (single precision) or 64 bits (double precision) –Some machines support BCD (binary coded decimal) numbers Non-numeric –Boolean (0 means false, 1 means true) – stored in a whole byte or word –Bit-map (collection of booleans, e.g. 8 in a byte) –Characters –Pointers (memory addresses)

COMP3221/9221: Microprocessors and Embedded Systems 16 Data types (cont.) Different machines support different data types in hardware –e.g. Pentium II: –e.g. Atmel AVR: Data Type8 bits16 bits32 bits64 bits128 bits Signed integer Unsigned integer BCD integer Floating point Data Type8 bits16 bits32 bits64 bits128 bits Signed integer Unsigned integer BCD integer Floating point

COMP3221/9221: Microprocessors and Embedded Systems 17 Data types (cont.) Other data types can be supported in software –e.g. 16-bit integer operations can be built out of 8-bit operations –Floating point operations can be built out of logical and integer arithmetic operations

COMP3221/9221: Microprocessors and Embedded Systems 18 What makes an ISA? #4: Instructions This is the main feature of an ISA Instructions include –Load/Store – move data from/to memory –Move – move data between registers –Arithmetic – addition, subtraction –Logical – Boolean operations –Branching – for deciding which instruction to perform next

COMP3221/9221: Microprocessors and Embedded Systems 19 Some AVR Instruction Examples Addition: add r2, r1 Subtraction: sub r13, r12 Branching: breq 6 Load: ldi r30, $F0 Store: st r2, x Port Read: in r25, $16; Read port B Port Write: out $16, r17; Write to port B

COMP3221/9221: Microprocessors and Embedded Systems 20 ISA vs. Assembly Language ISA defines machine code (or machine language) –1’s and 0’s that make up instructions Assembly language is a textual representation of machine language –Example (Atmel AVR instruction): (machine code) inc r16 (assembly language, increment register 16) Assembly language also includes macros –Example:.def temp = r16.include “ 8515def.inc ”

COMP3221/9221: Microprocessors and Embedded Systems 21 Summary: What makes an ISA? Memory models Registers Data types Instructions If you know all these details, you can –Write machine code that runs on the CPU –Build the CPU

COMP3221/9221: Microprocessors and Embedded Systems 22 Backwards Compatibility Many modern ISAs are constrained by backwards compatibility –Pentium ISA is backwards compatible to the 8088 (1978) Echoes back to the 8080 (1974) –Problem: Pentium family is a poor target for compilers (register poor, irregular instruction set) AMD has defined a 64-bit extension to the Pentium architecture –Implemented by the Hammer family of CPUs

COMP3221/9221: Microprocessors and Embedded Systems 23 CISC vs. RISC How complex should the instruction set be? Should you do everything in hardware? 2 “styles” of ISA design CISC = Complex Instruction Set Computer –Lots of complex instructions – many of which take many clock cycles to execute –Examples: 8086 to –Classic example: VAX had a single instruction to evaluate a polynomial equation RISC = Reduced Instruction Set Computer –Fewer, simpler instructions which can execute quickly (often one clock cycle) –Lots of registers –More complex operations built out of simpler instructions –Examples: SPARC, MIPS, PowerPC

COMP3221/9221: Microprocessors and Embedded Systems 24 CISC vs. RISC (cont.) Originally (80s) –CISC – 200+ instructions –RISC – ~50 instructions Today –Number of instructions irrelevant –Many “CISC” processors use RISC techniques e.g … Pentium IV –Better to look at use of registers/memory CISC – often few registers, many instructions can access memory RISC – many registers, only load/store instructions access memory Atmel AVR is a RISC processor

COMP3221/9221: Microprocessors and Embedded Systems 25 ISA vs. Microarchitecture An Instruction Set Architecture (ISA) can be implemented by many different microarchitectures Examples –8086 ISA is implemented by many processors – in different ways –Pentium ISA is implemented by Pentium … Pentium IV (in different ways) Various AMD devices … Other manufacturers also…

COMP3221/9221: Microprocessors and Embedded Systems 26 Reading Material 1.Chap 2 in Microcontrollers and Microcomputers.