Addressing mode summary

Slides:



Advertisements
Similar presentations
More Intel machine language and one more look at other architectures.
Advertisements

Instruction Set Design
CPU Review and Programming Models CT101 – Computing Systems.
ISA Issues; Performance Considerations. Testing / System Verilog: ECE385.
Chapter 10- Instruction set architectures
There are two types of addressing schemes:
CSC 3210 Computer Organization and Programming Introduction and Overview Dr. Anu Bourgeois.
Instruction Set Architecture & Design
Lecture 17 Today’s Lecture –Instruction formats Little versus big endian Internal storage in the CPU: stacks vs. registers Number of operands and instruction.
4-1 Chapter 4 - The Instruction Set Architecture Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring.
Instruction Set Architecture
Machine Instruction Characteristics
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.
ITEC 352 Lecture 20 JVM Intro. Functions + Assembly Review Questions? Project due today Activation record –How is it used?
December 8, 2003Other ISA's1 Other ISAs Next, we discuss some alternative instruction set designs. – Different ways of specifying memory addresses – Different.
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 4 The Von Neumann Model
Chapter 5 A Closer Look at Instruction Set Architectures.
Chapter 5 A Closer Look at Instruction Set Architectures.
M. Mateen Yaqoob The University of Lahore Spring 2014.
Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown.
Processor Structure and Function Chapter8:. CPU Structure  CPU must:  Fetch instructions –Read instruction from memory  Interpret instructions –Instruction.
Lecture 5 A Closer Look at Instruction Set Architectures Lecture Duration: 2 Hours.
What is a program? A sequence of steps
Control units In the last lecture, we introduced the basic structure of a control unit, and translated our assembly instructions into a binary representation.
Instruction Sets: Characteristics and Functions  Software and Hardware interface Machine Instruction Characteristics Types of Operands Types of Operations.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Logic and Computer Design Fundamentals
A Closer Look at Instruction Set Architectures
Overview of Instruction Set Architectures
A Closer Look at Instruction Set Architectures
Chapter 4 The Von Neumann Model
Architecture Review Instruction Set Architecture
Chapter 4 The Von Neumann Model
A Closer Look at Instruction Set Architectures
Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 4 – The Instruction Set Architecture.
A Closer Look at Instruction Set Architectures: Expanding Opcodes
Computer Organization and Design
Instructions at the Lowest Level
Design of the Control Unit for Single-Cycle Instruction Execution
Today: Control Unit: A bit of review
Instruction set architectures
Datapaths For the rest of the semester, we’ll focus on computer architecture: how to assemble the combinational and sequential components we’ve studied.
CENTRAL PROCESSING UNIT
Chapter 8 Central Processing Unit
Processor Organization and Architecture
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
CENTRAL PROCESSING UNIT
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.
ECEG-3202 Computer Architecture and Organization
Unit 12 CPU Design & Programming
Instruction set architectures
Classification of instructions
A Closer Look at Instruction Set Architectures Chapter 5
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.
ECEG-3202 Computer Architecture and Organization
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
The Stored Program Computer
Instruct Set Architecture Variations
Today: a look to the future
Review: The whole processor
CPU Structure and Function
Chapter 10 Instruction Sets: Characteristics and Functions
Chapter 4 The Von Neumann Model
Presentation transcript:

Addressing mode summary 4/5/2019 Instruction encoding

Issues in design of ISAs Characterization of application programs What are typical programs like What mix of instructions (ALU, Branch, ..) Size of instruction word Length of program Number of instructions Number of bytes Number of instructions needed to code the same program may be different depending on the ISA Clock period Needs to be long enough to do one cycle of instruction Single cycle instruction or multi-cycle instruction Multi-cycle instructions: (we are skipping this) Hardwired control vs micro-programmed control Pipelined instructions 4/5/2019 Instruction encoding

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 destination sources operands R0  R1 + R2 Register transfer instruction: 4/5/2019 Instruction encoding

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, #1 R3  R3 + 1 R3++; MUL R1, #5 R1  R1 * 5 R1 *= 5; NOT R1 R1  R1’ R1 = ~R1; ADD R0, R1 operation destination and source 1 source 2 operands R0  R0 + R1 Register transfer instruction: 4/5/2019 Instruction encoding

One-address instructions 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 #1 ACC  ACC + 1 ST (R0) M[R0]  ACC ADD R0 operation source ACC  ACC + R0 Register transfer instruction: 4/5/2019 Instruction encoding

The ultimate: zero addresses If the destination and sources are all implicit, then you don’t have to specify any operands at all! For the ALU instructions 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. 4/5/2019 Instruction encoding

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 PUSH R1 PUSH R2 ADD (Top) (Bottom) 4/5/2019 Instruction encoding

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. 4/5/2019 Instruction encoding

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, A R1  M[A] // Use direct addressing LD R2, B R2  M[B] ADD R3, R1, R2 R3  R1 + R2 // R3 = M[A] + M[B] LD R1, C R1  M[C] LD R2, D R2  M[D] ADD R1, R1, R2 R1  R1 + R2 // R1 = M[C] + M[D] MUL R1, R1, R3 R1  R1 * R3 // R1 has the result ST X, R1 M[X]  R1 // Store that into M[X] 4/5/2019 Instruction encoding

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, B M[X]  M[A] + M[B] ADD T, C, D M[T]  M[C] + M[D] // T is temporary storage MUL X, X, T M[X]  M[X] * M[T] MOVE X, A M[X]  M[A] // Copy M[A] to M[X] first ADD X, B M[X]  M[X] + M[B] // Add M[B] MOVE T, C M[T]  M[C] // Copy M[C] to M[T] ADD T, D M[T]  M[T] + M[D] // Add M[D] MUL X, T M[X]  M[X] * M[T] // Multiply 4/5/2019 Instruction encoding

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, A R1  M[A] // Load M[A] into R1 first ADD R1, B R1  R1 + M[B] // Add M[B] LD R2, C R2  M[C] // Load M[C] into R2 ADD R2, D R2  R2 + M[D] // Add M[D] MUL R1, R2 R1  R1 * R2 // Multiply ST X, R1 M[X]  R1 // Store 4/5/2019 Instruction encoding

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. 4/5/2019 Instruction encoding

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. 4/5/2019 Instruction encoding