ISA: The Hardware Software Interface

Similar documents
Reminder: tutorials start next week!

CS3350B Computer Architecture MIPS Instruction Representation

Computer Architecture

ECE 486/586. Computer Architecture. Lecture # 7

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

Introduction to the MIPS. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

Inf2C - Computer Systems Lectures 3-4 Assembly Language

Instruction Set Architecture (ISA)

TSK3000A - Generic Instructions

Lecture 4: Instruction Set Architecture

Instructions: MIPS ISA. Chapter 2 Instructions: Language of the Computer 1

Computer Architecture. MIPS Instruction Set Architecture

Chapter 2. Instructions: Language of the Computer. Adapted by Paulo Lopes

CSCI 402: Computer Architectures. Instructions: Language of the Computer (3) Fengguang Song Department of Computer & Information Science IUPUI.

Instructions: Language of the Computer

MIPS R-format Instructions. Representing Instructions. Hexadecimal. R-format Example. MIPS I-format Example. MIPS I-format Instructions

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization

MIPS ISA. 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support

Character Is a byte quantity (00~FF or 0~255) ASCII (American Standard Code for Information Interchange) Page 91, Fig. 2.21

Unsigned Binary Integers

Unsigned Binary Integers

Chapter 2A Instructions: Language of the Computer

Lecture 4: MIPS Instruction Set

Computer Architecture. The Language of the Machine

The MIPS Instruction Set Architecture

Anne Bracy CS 3410 Computer Science Cornell University. See P&H Chapter: , , Appendix B

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

Reduced Instruction Set Computer (RISC)

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

Mark Redekopp, All rights reserved. EE 357 Unit 11 MIPS ISA

Instruction Set Architecture of. MIPS Processor. MIPS Processor. MIPS Registers (continued) MIPS Registers

Topic Notes: MIPS Instruction Set Architecture

A Model RISC Processor. DLX Architecture

COMPUTER ORGANIZATION AND DESIGN

MIPS Assembly Language

Thomas Polzer Institut für Technische Informatik

Instructions: Language of the Computer

Reduced Instruction Set Computer (RISC)

Mark Redekopp, All rights reserved. EE 352 Unit 3 MIPS ISA

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Forecast. Instructions (354 Review) Basics. Basics. Instruction set architecture (ISA) is its vocabulary. Instructions are the words of a computer

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

Today s topics. MIPS operations and operands. MIPS arithmetic. CS/COE1541: Introduction to Computer Architecture. A Review of MIPS ISA.

A Processor. Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University. See: P&H Chapter , 4.1-3

EEM 486: Computer Architecture. Lecture 2. MIPS Instruction Set Architecture

Instruction Set Architecture. "Speaking with the computer"

Chapter 4. The Processor

Processor. Han Wang CS3410, Spring 2012 Computer Science Cornell University. See P&H Chapter , 4.1 4

Instruction Set Principles. (Appendix B)

ECE 154A Introduction to. Fall 2012

CENG3420 Lecture 03 Review

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

M2 Instruction Set Architecture

Lecture 2. Instructions: Language of the Computer (Chapter 2 of the textbook)

EE 109 Unit 13 MIPS Instruction Set. Instruction Set Architecture (ISA) Components of an ISA INSTRUCTION SET OVERVIEW

Design for a simplified DLX (SDLX) processor Rajat Moona

ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design

Lectures 3-4: MIPS instructions

Course Administration

Instruction Set Architectures

EC-801 Advanced Computer Architecture

Lecture 3: Instruction Set Architecture

Stored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands

2.7 Supporting Procedures in hardware. Why procedures or functions? Procedure calls

Anne Bracy CS 3410 Computer Science Cornell University. [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon]

Chapter 2. Instructions: Language of the Computer

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

MIPS ISA and MIPS Assembly. CS301 Prof. Szajda

EC 413 Computer Organization

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

Instruction encoding. MIPS Instruction encoding

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Concocting an Instruction Set

EN2910A: Advanced Computer Architecture Topic 02: Review of classical concepts

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

Chapter 4. The Processor Designing the datapath

Chapter 2. Computer Abstractions and Technology. Lesson 4: MIPS (cont )

The Processor: Datapath and Control. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

MACHINE LANGUAGE. To work with the machine, we need a translator.

ECE232: Hardware Organization and Design. Computer Organization - Previously covered

Computer Systems Laboratory Sungkyunkwan University

MIPS Instruction Set Architecture (2)

Overview. Introduction to the MIPS ISA. MIPS ISA Overview. Overview (2)

3. Instruction Set Architecture The MIPS architecture

CSEE 3827: Fundamentals of Computer Systems

Kernel Registers 0 1. Global Data Pointer. Stack Pointer. Frame Pointer. Return Address.

EE 109 Unit 8 MIPS Instruction Set

Processor (I) - datapath & control. Hwansoo Han

Chapter 2. lw $s1,100($s2) $s1 = Memory[$s2+100] sw $s1,100($s2) Memory[$s2+100] = $s1

Control Instructions. Computer Organization Architectures for Embedded Computing. Thursday, 26 September Summary

Control Instructions

MIPS Instruction Format

ECE468 Computer Organization & Architecture. MIPS Instruction Set Architecture

Review of instruction set architectures

Chapter 4. The Processor

CSE 533: Advanced Computer Architectures Instructor: Gürhan Küçük. Instructions. Instructions cont d. Forecast. Basics. Basics

EE108B Lecture 3. MIPS Assembly Language II

MIPS Memory Access Instructions

ECE/CS 552: Introduction To Computer Architecture 1. Instructor:Mikko H. Lipasti. University of Wisconsin-Madison. Basics Registers and ALU ops

Transcription:

ISA: The Hardware Software Interface Instruction Set Architecture (ISA) is where software meets hardware In embedded systems, this boundary is often flexible Understanding of ISA design is therefore important Instruction Set Definition Operands: int32, uint32, int16, uint16, int8, uint8, float32, float64 Operations: four major types Operator functions (add, shift, xor, mul, etc) Memory access (load-word, store-byte, etc) Control transfer (branch, jump, call, return, etc) Privileged, and miscellaneous instructions (not generated by compiler) Good understanding of compiler translation is essential Inf3 Computer Architecture - 2011-2012 1

ISA Design Considerations Simple target for compilers Support for OS and HLL features Support for important data types (floating-point, vectors) Code size Impact on execution efficiency (especially with pipelining) Backwards compatibility with legacy processors Provision for extensions Inf3 Computer Architecture - 2011-2012 2

CISC vs RISC CISC Assembly programming HLL features as instruction Small # registers, memory not that slow memory operands Code size must be small variable length Backward compatibility complexity increases RISC Compilers Simple instructions Large # registers, memory much slower than processor load store architecture Simple and fast decoding fixed length, fixed format Inf3 Computer Architecture - 2011-2012 3

Operators and their Instructions Integer Arithmetic + add - sub * mul / div % rem Relational < slt, sltu <= sle, sleu > sgt, sgtu >= sge, sgeu == seq!= sne C operator Comparison Reverse Branch == seq 0 bnez!= seq 0 beqz < slt, sltu 0 bnez >= slt, sltu 0 beqz > slt, sltu 1 bnez <= slt, sltu 1 beqz Inf3 Computer Architecture - 2011-2012 4

Operators continued Bit-wise logic Boolean Shifts or & and ^ xor ~ not (src1!= 0 or src2!= 0) && (src1!= 0 and src2!= 0) >> (signed) shift-right-arithmetic >> (unsigned) shift-right-logical << shift-left-logical Inf3 Computer Architecture - 2011-2012 5

Operand Types Usually based on scalar types in C Type modifier C type declarator Machine type unsigned int, long uint32 unsigned short uint16 unsigned char uint8 unsigned long long uint64 signed int int32 signed short int16 signed char int8 signed long long int64 boolean float double &<type_specifier> uint1 float32 float64 uint32 C defines integer promotion for expression evaluation int16 + int32 will be performed at 32-bit precision First operand must be sign-extended to 32 bits Similarly, uint8 + int16 will be performed at 16-bit precision First operand must be zero-extended to 16-bit precision Inf3 Computer Architecture - 2011-2012 6

Instruction Operands - Registers Registers How many registers operands should be specified? 3: R1 = R2 + R3 2: R1 = R1 + R2 1: +R1 32-bit RISC architectures normally specify 3 registers for dyadic operations and 2 registers for monadic operations Compact 16-bit embedded architectures normally specify respectively 2 and 1 register in these cases Introduces extra register copying E.g. load r1, [address] copy r2, r1 add r1, r3 sub r4, r2 # this is simply a re-use of r1, but the value of r1 had to be copied into r2 Accumulator architectures now dead, but accumulators still widely used in Digital Signal Processors (DSP). E.g. load [address1] add 23 store [address2] Inf3 Computer Architecture - 2011-2012 7

Instruction Operands - Literals Constant operands E.g. add r1, r2, 45 Jump or branch targets Relative: Normally used for if-then-else and loop constructs within a single function Distances normally short can be specified as 16-bit signed & scaled offset Permits position independent code (PIC) Absolute Normally used for function call and return But not all function addresses are compile-time constants, so jump to contents of register is also necessary Load/Store addresses Relative Absolute Inf3 Computer Architecture - 2011-2012 8

How big do literals have to be? Addresses Always 32 (or 64 bits) Arithmetic operands Small numbers, representable in 5 10 bits are common Literals are often used repeatedly at different locations Place as read-only data in the code and access relative to program counter register (e.g. MIPS16, ARM-thumb) Branch offsets 10 bits catches most branch distances 32-bit RISC architectures provide 16-bit literals 16-bit instructions must cope with 5 10 bits May extend literal using an instruction prefix E.g. Thumb bx instruction Inf3 Computer Architecture - 2011-2012 9

Decision Making and Branches Condition code based sub $1, $2 Sets Z, N, C, V flags Branch selects condition ble : N or Z (+) Sometimes condition set for free (-) Extra state Condition register based slte $1, $2, $3 bnez $1 (or beqz $1) (+) Simple and reduces number of opcodes (-) uses up register Compare and branch combt lte $1, $2 (+) One instruction for a branch (-) Too much work for an instruction Inf3 Computer Architecture - 2011-2012 10

Memory Access Operations Memory operations are governed by: Direction of movement (load or store) Size of data objects (word, half-word, byte) Extension semantics for load data (zero-ext, sign-ext) Memory access load store word half-word byte word half-word byte lw sw sh sb signed unsigned signed unsigned lh lhu lb lbu Inf3 Computer Architecture - 2011-2012 11

Addressing Mode Frequency Displacement 32 40 55 Addressing mode Immediate Register Scaled 0 3 6 11 17 16 24 39 43 gcc spice TeX Indirect 1 1 6 0 10 20 30 40 50 60 Frequency of the addressing mode (%) H&P Fig. 2.7 Bottom-line: few addressing modes account for most of the instructions in programs Inf3 Computer Architecture - 2011-2012 12

Displacement Addressing and Data Classification Stack pointer and Frame pointer relative 5 to 10 bits of offset is sufficient in most cases Register + offset Generic form for accessing via pointers Multi-dimensional arrays require address calculations PC relative addresses Useful for locating commonly-used constants in a pool of constants located in the.text section Inf3 Computer Architecture - 2011-2012 13

Encoding the Instruction Set How many bits per instruction? Fixed-length 32-bit RISC encoding Variable-length encoding (e.g. Intel x86) Compact 16-bit RISC encodings ARM Thumb MIPS16 Formats define instruction groups with a common set of operands Inf3 Computer Architecture - 2011-2012 14

MIPS 32-bit Instruction Formats R-type (register to register) three register operands most arithmetic, logical and shift instructions I-type (register with immediate) instructions which use two registers and a constant arithmetic/logical with immediate operand load and store branch instructions with relative branch distance J-type (jump) jump instructions with a 26 bit address Inf3 Computer Architecture - 2011-2012 15

MIPS R-type instruction format 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits opcode reg rs reg rt reg rd shamt funct add $1, $2, $3 special $2 $3 $1 add sll $4, $5, 16 special $5 $4 16 sll Inf3 Computer Architecture - 2011-2012 16

MIPS I-type instruction format 6 bits 5 bits 5 bits 16 bits opcode reg rs reg rt immediate value/addr lw $1, offset($2) lw $2 $1 address offset beq $4, $5,.L001 beq $4 $5 (PC -.L001) >> 2 addi $1, $2, -10 addi $2 $1 0xfff6 Inf3 Computer Architecture - 2011-2012 17

MIPS J-type instruction format 6 bits opcode 26 bits address call func call absolute func address >> 2 Inf3 Computer Architecture - 2011-2012 18

ISA Guidelines Regularity: operations, data types, addressing modes, and registers should be independent (orthogonal) Primitives, not solutions: do not attempt to match HLL constructs with special IS instructions Simplify tradeoffs: make it easy for compiler to make choices based on estimated performance Inf3 Computer Architecture - 2011-2012 19