In1210/01-PDS 1 TU-Delft Instructions and addressing.

Slides:



Advertisements
Similar presentations
Instruction Set Design
Advertisements

1 Lecture 3: Instruction Set Architecture ISA types, register usage, memory addressing, endian and alignment, quantitative evaluation.
INSTRUCTION SET ARCHITECTURES
ARITHMETIC LOGIC SHIFT UNIT
Computer Organization and Architecture
Instruction Set Architecture & Design
Execution of an instruction
Memory - Registers Instruction Sets
What is an instruction set?
Pentium Addressing Modes
1 Instructions and Addressing
Overview von Neumann Model Components of a Computer Some Computer Organization Models The Computer Bus An Example Organization: The LC-3.
Part II: Addressing Modes
Lecture 18 Last Lecture Today’s Topic Instruction formats
Instruction Set Architecture
Machine Instruction Characteristics
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CS-334: Computer.
Computer Architecture and the Fetch-Execute Cycle
Implementation of a Stored Program Computer ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides2.ppt Modification date: Oct 16,
Chapter 4 MARIE: An Introduction to a Simple Computer.
Chapter 4 The Von Neumann Model
Chapter 2-2 Assembly Instructions Number Systems Number Systems Assembly Instructions Assembly Instructions Branch Branch Next Lecture Next Lecture  Addressing.
Instruction Set Architecture The portion of the machine visible to the programmer Issues: Internal storage model Addressing modes Operations Operands Encoding.
Execution of an instruction
Module : Algorithmic state machines. Machine language Machine language is built up from discrete statements or instructions. On the processing architecture,
Computer Architecture and Organization
Computer Architecture EKT 422
Computer Architecture Lecture 03 Fasih ur Rehman.
Computer Organization 1 Instruction Fetch and Execute.
COMPUTER ORGANISATION Sri.S.A.Hariprasad Sr.Lecturer R.V.C.E Bangalore.
Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown.
What is a program? A sequence of steps
Group # 3 Jorge Chavez Henry Diaz Janty Ghazi German Montenegro.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Instruction Sets. Instruction set It is a list of all instructions that a processor can execute. It is a list of all instructions that a processor can.
Instruction Sets: Characteristics and Functions  Software and Hardware interface Machine Instruction Characteristics Types of Operands Types of Operations.
CSC 221 Computer Organization and Assembly Language Lecture 06: Machine Instruction Characteristics.
Chapter 5 Computer Organization TIT 304/TCS 303. Purpose of This Chapter In this chapter we introduce a basic computer and show how its operation can.
1 Instructions and Addressing Course website:
Functions of Processor Operation Addressing modes Registers i/o module interface Memory module interface Interrupts.
1 CSCI 2510 Computer Organization Memory Addressing and Assembly Instruction Basics.
COMPUTER ORGANIZATION UNIT 1. COMPUTER ORGANISATION AND ARCHITECTURE The components from which computers are built, i.e., computer organization. In contrast,
Chapter 11 Instruction Sets
Chapter 4 The Von Neumann Model
COMP2121: Microprocessors and Interfacing
A Closer Look at Instruction Set Architectures
Computer Organization and Design
Microcomputer Programming
Computer Organization and Design
Computer Organization and Assembly Language (COAL)
BASIC COMPUTER ORGANIZATION AND DESIGN
ECE 445 CS1251 Computer Organization Carl Hamacher
THE sic mACHINE CSCI/CMPE 3334 David Egle.
BIC 10503: COMPUTER ARCHITECTURE
Computer Organization and ASSEMBLY LANGUAGE
Topic 6 LC-3.
Processor Organization and Architecture
Computer Architecture and the Fetch-Execute Cycle
ECEG-3202 Computer Architecture and Organization
Chapter 9 Instruction Sets: Characteristics and Functions
ECEG-3202 Computer Architecture and Organization
Basic components Instruction processing
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
Information Representation: Machine Instructions
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

In1210/01-PDS 1 TU-Delft Instructions and addressing

In1210/01-PDS 2 TU-Delft Computer System READ(X) READ(Y) ADD(X,Y,Z) WRITE(Z) X: 1 Y: 2 Z: 3 IR: PC: arithmetic unit Central Processing Unit control unit Main Memory Input Output registers data and instructions

In1210/01-PDS 3 TU-Delft Instruction and wordlengths(1) instruction word instruction instruction word address

In1210/01-PDS 4 TU-Delft Instruction and wordlengths(2) instruction instruction word address instruction instruction

In1210/01-PDS 5 TU-Delft Instruction and wordlengths(3) word address instruction instr. instr instruction instr. instr instruction instr. instr instruction instr. instr instruction instr. instr instruction instr. instr

In1210/01-PDS 6 TU-Delft 32 bit word formats opcode specifier operand specifiers byte byte byte byte a two’s complement number 4 ASCII characters 32 bit a machine instruction

In1210/01-PDS 7 TU-Delft Byte formats word Big endian e.g. PowerPC Little endian

In1210/01-PDS 8 TU-Delft Question l What problems can occur in porting data between machines with big-endian and little- endian storage?

In1210/01-PDS 9 TU-Delft Type of Instructions l There are 4 types of instructions -Data Copy operations »between memory and registers »between memory locations »between registers -Arithmetic and Logic operations -Program flow control -I/O operations

In1210/01-PDS 10 TU-Delft Symbolic notation l Copy instructions [ R 1 ]  M( LOC ) l Arithmetic operations M( C )  M( A ) + M( B ) LOC, A, and B are memory addresses l M(address) means contents of memory location at address. [ R ] means contents of register R.

In1210/01-PDS 11 TU-Delft Operand specification formats l Three address instructions format: INSTR source#1,source#2,destination example: Add A,B,C means: M( C )  M( B ) + M( A ) l Two address instructions format: INSTR source, destination example: Add A,B means: M( B )  M( B ) + M( A )

In1210/01-PDS 12 TU-Delft Two address instruction l Two operand instructions destroy contents of the B location l Need other instruction to avoid that; Move B,C l We then have Move B,C Add A,C meaning: M( C )  M( B ); M( C )  M( C ) + M( A ) ;

In1210/01-PDS 13 TU-Delft One address instructions l One address have implicit source (often called Accumulator) Load A Add A Store C meaning [Accu]  M( A ); [Accu]  [Accu] + M( A ); M( C )  [Accu]

In1210/01-PDS 14 TU-Delft Registers l Many computers have a number of General- Purpose registers inside the CPU l Access to registers is faster than to memory locations l Used to store temporary data during processing l Registers require less bits of address than main memory

In1210/01-PDS 15 TU-Delft Register addressing l Let Ri denote register General operation ADD A,B,C can be broken down to Move A,R0 Add B,R0 Store R0,C meaning [ R0 ]  M( A ); [ R0 ]  [ R0 ] + M( B ); M( C )  [ R0 ]

In1210/01-PDS 16 TU-Delft Instruction formats (1) opcode specifier operand specifiers general format opcode operand one operand addressing

In1210/01-PDS 17 TU-Delft Instruction formats (2) opcode operand operand two operand addressing

In1210/01-PDS 18 TU-Delft Accumulator architecture Accumulator PC CPU Main Memory

In1210/01-PDS 19 TU-Delft Question How many instructions can be defined when the opcode field is 5 bit ?

In1210/01-PDS 20 TU-Delft Example instruction accu 4 bits 12 bits opcode operand m 15 0 sign bit

In1210/01-PDS 21 TU-Delft Instruction set

In1210/01-PDS 22 TU-Delft Multiple register architecture R0 CPU Main Memory R1 R2 R3

In1210/01-PDS 23 TU-Delft Straight-line sequencing …... ……. Move A,R0 Add B,R0 Move R0,C i i+4 i+8 A B C address Program for M( C )  M( B ) + M( A )

In1210/01-PDS 24 TU-Delft Straight-line sequencing Add Nn,R0 Move R0,S Move N1,R0 Add N2,R0 Add N3,R0 i i+4 i+8 i+4n-4 i+4n address Program for addition of n numbers

In1210/01-PDS 25 TU-Delft Branching n Clear R0 Move N,R1 Decr R1 Branch>0 L Move R0,S L S N N1 Nn Program for addition of n numbers Determine address of “next” number and add it to R0 program loop

In1210/01-PDS 26 TU-Delft Common branch conditions l N (negative) set to 1 of result is negative l Z (zero) set to 1 of result is zero l V (overflow) set to 1 of result overflows l C (carry) set to 1 of carry-out results

In1210/01-PDS 27 TU-Delft Question Why is the carry condition important?

In1210/01-PDS 28 TU-Delft Addressing modes l Addressing modes determine how the address of operands is determined l Typical 4 addressing modes -immediate addressing -direct addressing -indirect addressing -index addressing

In1210/01-PDS 29 TU-Delft Immediate addressing(1) opcode specifier operand instruction ADD # -1 JNZ example: simple counting loop

In1210/01-PDS 30 TU-Delft Immediate addressing(2) l Advantages: -no additional calculations needed to obtain operand -fast l Disadvantages: -Operand value must be known -Operand value cannot be changed -Limited no of bits available Notation: MOVE #200,R0 Meaning: [ R0 ]  200

In1210/01-PDS 31 TU-Delft Direct addressing(1) opcode specifier mem or reg address instruction memory or registers ADD 13 JNZ 10 #

In1210/01-PDS 32 TU-Delft Direct addressing(2) l Advantages: -Operand separate from instruction -Can be changed -Full word length available l Disadvantages: -More memory accesses -More storage occupation Notation: ADD R1,R2 Meaning: [ R2 ]  [ R2 ] +[ R1 ] l Also called “Absolute addressing” (Ham.)

In1210/01-PDS 33 TU-Delft Indirect addressing(1) ADD (12) JNZ # opcode specifier mem or reg address instruction op. address operand memory or registers

In1210/01-PDS 34 TU-Delft Indirect addressing(2) l Advantages: -Actual address of operand is not in instruction -Can be changed l Disadvantages: -Even more memory or register references -More memory occupation Notation: ADD (R1),R2 Meaning: [ R2 ]  [ R2 ] + M([ R1 ])

In1210/01-PDS 35 TU-Delft Example indirect addressing program loop L N N1 Clear R0 Move N,R1 Move #N1,R2 Add (R2),R0 Add #4,R2 Decr R1 Branch>0 L Move R0,S n S

In1210/01-PDS 36 TU-Delft Index addressing(1) opcode Reg index instruction operand memory or registers operand + registers

In1210/01-PDS 37 TU-Delft Index addressing(2) l Advantages: -Allows specification of fixed offset to operand address l Disadvantages: -Extra addition to operand address Notation: ADD X(R1),R3 (X=number) Meaning: [ R3 ]  [ R3 ] + M([ R1 ] + X )

In1210/01-PDS 38 TU-Delft Example index addressing NENE Program with index addressing program loop sex age salary n Empoyee ID sex age salary Empoyee ID L Move #E,R0 Move N,R1 Clear R2 Add 8(R0),R2 Add #16,R0 Decrement R1 Branch>0 L Div R1,R2 Move R2,Sum Move N,R1

In1210/01-PDS 39 TU-Delft Additional modes l Some computers have auto-increment (decrement instructions) Example: (R0)+ Meaning..M( R0 )..; [ R0 ]  [ R0 ]+1 Example: - (R0) Meaning [ R0 ]  [ R0 ]-1;..M( R0 )..