COMP3221: Microprocessors and. and Embedded Systems. Instruction Set Architecture (ISA) What makes an ISA? #1: Memory Models. What makes an ISA?

Similar documents
COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)

17. Instruction Sets: Characteristics and Functions

Typical Processor Execution Cycle

ECE232: Hardware Organization and Design

Module 2: Introduction to AVR ATmega 32 Architecture

Announcements HW1 is due on this Friday (Sept 12th) Appendix A is very helpful to HW1. Check out system calls

Instruction Sets: Characteristics and Functions

CSEE 3827: Fundamentals of Computer Systems

Universität Dortmund. ARM Architecture

COMP2121: Microprocessors and Interfacing. Instruction Formats and Addressing Modes

Microcomputer Architecture and Programming

Computer Architecture Dr. Charles Kim Howard University

Lecture 4: Instruction Set Architecture

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

ECE 486/586. Computer Architecture. Lecture # 7

ECE232: Hardware Organization and Design

ELC4438: Embedded System Design Embedded Processor

Microprocessor Architecture Dr. Charles Kim Howard University

EC 413 Computer Organization

EITF20: Computer Architecture Part2.1.1: Instruction Set Architecture

I ve been getting this a lot lately So, what are you teaching this term? Computer Organization. Do you mean, like keeping your computer in place?

CS 24: INTRODUCTION TO. Spring 2018 Lecture 3 COMPUTING SYSTEMS

Real instruction set architectures. Part 2: a representative sample

Instruction Set Architecture

Segment 1A. Introduction to Microcomputer and Microprocessor

A First Look at Microprocessors

Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation

COMPUTER ORGANIZATION & ARCHITECTURE

Lecture 4: RISC Computers

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

Instruction Sets Ch 9-10

Instruction Sets Ch 9-10

CHAPTER 5 A Closer Look at Instruction Set Architectures

Topics/Assignments. Class 10: Big Picture. What s Coming Next? Perspectives. So Far Mostly Programmer Perspective. Where are We? Where are We Going?

Review of instruction set architectures

Computer Organization CS 206 T Lec# 2: Instruction Sets

COMP2121: Microprocessors and Interfacing

EE 3170 Microcontroller Applications

Instruction Set II. COMP 212 Computer Organization & Architecture. COMP 212 Fall Lecture 7. Instruction Set. Quiz. What is an Instruction Set?

EC-801 Advanced Computer Architecture

Introduction to Microcontrollers

AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo

EE 3170 Microcontroller Applications

CSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

Microprocessors. Microprocessors and rpeanut. Memory. Eric McCreath

Hardware Level Organization

COMP2121: Microprocessors and Interfacing. Introduction to Microprocessors

Microprocessors and rpeanut. Eric McCreath

Instruction Set Design

Understand the factors involved in instruction set

Computer Organization

Introduction to C. Why C? Difference between Python and C C compiler stages Basic syntax in C

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:

Mark II Aiken Relay Calculator

AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo

Computer Organization and Programming

Instruction Set. Instruction Sets Ch Instruction Representation. Machine Instruction. Instruction Set Design (5) Operation types

Architectures & instruction sets R_B_T_C_. von Neumann architecture. Computer architecture taxonomy. Assembly language.

Computer Architecture

Chapter 2. Instructions: Language of the Computer. HW#1: 1.3 all, 1.4 all, 1.6.1, , , , , and Due date: one week.

Instructions: Language of the Computer

AVR ISA & AVR Programming (I)

Computer Architecture Dr. Charles Kim Howard University

Chapter 5. A Closer Look at Instruction Set Architectures

CENG3420 Lecture 03 Review

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Memory Models. Registers

Why Study Assembly Language?

EITF20: Computer Architecture Part2.1.1: Instruction Set Architecture

ECE 486/586. Computer Architecture. Lecture # 6

Chapter 1. Computer Abstractions and Technology. Lesson 3: Understanding Performance

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro

Microcontrollers. Microcontroller

Representation of Information

Instructions: Language of the Computer

Computer Architecture, RISC vs. CISC, and MIPS Processor

AVR Microcontrollers Architecture

MIPS Instruction Set Architecture (1)

Review Questions. 1 The DRAM problem [5 points] Suggest a solution. 2 Big versus Little Endian Addressing [5 points]

Assembly Language Design

Instruction-set Design Issues: what is the ML instruction format(s) ML instruction Opcode Dest. Operand Source Operand 1...

Chapter 2: Instructions How we talk to the computer

Math 230 Assembly Programming (AKA Computer Organization) Spring MIPS Intro

EE 354 Fall 2015 Lecture 1 Architecture and Introduction

CHAPTER 5 A Closer Look at Instruction Set Architectures

General Purpose Processors

Von Neumann architecture. The first computers used a single fixed program (like a numeric calculator).

CS3350B Computer Architecture MIPS Introduction

Addressing Modes Part II AVR Addressing Indirect READING

Lecture (01) Introducing Embedded Systems and the Microcontrollers By: Dr. Ahmed ElShafee

101 Assembly. ENGR 3410 Computer Architecture Mark L. Chang Fall 2009

CPE300: Digital System Architecture and Design

MICROPROCESSOR BASED SYSTEM DESIGN

ELEC / Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2)

MARIE: An Introduction to a Simple Computer

FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100)

MICROCONTROLLERS 8051

ECE260: Fundamentals of Computer Engineering

Instruction Set Architectures. CS301 Prof. Szajda

Transcription:

COMP3221: Microprocessors and Embedded Systems Lecture 2: Instruction Set Architecture (ISA) http://www.cse.unsw.edu.au/~cs3221 Lecturer: Hui Wu Session 2, 2005 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 FORTRAN 90 program FORTRAN 90 program compiled to ISA program ISA level C program ISA program executed by hardware Hardware C program compiled to ISA program Software Hardware 2 Memory models Registers Data types Instructions #1: Memory Models Memory model: how does memory look to CPU? Issues 1. Addressable cell size 2. Alignment 3. Address spaces 4. Endianness 3 4

1. Addressable Cell Size Memory has cells, each of which has an address Most common cell size is (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 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, 8 Bytes 15 14 13 12 11 10 9 8 Address 24 16 8 0 15 14 13 12 8 Bytes 19 18 17 16 Address 24 16 8 0 Aligned 8-byte word at address 8 Nonaligned 8-byte word at address 12 5 6 Alignment (cont.) 3. Address Spaces 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 7 Princeton architecture or Von Neumann architecture (most used). A single linear address space for both instructions and data e.g. 2 32 bytes numbered from 0 to 2 32-1» (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: 2 12 16-bit words 8

Program Memory Program Flash Memory (1K bytes~128k bytes) 16 Bits AVR Address Spaces 0x0000 Data Memory 32 General purpose Working Registers 64 Input/Output Registers Internal SRAM (128~4K bytes) 0x0000 0x1F 0x20 0x5F 0x60 AVR Address Spaces (cont.) Data EEPROM Memory EEPROM Memory (64~4K bytes) 0x0000 External SRAM End Address End address End Address 9 10 4. 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) #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 11 12

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) 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 13 14 #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) Data types (cont.) Different machines support different data types in hardware e.g. Pentium II: Data Type Signed integer Unsigned integer BCD integer Floating point e.g. Atmel AVR: Data Type Signed integer Unsigned integer BCD integer Floating point 16 bits 16 bits 32 bits 32 bits 64 bits 64 bits 12 12 15 16

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 #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 17 18 Some AVR Instruction Examples ISA vs. Assembly Language 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 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): 1001010100000011 (machine code) inc r16 (assembly language, increment register 16) Assembly language also includes macros Example:.def temp = r16.include 8515def.inc 19 20

Memory models Registers Data types Instructions Summary: If you know all these details, you can Write machine code that runs on the CPU Build the CPU 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 21 22 CISC vs. RISC CISC vs. RISC (cont.) 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 80386 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 Originally (80s) CISC 200+ instructions RISC ~50 instructions Today Number of instructions irrelevant Many CISC processors use RISC techniques e.g. 80486 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 23 24

ISA vs. Microarchitecture Reading Material 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 1. Chap 2, Microcontrollers and Microcomputers. 25 26