Computer Architecture and the Fetch-Execute Cycle

Slides:



Advertisements
Similar presentations
The Fetch – Execute Cycle
Advertisements

Computer Architecture and the Fetch-Execute Cycle
Instruction Set Design
Topics covered: CPU Architecture CSE 243: Introduction to Computer Architecture and Hardware/Software Interface.
ARITHMETIC LOGIC SHIFT UNIT
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson slides3.ppt Modification date: March 16, Addressing Modes The methods used in machine instructions.
Computer Organization and Architecture
Execution of an instruction
Stored Program Concept: The Hardware View
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
Overview von Neumann Model Components of a Computer Some Computer Organization Models The Computer Bus An Example Organization: The LC-3.
Lecture 18 Last Lecture Today’s Topic Instruction formats
Computer Science 210 Computer Organization The Instruction Execution Cycle.
Computer Architecture and the Fetch-Execute Cycle
Computer Architecture and the Fetch-Execute Cycle
Computer Architecture and the Fetch-Execute Cycle
Fetch-execute cycle.
Computer Architecture Lecture 03 Fasih ur Rehman.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
ECEG-3202 Computer Architecture and Organization Chapter 6 Instruction Sets: Addressing Modes and Formats.
Instruction Sets: Addressing modes and Formats Group #4  Eloy Reyes  Rafael Arevalo  Julio Hernandez  Humood Aljassar Computer Design EEL 4709c Prof:
Processor Structure and Function Chapter8:. CPU Structure  CPU must:  Fetch instructions –Read instruction from memory  Interpret instructions –Instruction.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Lec 4-2 Five operations of the machine cycle Fetch- fetch the next program instruction from memory. (PC+1); instruction to IR Decode- decode the instruction.
F453 Module 8: Low Level Languages 8.1: Use of Computer Architecture.
Computer Architecture
Instruction Set Architectures Continued. Expanding Opcodes & Instructions.
EEL 4709C Prof. Watson Herman Group 4 Ali Alshamma, Derek Montgomery, David Ortiz 11/11/2008.
1 Processor design Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section 11.3.
Displacement (Indexed) Stack
William Stallings Computer Organization and Architecture 6th Edition
Immediate Addressing Mode
Control Unit Lecture 6.
Chapter 11 Instruction Sets
A Closer Look at Instruction Set Architectures
ADDRESSING MODES.
Alvaro Mauricio Peña Dariusz Niworowski Frank Rodriguez
A Closer Look at Instruction Set Architectures
ADDRESSING MODES.
William Stallings Computer Organization and Architecture 8th Edition
Assembly Lang. – Intel 8086 Addressing modes – 1
Chapter 4 The Von Neumann Model
Computer Science 210 Computer Organization
Processor Organization and Architecture
The Processor and Machine Language
SCHOOL OF ELECTRONICS ENGINEERING Electronics and Communication
Computer Science 210 Computer Organization
CSCE Fall 2013 Prof. Jennifer L. Welch.
Topic 6 LC-3.
Processor Organization and Architecture
MARIE: An Introduction to a Simple Computer
ECEG-3202 Computer Architecture and Organization
Instruction Set Architectures Continued
BIC 10503: COMPUTER ARCHITECTURE
Computer Architecture
Classification of instructions
CNET 315 Microprocessor & Assembly Language
Chapter 4 The Von Neumann Model
CSCE Fall 2012 Prof. Jennifer L. Welch.
COMS 361 Computer Organization
Mastering Memory Modes
ECE 352 Digital System Fundamentals
Processor design Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section 11.3.
Basic components Instruction processing
William Stallings Computer Organization and Architecture 8 th Edition Chapter 11 Instruction Sets: Addressing Modes and Formats.
Processor design Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section 11.3.
COMPUTER ARCHITECTURE
Presentation transcript:

Computer Architecture and the Fetch-Execute Cycle Memory Addressing Techniques

Learning Objectives Explain the concepts of direct, indirect, indexed and relative addressing of memory when referring to low-level languages.

Memory Addressing Techniques Direct Addressing Indirect Addressing Indexed Addressing Relative Addressing Immediate Addressing

1. Direct Addressing Means that the value in the address part of a machine code instruction is the address of the data. Simple to use but does not allow access to all memory addresses as there are memory addresses larger than can be held in the address part of an instruction. e.g. A 32-bit memory location may use 12 bits for the instruction code and 20 bits for the address of the data. This would allow for 2^12 (= 4096) instruction codes and 2^20 (= 1 048 576) memory addresses. However, a computer using 32-bit memory locations will have 2^32 (= 4 294 967 296) memory addresses. So direct addressing does not allow reference to all addresses e.g. for a computer using 32-bit memory locations, addresses from 2^20 – 2^32 cannot be referred to.

2. Indirect Addressing Means that the value in the address part of a machine code instruction is the address of the data.

Why use indirect addressing? Allows more memory to be accessed than direct addressing as the full size of register is used for an address. If this value points to a location which holds nothing but an address then 2^32 locations in memory can be addressed.

3. Indexed Addressing Index Register (IR) A special register used to adjust the address part of an instruction. The address given as part of the instruction is added to the contents of the index register (IR) to give the address of the data. Index register is then incremented.

Why use indexed addressing? Allows a set of contiguous data locations (e.g. an array) to be accessed without altering the instruction. i.e. Address in instruction does not change, only contents of IR.

Indexed Addressing Instr. ADD 100 IR: Address Data: 100 ….. 101 102 Address Data: 100 ….. 101 102 103 104 105

Indexed Addressing Instr. ADD 100 IR: 1 Address Data: 100 ….. 101 102 103 104 105

Indexed Addressing Instr. ADD 100 IR: 2 Address Data: 100 ….. 101 102 103 104 105

Indexed Addressing Instr. ADD 100 IR: 3 Address Data: 100 ….. 101 102 103 104 105

Indexed Addressing Instr. ADD 100 IR: 4 Address Data: 100 ….. 101 102 103 104 105

Indexed Addressing Instr. ADD 100 IR: 5 Address Data: 100 ….. 101 102 103 104 105

Note The IR does not necessarily have to start at 0. Why? To reach a particular field in a record with several fields. IR = Address of the start of the record. Instruction address = Offset of the required field from the start of the record. To reach an instruction in a program no matter where the program/page/segment is in main memory (see Memory Management Presentation or next 2 slides). IR = Address of the start of the program/page/segment (set by the loader). Instruction address = Offset of the required instruction from the start of the program/page/segment.

4. Relative Addressing Used only with jump instructions. Address in the jump instruction is the displacement from the last address already in the PC from the previous instruction. The address in the instruction is added to the value in the PC. e.g. The current instruction is in address 3000 and is Jump *45*, using relative addressing this means that the line wants to jump to an instruction 45 lines ahead of the next instruction (due to the PC being automatically incremented by 1 during any Fetch-Decode-Execute-Reset Cycle this 46 lines ahead of the current instruction). The PC will have been incremented to 3001 (ready for the next instruction) so the PC is changed to 3001+45 = 3046. The next cycle retrieves the next instruction from there. The program knows where the line is relative to the current instruction but not the true address.

Index Table + Physical Address Displacement e.g. 3001+45 = 3046 Physical Page Number Logical Page Number Base Address 8 5 3000 Displacement e.g. 45 + Physical Address e.g. 3001+45 = 3046

Segment Index Table Physical Address + e.g. 3501+131=3632 Displacement For more research http://www.edsim51.com/8051Notes/8051/instructionSetSummary.html http://en.wikipedia.org/wiki/Addressing_modes Physical Address e.g. 3501+131=3632 Displacement e.g. 131 + Segment Index Table Base Address Segment Size Segment 3500 1500 3

5. Immediate Addressing Immediate addressing is so-named because the value to be stored in memory immediately follows the operation code in memory. The instruction itself dictates what value will be stored in memory. For example, the instruction: MOV A,#20h I have used this in the form “Load 20” where 20 refers to a value and it is assumed that the 10 will go directly into the accumulator. This instruction uses Immediate Addressing because the Accumulator will be loaded with the value that immediately follows; in this case 20 (hexadecimal). Immediate addressing is very fast since the value to be loaded is included in the instruction. However, since the value to be loaded is fixed at compile-time it is not very flexible.

Immediate Addressing Advantage: Disadvantage: No memory reference other than instruction fetch is required to obtain operand. Disadvantage: The size of the number is limited to the size of the address field, which most instruction sets is small compared to word length. This is the similar to the problem “direct addressing” has. For more research http://www.8052.com/tutaddr.phtml

Question State the 4 methods of memory addressing and explain why they are used.