A Closer Look at Instruction Set Architectures

Slides:



Advertisements
Similar presentations
Instruction Set Design
Advertisements

Chapter 3 Instruction Set Architecture Advanced Computer Architecture COE 501.
CPU Review and Programming Models CT101 – Computing Systems.
ISA Issues; Performance Considerations. Testing / System Verilog: ECE385.
1 Lecture 3: Instruction Set Architecture ISA types, register usage, memory addressing, endian and alignment, quantitative evaluation.
RISC / CISC Architecture By: Ramtin Raji Kermani Ramtin Raji Kermani Rayan Arasteh Rayan Arasteh An Introduction to Professor: Mr. Khayami Mr. Khayami.
INSTRUCTION SET ARCHITECTURES
Implementation of a Stored Program Computer
A Closer Look at Instruction Set Architectures
Chapter 5: ISAs In MARIE, we had simple instructions –4 bit op code followed by either 12 bit address for load, store, add, subt, jump 2 bit condition.
Operand Addressing and Instruction Representation
Lecture 18 Last Lecture Today’s Topic Instruction formats
Lecture 17 Today’s Lecture –Instruction formats Little versus big endian Internal storage in the CPU: stacks vs. registers Number of operands and instruction.
Instruction Set Architecture
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CS-334: Computer.
Implementation of a Stored Program Computer ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides2.ppt Modification date: Oct 16,
Chapter 5 A Closer Look at Instruction Set Architectures.
Chapter 5 A Closer Look at Instruction Set Architectures.
Instruction Set Architecture Basics. Our Progress Done with levels 0 and 1 Seen multiple examples of level 2 Ready for ISA general principles.
Chapter 5 A Closer Look at Instruction Set Architectures.
Chapter 5 A Closer Look at Instruction Set Architectures.
Instruction Set Architecture Formats Speaker: Duc Nguyen Prof. Sin-Min Lee, CS 147, Fall 2009.
Computer Architecture EKT 422
COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE Lecture 19 & 20 Instruction Formats PDP-8,PDP-10,PDP-11 & VAX Course Instructor: Engr. Aisha Danish.
Operand Addressing And Instruction Representation Cs355-Chapter 6.
Chapter 11 Instruction Sets: Addressing Modes and Formats Gabriel Baron Sydney Chow.
Chapter 5 A Closer Look at Instruction Set Architectures.
Computer Organization 1 Instruction Fetch and Execute.
Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown.
Instruction Sets: Addressing modes and Formats Group #4  Eloy Reyes  Rafael Arevalo  Julio Hernandez  Humood Aljassar Computer Design EEL 4709c Prof:
Lecture 5 A Closer Look at Instruction Set Architectures Lecture Duration: 2 Hours.
The Instruction Set Architecture. Hardware – Software boundary Java Program C Program Ada Program Compiler Instruction Set Architecture Microcode Hardware.
What is a program? A sequence of steps
Chapter 5 A Closer Look at Instruction Set Architectures.
RISC / CISC Architecture by Derek Ng. Overview CISC Architecture RISC Architecture  Pipelining RISC vs CISC.
Instruction Set Architectures. Our Progress Done with levels 0 and 1 Seen multiple examples of level 2 Ready for ISA general principles.
Chapter 5 A Closer Look at Instruction Set Architectures.
Computer Architecture & Operations I
Computer Architecture & Operations I
Displacement (Indexed) Stack
A Closer Look at Instruction Set Architectures
Immediate Addressing Mode
A Closer Look at Instruction Set Architectures
A Closer Look at Instruction Set Architectures
Alvaro Mauricio Peña Dariusz Niworowski Frank Rodriguez
Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 4 – The Instruction Set Architecture.
A Closer Look at Instruction Set Architectures: Expanding Opcodes
William Stallings Computer Organization and Architecture 8th Edition
Computer Organization and Assembly Language (COAL)
A Discussion on Assemblers
Instruction Set Architectures
Central Processing Unit
Computer Organization and ASSEMBLY LANGUAGE
CSCI206 - Computer Organization & Programming
A Discussion on Assemblers
Installing and Using MARIE
The University of Adelaide, School of Computer Science
ECEG-3202 Computer Architecture and Organization
Computer Architecture and the Fetch-Execute Cycle
ECEG-3202 Computer Architecture and Organization
Chapter 9 Instruction Sets: Characteristics and Functions
Computer Architecture
Classification of instructions
A Closer Look at Instruction Set Architectures Chapter 5
ECEG-3202 Computer Architecture and Organization
Introduction to Microprocessor Programming
Addressing mode summary
CPU Structure CPU must:
Lecture 4: Instruction Set Design/Pipelining
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

A Closer Look at Instruction Set Architectures

Lecture Overview Introduction Instruction formats Design Decisions for Instruction Sets Little VS Big Endian Internal Storage in the CPU Number of operands and Instruction Length

Introduction Introduction (1/1) We look at different instruction formats, operand types, and memory access methods. We will see the interrelation between machine organization and instruction formats. This leads to a deeper understanding of computer architecture and organization in general.

Instruction formats – Introduction (1/2) In Chapter (MARIE) we saw that MARIE have an instruction length of 16 bits and could have, at most, 1 operand In another architecture, those could be different So, computer architectures generally differs by their Instructions Set format. An Instruction Set can be described by its features.

Instruction formats – Introduction (2/2) The Instruction set’s features are: Number of bits per instruction: 12, 32 and 64 are the most common Type of the CPU elementary memory: Stack-based or register-based (this will affect the instruction format) Number of operands per instruction: Zero, one, two, and three being the most common. Operand location: register-to-register, register to- memory or memory-to-memory instructions. Types of operations: not only types of operations but also which instructions can access memory and which cannot. Type and size of operands: operands can be addresses, numbers, or even characters.

Design Decisions for Instruction Sets (1/4) Instruction formats Design Decisions for Instruction Sets (1/4) During the design phase of a computer architecture, the Instruction set must be optimized. The instruction set must match the architecture. It must also maximize the efficiency of the computer architecture. The first thing to define during the design phase is the instruction set format. To understand how this choice is made, we should know first, how we measure the efficiency of an ISA.

Design Decisions for Instruction Sets (2/4) Instruction formats Design Decisions for Instruction Sets (2/4) Instruction set architectures are measured according to: Main memory space occupied by a program. Instruction complexity: amount of decoding necessary to execute an instruction (number of clock cycles per instruction) Instruction length (in bits). Total number of instructions in the instruction set.

Design Decisions for Instruction Sets (3/4) Instruction formats Design Decisions for Instruction Sets (3/4) So, things to consider when designing an instruction set include: Instruction length Short Vs long instructions: shorter instructions take up less space in memory  shorter instructions can be fetched quickly  shorter instructions limit the number of instructions  shorter instructions limit the number of operands  Variable length VS fixed length instructions: Fixed length instructions are easier to decode  but Fixed length instructions waste space 

Design Decisions for Instruction Sets (4/4) Instruction formats Design Decisions for Instruction Sets (4/4) Things to consider when designing an instruction set include: Number of operands Fixed number : Zero, one, two, and three being the most common Variable number of operands (even if we have a fixed length instructions): Expanding opcode (to be explained in this lecture!) Addressable registers How many? (number of registers) How are they stored in the CPU? Memory organization Word addressable or byte addressable? A byte addressable architecture uses little or big endian concept? (to be explained in this lecture!) Addressing modes Direct, indirect, immediate, indexed, etc. (to be explained in this lecture!)

Lecture Overview Introduction Instruction formats Design Decisions for Instruction Sets Little VS Big Endian Internal Storage in the CPU Number of operands and Instruction Length

Little VS Big Endian (1/5) Instruction formats Little VS Big Endian (1/5) If we have a 32 bit data word, how we store this word in a byte addressable memory? The Least significant byte first? Of the most significant byte first? Byte ordering, or endianness, is a major architectural consideration We distinguish two concepts for byte ordering: Little Endian: A byte with a lower significance is stored in a lower address Big Endian: A byte with a higher significance is stored in a lower address

Little VS Big Endian (2/5) Instruction formats Little VS Big Endian (2/5) Example 1: consider an integer requiring 4 bytes: On a little endian machine, this is arranged in memory as follows: Base Address + 0 → Byte0 Base Address + 1 → Byte1 Base Address + 2 → Byte2 Base Address + 3 → Byte3 Byte 3 Byte 2 Byte 1 Byte 0

Little VS Big Endian (3/5) Instruction formats Little VS Big Endian (3/5) Example 2: consider an integer requiring 4 bytes: On a big endian machine, this long integer would then be stored as: Base Address + 0 → Byte3 Base Address + 1 → Byte2 Base Address + 2 → Byte1 Base Address + 3 → Byte0 Byte 3 Byte 2 Byte 1 Byte 0

Little VS Big Endian (4/5) Instruction formats Little VS Big Endian (4/5) Example 3: On a byte-addressable machine, the 32-bit (8 numbers*4 each hex. Decimal number in binary) hex value 12345678 is stored at address 0. How is this value stored in memory if the machine uses a Big Endian concept? A little Endian concept? Answer: Here in memory the data is stored in HEX. Based, means the following: 1 and 2 for example will 0001 and 0010, here the some of number -8. when calculate 8* 4 (locations)=32 bit

Little VS Big Endian (5/5) Instruction formats Little VS Big Endian (5/5) Advantages of Big Endian: Is more natural: The most significant byte comes first (lower address). The sign of the number can be determined by looking at the byte at address offset 0. Strings and integers are stored in the same order. Advantages of Little Endian: Makes it easier to place values on non-word boundaries. High-precision arithmetic is fast and easy.

Lecture Overview Introduction Instruction formats Design Decisions for Instruction Sets Little VS Big Endian Internal Storage in the CPU Number of operands and Instruction Length

Internal Storage in the CPU: Stacks VS Registers (1/5) Instruction formats Internal Storage in the CPU: Stacks VS Registers (1/5) Another consideration for architecture design concerns how the CPU will store data. We have three choices: A stack architecture. An accumulator architecture. A general purpose register architecture. Designers choosing an ISA must decide which will work best in a particular environment and examine the tradeoffs carefully

Internal Storage in the CPU: Stacks VS Registers (2/5) Instruction formats Internal Storage in the CPU: Stacks VS Registers (2/5) Stack Architecture A stack is used to execute instructions Instructions and operands are implicitly taken from the stack Advantages Good code density Simple model for evaluation of expressions Disadvantages A stack cannot be accessed randomly Difficult to generate efficient code

Internal Storage in the CPU: Stacks VS Registers (3/5) Instruction formats Internal Storage in the CPU: Stacks VS Registers (3/5) Accumulator architectures One operand of a binary operation is implicitly in the accumulator Example: MARIE Advantages Reduce the internal complexity of the machine Allow very short instructions Disadvantages Memory traffic is very high (since one operand is in memory)

Internal Storage in the CPU: Stacks VS Registers (4/5) Instruction formats Internal Storage in the CPU: Stacks VS Registers (4/5) General purpose register architectures (GPR) General purpose registers can be used instead of memory Advantages Registers are faster than memory Easy for compilers to deal with Can be used very effectively and efficiently Disadvantages Long Instructions, long fetch and decode times

Internal Storage in the CPU: Stacks VS Registers (5/5) Instruction formats Internal Storage in the CPU: Stacks VS Registers (5/5) General purpose register architectures (GPR) GPR are the most widely accepted models for machine architectures today There are three types of GPR Memory-memory architectures: may have two or three operands in memory, allowing an instruction to perform an operation without requiring any operand to be in a register. Register-memory architectures: require a mix, where at least one operand is in a register and one is in memory. Load-store architectures: require data to be moved into registers before any operations on that data are performed.

Lecture Overview Introduction Instruction formats Design Decisions for Instruction Sets Little VS Big Endian Internal Storage in the CPU Number of operands and Instruction Length

Number of operands and Instruction Length (1/6) Instruction formats Number of operands and Instruction Length (1/6) On current architectures, instructions can be formatted in two ways: Fixed length: Wastes space but is relatively fast. Variable length: Complex to decode but saves storage space. In this course, we will be interested in Fixed length instructions. In such instructions, we define the maximum number of operands (this number has a direct impact on the length of the instruction itself)

Number of operands and Instruction Length (2/6) Instruction formats Number of operands and Instruction Length (2/6) Example: MARIE uses a fixed-length instruction with a 4-bit opcode and 12-bit operand. In MARIE the maximum number of operands is one. Though, some instructions for MARIE have no operand (for instance: halt).

Number of operands and Instruction Length (3/6) Instruction formats Number of operands and Instruction Length (3/6) The most common instruction formats include zero, one, two, or three operands: Zero operand OPCODE only One operand (usually a memory address) OPCODE + 1 Address Two operands (usually registers, or one register and one memory address) OPCODE + 2 Addresses Three operands (usually registers, or combinations of registers and memory) OPCODE + 3 Addresses

Number of operands and Instruction Length (4/6) Instruction formats Number of operands and Instruction Length (4/6) Machine instructions that have no operands must use a stack In architectures based on stacks, most instructions consist of opcodes only; however, there are special instructions that have just one operand: Push X places the data value found at memory location X onto the stack Pop X removes the top element in the stack and stores it at location X

Number of operands and Instruction Length (5/6) Instruction formats Number of operands and Instruction Length (5/6) Example: Suppose we wish to evaluate the following expression: Z = (X x Y) + (W x U) The assembly code would be: For a Three operand ISA For a Two operand ISA For a one operand ISA (such as MARIE!) Mult R1, X, Y Mult R2, W, U Add Z, R2, R1 Load R1, X Mult R1, Y Load R2, W Mult R2, U Add R1, R2 Store Z, R1 Load X Mult Y Store Temp Load W Mult U Add Temp Store Z

Number of operands and Instruction Length (6/6) Instruction formats Number of operands and Instruction Length (6/6) Example: Suppose we wish to evaluate the following expression: Z = (X x Y) + (W x U) In a stack architecture the assembly code would be : Stack Stack Push Y Y X X For a zero operand ISA Push X Push Y Mult Push W Push U Add Store Z Mult Stack X x Y Stack X x Y + W x U Push W; Push U Stack Add Stack U W W x U W x U X x Y Mult