December 8, 2003Other ISA's1 Other ISAs Next, we discuss some alternative instruction set designs. – Different ways of specifying memory addresses – Different.

Slides:



Advertisements
Similar presentations
Instruction Set Design
Advertisements

INSTRUCTION SET ARCHITECTURES
Chapter 10- Instruction set architectures
There are two types of addressing schemes:
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson slides3.ppt Modification date: March 16, Addressing Modes The methods used in machine instructions.
Instruction Set Architecture
Chapter 11 Instruction Sets
1 Registers and MAL - Part I. Motivation So far there are some details that we have ignored instructions can have different formats most computers have.
Execution of an instruction
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Henry Hexmoor1 Chapter 10- Control units We introduced the basic structure of a control unit, and translated assembly instructions into a binary representation.
Chapters 4 & 5: LC-3 Computer Architecture Machine Instructions Assembly language Programming in Machine and Assembly Language.
Part II: Addressing Modes
Processor Organization and Architecture Module III.
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.
Dr. José M. Reyes Álamo 1.  The 80x86 memory addressing modes provide flexible access to memory, allowing you to easily access ◦ Variables ◦ Arrays ◦
Machine Instruction Characteristics
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
8.3 Stack Organization Stack: A storage device that stores information in such a manner that the item stored last is the first item retrieved. Also called.
Instruction Set Architecture
CSC 3210 Computer Organization and Programming Chapter 1 THE COMPUTER D.M. Rasanjalee Himali.
Chap. 9 Instruction Set Architecture. Computer Architecture Concepts Instruction format –Opcode field Specify the operation to be performed –Address field.
Chapter 5 A Closer Look at Instruction Set Architectures.
Chapter 5 A Closer Look at Instruction Set Architectures.
Chapter 5 The LC Instruction Set Architecture ISA = All of the programmer-visible components and operations of the computer memory organization.
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
The LC-3. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 5-2 Instruction Set Architecture ISA = All of the.
Execution of an instruction
COMPUTER ARCHITECURE INSTRUCTION SET ARCHITECTURE.
Chapter 5 The LC Instruction Set Architecture ISA = All of the programmer-visible components and operations of the computer memory organization.
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson Slides4-2.ppt Modification date: March 23, Procedures Essential ingredient of high level.
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.
Addressing Modes and Formats
What is a program? A sequence of steps
Ass. Prof. Dr Masri Ayob TK 2123 Lecture 14: Instruction Set Architecture Level (Level 2)
Control units In the last lecture, we introduced the basic structure of a control unit, and translated our assembly instructions into a binary representation.
F453 Module 8: Low Level Languages 8.1: Use of Computer Architecture.
Computer Architecture
Displacement (Indexed) Stack
Architecture Review Instruction Set Architecture
A Closer Look at Instruction Set Architectures
A Closer Look at Instruction Set Architectures: Expanding Opcodes
Computer Organization and Design
Chapter 5 The LC-3.
Instruction set architectures
Today: Control Unit: A bit of review
Instruction set architectures
The all-important ALU The main job of a central processing unit is to “process,” or to perform computations....remember the ALU from way back when? We’ll.
Datapaths For the rest of the semester, we’ll focus on computer architecture: how to assemble the combinational and sequential components we’ve studied.
Chapter 8 Central Processing Unit
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Two questions Four registers isn’t a lot. What if we need more storage? Who exactly decides which registers are read and written and which ALU function.
Instruction set architectures
Other ISAs Next, we’ll first we look at a longer example program, starting with some C code and translating it into our assembly language. Then we discuss.
Data manipulation instructions
Other ISAs Next, we’ll first we look at a longer example program, starting with some C code and translating it into our assembly language. Then we discuss.
Branch instructions We’ll implement branch instructions for the eight different conditions shown here. Bits 11-9 of the opcode field will indicate the.
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
Addressing mode summary
Instruct Set Architecture Variations
Today: a look to the future
Review: The whole processor
Computer Organization
Presentation transcript:

December 8, 2003Other ISA's1 Other ISAs Next, we discuss some alternative instruction set designs. – Different ways of specifying memory addresses – Different numbers and types of operands in ALU instructions

December 8, 2003Other ISA's2 Addressing modes The first instruction set design issue we’ll see are addressing modes, which let you specify memory addresses in various ways. – Each mode has its own assembly language notation. – Different modes may be useful in different situations. – The location that is actually used is called the effective address. The addressing modes that are available will depend on the datapath. – Our simple datapath only supports two forms of addressing. – Older processors like the 8086 have zillions of addressing modes. We’ll introduce some of the more common ones.

December 8, 2003Other ISA's3 Immediate addressing One of the simplest modes is immediate addressing, where the operand itself is accessed. LD R1, #1999R1  1999 This mode is a good way to specify initial values for registers. We’ve already used immediate addressing several times. – It appears in the string conversion program you just saw.

December 8, 2003Other ISA's4 Direct addressing Another possible mode is direct addressing, where the operand is a constant that represents a memory address. LD R1, 500R1  M[500] Here the effective address is 500, the same as the operand. This is useful for working with pointers. – You can think of the constant as a pointer. – The register gets loaded with the data at that address.

December 8, 2003Other ISA's5 Register indirect addressing We already saw register indirect mode, where the operand is a register that contains a memory address. LD R1, (R0)R1  M[R0] The effective address would be the value in R0. This is also useful for working with pointers. In the example above, – R0 is a pointer, and R1 is loaded with the data at that address. – This is similar to R1 = *R0 in C or C++. So what’s the difference between direct mode and this one? – In direct mode, the address is a constant that is hard-coded into the program and cannot be changed. – Here the contents of R0, and hence the address being accessed, can easily be changed.

December 8, 2003Other ISA's6 Register indirect mode makes it easy to access contiguous locations in memory, such as elements of an array. If R0 is the address of the first element in an array, we can easily access the second element too: LD R1, (R0)// R1 contains the first element ADD R0, R0, #1 LD R2, (R0)// R2 contains the second element This is so common that some instruction sets can automatically increment the register for you: LD R1, (R0)+// R1 contains the first element LD R2, (R0)+// R2 contains the second element Such instructions can be used within loops to access an entire array. Stepping through arrays

December 8, 2003Other ISA's7 Indexed addressing Operands with indexed addressing include a constant and a register. LD R1, 500(R0)R1  M[R ] The effective address is the register data plus the constant. For instance, if R0 = 25, the effective address here would be 525. We can use this addressing mode to access arrays also. – The constant is the array address, while the register contains an index into the array. – The example instruction above might be used to load the 25th element of an array that starts at memory location 500. It’s possible to use negative constants too, which would let you index arrays backwards.

December 8, 2003Other ISA's8 PC-relative addressing We’ve seen PC-relative addressing already. The operand is a constant that is added to the program counter to produce the effective memory address. 200: LD R1, $30R1  M[ ] The PC usually points to the address of the next instruction, so the effective address here is 231 (assuming the LD instruction itself uses one word of memory). This is similar to indexed addressing, except the PC is used instead of a regular register. Relative addressing is often used in jump and branch instructions. – For instance, JMP $30 lets you skip the next 30 instructions. – A negative constant lets you jump backwards, which is common in writing loops.

December 8, 2003Other ISA's9 Indirect addressing The most complicated mode that we’ll look at is indirect addressing. LD R1, [360]R1  M[M[360]] The operand is a constant that specifies a memory location which refers to another location, whose contents are then accessed. The effective address here is M[360]. Indirect addressing is useful for working with multi-level pointers, or “handles.” – The constant represents a pointer to a pointer. – In C, we might write something like R1 = **ptr.

December 8, 2003Other ISA's10 Addressing mode summary

December 8, 2003Other ISA's11 Number of operands Another way to classify instruction sets is according to the number of operands that each data manipulation instruction can have. Our example instruction set had three-address instructions, because each one had up to three operands—two sources and one destination. This provides the most flexibility, but it’s also possible to have fewer than three operands. ADD R0, R1, R2 operation destinationsources operands R0  R1 + R2 Register transfer instruction:

December 8, 2003Other ISA's12 Two-address instructions In a two-address instruction, the first operand serves as both the destination and one of the source registers. Some other examples and the corresponding C code: ADD R3, #1R3  R3 + 1R3++; MUL R1, #5R1  R1 * 5R1 *= 5; NOT R1R1  R1’R1 = ~R1; ADD R0, R1 operation destination and source 1 source 2 operands R0  R0 + R1 Register transfer instruction:

December 8, 2003Other ISA's13 Some computers, like this old Apple II, have one-address instructions. The CPU has a special register called an accumulator, which implicitly serves as the destination and one of the sources. Here is an example sequence which increments M[R0]: LD (R0)ACC  M[R0] ADD #1ACC  ACC + 1 ST (R0)M[R0]  ACC One-address instructions ADD R0 operationsource ACC  ACC + R0 Register transfer instruction:

December 8, 2003Other ISA's14 The ultimate: zero addresses If the destination and sources are all implicit, then you don’t have to specify any operands at all! This is possible with processors that use a stack architecture. – HP calculators and their “reverse Polish notation” use a stack. – The Java Virtual Machine is also stack-based. How can you do calculations with a stack? – Operands are pushed onto a stack. The most recently pushed element is at the “top” of the stack (TOS). – Operations use the topmost stack elements as their operands. Those values are then replaced with the operation’s result.

December 8, 2003Other ISA's15 Stack architecture example From left to right, here are three stack instructions, and what the stack looks like after each example instruction is executed. This sequence of stack operations corresponds to one register transfer instruction: TOS  R1 + R2 (Top) (Bottom) PUSH R1PUSH R2ADD

December 8, 2003Other ISA's16 Data movement instructions Finally, the types of operands allowed in data manipulation instructions is another way of characterizing instruction sets. – So far, we’ve assumed that ALU operations can have only register and constant operands. – Many real instruction sets allow memory-based operands as well. We’ll use the book’s example and illustrate how the following operation can be translated into some different assembly languages. X = (A + B)(C + D) Assume that A, B, C, D and X are really memory addresses.

December 8, 2003Other ISA's17 Register-to-register architectures Our programs so far assume a register-to-register, or load/store, architecture, which matches our datapath from last week nicely. – Operands in data manipulation instructions must be registers. – Other instructions are needed to move data between memory and the register file. With a register-to-register, three-address instruction set, we might translate X = (A + B)(C + D) into: LD R1, AR1  M[A]// Use direct addressing LD R2, BR2  M[B] ADD R3, R1, R2R3  R1 + R2// R3 = M[A] + M[B] LD R1, CR1  M[C] LD R2, DR2  M[D] ADD R1, R1, R2R1  R1 + R2// R1 = M[C] + M[D] MUL R1, R1, R3R1  R1 * R3// R1 has the result ST X, R1M[X]  R1// Store that into M[X]

December 8, 2003Other ISA's18 Memory-to-memory architectures In memory-to-memory architectures, all data manipulation instructions use memory addresses as operands. With a memory-to-memory, three-address instruction set, we might translate X = (A + B)(C + D) into simply: How about with a two-address instruction set? ADD X, A, BM[X]  M[A] + M[B] ADD T, C, DM[T]  M[C] + M[D]// T is temporary storage MUL X, X, TM[X]  M[X] * M[T] MOVE X, AM[X]  M[A]// Copy M[A] to M[X] first ADD X, BM[X]  M[X] + M[B]// Add M[B] MOVE T, CM[T]  M[C]// Copy M[C] to M[T] ADD T, DM[T]  M[T] + M[D]// Add M[D] MUL X, TM[X]  M[X] * M[T]// Multiply

December 8, 2003Other ISA's19 Register-to-memory architectures Finally, register-to-memory architectures let the data manipulation instructions access both registers and memory. With two-address instructions, we might do the following: LD R1, AR1  M[A]// Load M[A] into R1 first ADD R1, BR1  R1 + M[B]// Add M[B] LD R2, CR2  M[C]// Load M[C] into R2 ADD R2, DR2  R2 + M[D]// Add M[D] MUL R1, R2R1  R1 * R2// Multiply ST X, R1M[X]  R1// Store

December 8, 2003Other ISA's20 Size and speed There are lots of tradeoffs in deciding how many and what kind of operands and addressing modes to support in a processor. These decisions can affect the size of machine language programs. – Memory addresses are long compared to register file addresses, so instructions with memory-based operands are typically longer than those with register operands. – Permitting more operands also leads to longer instructions. There is also an impact on the speed of the program. – Memory accesses are much slower than register accesses. – Longer programs require more memory accesses, just for loading the instructions! Most newer processors use register-to-register designs. – Reading from registers is faster than reading from RAM. – Using register operands also leads to shorter instructions.

December 8, 2003Other ISA's21 Summary Instruction sets can be classified along several lines. – Addressing modes let instructions access memory in various ways. – Data manipulation instructions can have from 0 to 3 operands. – Those operands may be registers, memory addresses, or both. Instruction set design is intimately tied to processor datapath design. “The Godfather” is a 14-character C string.