Instruction Set Principles

Slides:



Advertisements
Similar presentations
Review of the MIPS Instruction Set Architecture. RISC Instruction Set Basics All operations on data apply to data in registers and typically change the.
Advertisements

1 Lecture 3: Instruction Set Architecture ISA types, register usage, memory addressing, endian and alignment, quantitative evaluation.
ELEN 468 Advanced Logic Design
Computer Organization and Architecture
Computer Organization and Architecture
Group 5 Alain J. Percial Paula A. Ortiz Francis X. Ruiz.
Some material taken from Assembly Language for x86 Processors by Kip Irvine © Pearson Education, 2010 Slides revised 2/2/2014 by Patrick Kelley.
Machine Instruction Characteristics
1 Copyright © 2011, Elsevier Inc. All rights Reserved. Appendix A Authors: John Hennessy & David Patterson.
Classifying GPR Machines TypeNumber of Operands Memory Operands Examples Register- Register 30 SPARC, MIPS, etc. Register- Memory 21 Intel 80x86, Motorola.
CSC 4250 Computer Architectures September 15, 2006 Appendix A. Pipelining.
Computer architecture Lecture 11: Reduced Instruction Set Computers Piotr Bilski.
Lecture 04: Instruction Set Principles Kai Bu
MIPS Architecture Topics –What resources MIPS assembly manipulates –CPU (Central Processing Unit) –ALU (Arithmetic & Logical Unit), Registers –Memory –I/O.
Computer Organization Instructions Language of The Computer (MIPS) 2.
MIPS Architecture Topics –What resources MIPS assembly manipulates –CPU (Central Processing Unit) –ALU (Arithmetic & Logical Unit), Registers –Memory –I/O.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Chapter 12 Processor Structure and Function. Central Processing Unit CPU architecture, Register organization, Instruction formats and addressing modes(Intel.
Computer Organization Exam Review CS345 David Monismith.
CS161 – Design and Architecture of Computer Systems
Electrical and Computer Engineering University of Cyprus
Immediate Addressing Mode
Control Unit Lecture 6.
William Stallings Computer Organization and Architecture 8th Edition
Chapter 4 The Von Neumann Model
ELEN 468 Advanced Logic Design
Chapter 4 The Von Neumann Model
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Morgan Kaufmann Publishers The Processor
Microcomputer Programming
William Stallings Computer Organization and Architecture 8th Edition
Introduction to Computer Engineering
Chapter 4 The Von Neumann Model
Computer Science 210 Computer Organization
\course\cpeg323-08F\Topic6b-323
Design of the Control Unit for Single-Cycle Instruction Execution
Chapter 5 The LC-3.
The LC-3 Instruction Set Architecture Data Movement instructions
Instructions - Type and Format
Basic Processing Unit Unit- 7 Engineered for Tomorrow CSE, MVJCE.
Computer Science 210 Computer Organization
CS170 Computer Organization and Architecture I
Design of the Control Unit for One-cycle Instruction Execution
The University of Adelaide, School of Computer Science
ECE232: Hardware Organization and Design
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Instruction Execution Cycle
Computer Instructions
Chapter 4 The Von Neumann Model
Branch instructions We’ll implement branch instructions for the eight different conditions shown here. Bits 11-9 of the opcode field will indicate the.
Computer Architecture
Introduction to Microprocessor Programming
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Control units In the last lecture, we introduced the basic structure of a control unit, and translated our assembly instructions into a binary representation.
ECE 352 Digital System Fundamentals
COMS 361 Computer Organization
The Stored Program Computer
Review: The whole processor
Lecture 06: Pipelining Implementation
CPU Structure CPU must:
Lecture 4: Instruction Set Design/Pipelining
Chapter 11 Processor Structure and function
CS501 Advanced Computer Architecture
Introduction to Computer Engineering
Introduction to Computer Engineering
Introduction to Computer Engineering
Introduction to Computer Engineering
Chapter 10 Instruction Sets: Characteristics and Functions
Chapter 4 The Von Neumann Model
Presentation transcript:

Instruction Set Principles Fixed-length vs variable-length instruction format Load-store instruction set or not Number of operands two operand instructions or three operand instructions or both? one operand instructions are generally a thing of the past number of registers? size of immediate datum? Memory issues what addressing modes? size of displacement? Types of instructions conditional instructions? Other condition codes testing status flags

Comparison of Instruction Lengths

Comparison of # of Operands

Addressing Modes Data will either be constants (immediate data) stored in registers stored in memory If memory, several ways to specify address direct indirect (pointers) register indirect (pointer moved to register) base displacement/indexed (address = base + displacement) usually one value is stored in a register, the other is specified as part of the instruction or stored in another register may use a scaling factor on the displacement

% Addressing Mode Use in 3 Benchmarks

Addressing Mode Design Issues How many bits should be allowed for an immediate datum How many bits should be allowed for a displacement? analysis of SPEC benchmarks indicate no more than 15 bits are typically needed for a displacement (displacements are < 32K) 8 bits for most immediate data Which modes? analysis of SPEC benchmarks indicates that immediate and base- displacement modes are most common with base displacement, we simulate direct by having a displacement of 0 with base displacement, we simulate register mode by having a base of 0

Branch Issues Usually PC-relative branching Type of branches PC  PC + offset this shortens instruction lengths as the instruction only has to specify the offset rather than a full memory address offsets can be positive (branching forward) or negative (branching backward) Type of branches conditional branches (test condition to decide whether to branch) unconditional branches branch and link (subroutine calls, returns) traps (branch and link to the OS) the last two categories require parameter passing using register windows eliminates the need for time-consuming memory accesses conditional branches make up 75-82% of all branches

Continued What is condition type in conditional branches? complex conditions can be time consuming condition codes is problematic with pipelines simple zero test (value == 0 or value != 0) is the fastest approach but requires additional instructions When is the comparison performed? with the branch instruction or prior to the branch?

Types of Instructions Integer arithmetic and logic operations * and / may be including as part of the FP arithmetic requiring conversion between int and FP values (and converting the result back to int) load immediate may also be considered integer as this loads an immediate datum into a register and so does not require memory access about 22% of all loads are load immediate operations FP arithmetic (+, -, *, /), also FP/int conversion Data transfer (loads, stores) may have several different types for different data types and different addressing modes Control (conditional/unconditional branches, calls/returns, traps) Other I/O strings operations (move, compare, search) OS operations (OS system calls, virtual memory, other) Graphics operations (pixel operations, compression/decompression, others)

RISC-V We will use the RISC-V instruction set in this class a descendant of the earliest RISC instruction sets like MIPS 4 types of instructions

A Closer Look at Load/Store Operations Format is operation destination, displacement(base) the base is a register storing the base of the address the displacement is a 12-bit signed int value gives us a range of -2048 to +2047 Three addressing modes available register indirect – use a displacement of 0 direct – use a base of 0 by specifying a special register that always stores 0 (x0) base-displacement – use both Other modes can be simulated with multiple instructions indirect – do two loads, first load the pointer and then load the datum indexed – add the index register to the base register, use sum as the register with a displacement of 0 scaled – store the index in a register, shift it, add it to the base, use a displacement of 0 autoincrement/decrement – add index register to base register, use a displacement of 0, increment/decrement the index register

RISC Architecture Addressing Modes NOTE: RV64G is RISC-V Letters are the data sizes permitted B = byte H = half word W = word D = double (long)

RISC-V Continued RISC-V registers Data sizes 32 integer registers: x0-x31, x0 is always 0 32 FP registers: f0-f31 all registers store 64 bits, if the datum is 32 bits, half the register is unused there is also a special purpose register used to store FP status information Data sizes 8-bit, 16-bit, 32-bit (word size), 64-bit (double word) when stored in registers, 8 and 16-bit values are sign extended to 32 bits

Benchmark Breakdown of Instructions

RISC-V 5-Stage Architecture From Appendix C section C.1

IF & ID Stages IF: PC sent to instruction cache PC incremented by 4, stored in NPC temporarily a MUX in the MEM stage determines if the PC should get the value in NPC or the value computed in EX Instruction stored in IR ID: Bits 15..19 denote one source register (I- type, R-type, S-type instructions) Bits 20..24 denote one source register (R- type, S-type) Bits 20..31 (I-type) or 12..31 (U-type) store immediate datum or displacement, sign extended to 32 bits note: for S-type, the immediate datum is split across bits 7-11 and 25-31 NPC, A, B and IMM are temporary registers used in later stages

EX Stage This stage executes ALU operations using register A & B or A& IMM, result from ALU placed in ALU output register and passed on to next stage computes effective addresses for loads and stores A + IMM, stored in ALU output and passed onto next stage computes branch target locations and performs the zero test to determine if a branch is taken or not A zero tested ALU adds PC + IMM, value sent to ALU output and passed to next stage

MEM and WB Stages MEM: WB: If load, ALU output stores address, sent to data cache, resulting datum stored in LMD If store, ALU output stores address and B register stores datum, both are sent to data cache If branch, based on condition, MUX either selects NPC or branch target location (as computed in the ALU EX) to send back to PC If ALU operation, forward result from ALU output directly to WB stage WB: If a datum in LMD (load from a load), store in the register file, if datum forwarded from ALU output from EX stage, store in the register file

Analysis CPI: PC is modified by either Loads, ALU – 5 (require WB stage) Stores, branches – 4 (do not require WB stage) PC is modified by either the value in the NPC (PC + 4) the value coming from the ALU output if the condition tested in EX is true B and IMM get a datum no matter what type the instruction the decision on which register to use (B/IMM) is made by the MUX in the EX stage Bits from the op code in the IR are sent to the various MUXes to decide which input to pass on as output A or NPC B or IMM NPC or PC+IMM (from ALU in EX stage) LMD or ALU output for register file MUX in register file (not shown in figure) selects appropriate register to use (for A/B or result)

Fallacies and Pitfalls P: Designing high-level instruction set features to support high-level language features (e.g., Intel’s loop instruction) – this will likely cost you more than its worth especially if you try to pipeline the instruction set F: There is no such thing as a typical program – programs vary dramatically in memory usage, I/O, integer computation, FP computation, use of branches, etc P: Innovating at the ISA to reduce code size without accounting for the compiler F: An architecture with flaws cannot be successful – they cite the x86