Lecture 18 Last Lecture Today’s Topic Instruction formats

Slides:



Advertisements
Similar presentations
CH10 Instruction Sets: Characteristics and Functions
Advertisements

Microprocessors.
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.
Informationsteknologi Saturday, September 29, 2007 Computer Architecture I - Class 41 Today’s class More assembly language programming.
Instruction Set Architecture & Design
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.
Memory - Registers Instruction Sets
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Informationsteknologi Friday, November 16, 2007Computer Architecture I - Class 111 Today’s class Instruction set architecture.
What is an instruction set?
A Closer Look at Instruction Set Architectures
Parul Polytechnic Institute Parul Polytechnic Institute Subject Code : Name Of Subject : Microprocessor and assembly language programming Name.
GROUP #4 CHAPTER 10 JOEL FRAGA JAIME J.OCON DEISY HERNANDEZ.
Lecture 17 Today’s Lecture –Instruction formats Little versus big endian Internal storage in the CPU: stacks vs. registers Number of operands and instruction.
Machine Instruction Characteristics
Instruction Set Architecture
L/O/G/O The Instruction Set Chapter 9 CS.216 Computer Architecture and Organization.
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CS-334: Computer.
Chapter 5 A Closer Look at Instruction Set Architectures.
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 7.
Chapter 5 A Closer Look at Instruction Set Architectures.
Chapter 5 A Closer Look at Instruction Set Architectures.
Execution of an instruction
Computer Architecture and Organization
A summary of TOY. 4 Main Components Data Processor Control Processor Memory Input/Output Device.
Computer Architecture EKT 422
In1210/01-PDS 1 TU-Delft Instructions and addressing.
Chapter 5 A Closer Look at Instruction Set Architectures.
Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown.
Lecture 5 A Closer Look at Instruction Set Architectures Lecture Duration: 2 Hours.
Chapter 2 — Instructions: Language of the Computer — 1 Memory Operands Main memory used for composite data – Arrays, structures, dynamic data To apply.
What is a program? A sequence of steps
Group # 3 Jorge Chavez Henry Diaz Janty Ghazi German Montenegro.
Arrays in MIPS Assembly Computer Organization and Assembly Language: Module 6.
Chapter 5 A Closer Look at Instruction Set Architectures.
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 A Closer Look at Instruction Set Architectures.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Instruction sets : Addressing modes and Formats
A Closer Look at Instruction Set Architectures
A Closer Look at Instruction Set Architectures
A Closer Look at Instruction Set Architectures
A Closer Look at Instruction Set Architectures
Microcomputer Programming
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
EECE-276 Fall 2003 Microprocessors & Microcontrollers II
A Discussion on Assemblers
The Instruction Set Architecture Level
Chapter 8 Central Processing Unit
ECEG-3202 Computer Architecture and Organization
Chapter 9 Instruction Sets: Characteristics and Functions
A Closer Look at Instruction Set Architectures Chapter 5
ECEG-3202 Computer Architecture and Organization
COMPUTER ORGANIZATION AND ARCHITECTURE
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

Lecture 18 Last Lecture Today’s Topic Instruction formats Little versus big endian Internal storage in the CPU: stacks vs. registers Number of operands and instruction length Expanding opcodes Today’s Topic Instruction types Addressing modes

Byte Ordering Little endian machines store the most significant byte at the least significant byte. Big endian machines store the most significant byte first (at the lower address). As an example, suppose we have the hexadecimal number 0x12345678.

Little vs. big endian – Exercise 1 Assume a computer that has 32-bit integers. Show how each of the following values would be stored sequentially in memory, starting at address 0x100, assuming each address holds one byte. Be sure to extend each value to the appropriate number of bits. You will need to add more rows (addresses) to store all five values.

Stack Arithmetic Expression Infix notation, such as: Z = X + Y. Stack arithmetic uses postfix notation: Z = XY+. This is also called reverse Polish notation, in honor of its Polish inventor, Jan Lukasiewicz (1878 - 1956). The principal advantage of postfix notation is that parentheses are not used. For example, the infix expression, Z = (X  Y) + (W  U), becomes: Z = X Y  W U  + in postfix notation.

Infix & Postfix Expressions – Exercise 1 Convert the following expressions from infix to reverse Polish (postfix) notation. X * Y + W * Z + V * U X Y * W Z * V U * + + b) W * X + W * (U * V + Z) W X * W U V * Z + * + c) (W * (X + Y * (U * V)))/(U * (X + Y)) W X Y U V * * + * U X Y + * /

Stack Arithmetic Operation - Exercise Write the following expression in postfix (Reverse Polish) notation. Remember the rules of precedence for arithmetic operators! A B - C D E * F - * + G H K * + / Write a program to evaluate the above arithmetic statement using a stack organized computer with zero-address instructions (so only pop and push can access memory).

Expanding Opcodes– Exercise 1 A computer has 32-bit instructions and 12-bit addresses. Suppose there are 250 2-address instructions. How many 1-address instructions can be formulated? Explain your answer.

Expanding Opcodes– Exercise 2 In a computer instruction format, the instruction length is 11 bits and the size of an address field is 4 bits. Is it possible to have: 5 2-address instructions 45 1-address instructions 32 0-address instructions using the specified format? Justify your answer.

Expanding Opcodes– Exercise 2 Solution

Instruction Types Data movement Input/Output: Arithmetic Operations Move data from memory to registers, from registers to registers, from registers to memory. Examples: Move, load, store, push, pop, exchange. Input/Output: Input: transfers data from a device or port to either memory or a register. Output: transfers data from a register or memory to a specific port or a device. Arithmetic Operations Add, subtract, multiply, divide, increment, decrement, negate. Control transfer Alter the normal sequence of program execution. Branches, skips, procedure calls, returns, and program termination.

Instruction Types (Cont’) Boolean logic Perform boolean operations. AND, NOT, OR, TEST, and COMPARE Bit manipulation Setting or extracting individual bits within a given data word. Arithmetic and logic shift and rotate (a circle shift). Arithmetic shift, commonly used to multiply or divide by 2, treat data as signed two’s complement numbers. Logical shift instructions shift bits to either the left or to the right by a specific number of bits, shifting in zeros on the opposite end. Rotate instructions are simply shift instructions that shift in the bits that are shift out. Special purpose String processing, high-level language support, protection, flag control, word/byte conversion, cache management, register access, address calculation, no-ops.

Instruction Set Orthogonality Each instruction should perform unique function without duplicating any other instructions. Means no redundant instructions. Instruction set must be consistent: the operand/opcode relationship cannot be restricted (there are no special registers for particular instructions.)

Addressing Modes Addressing modes specify where an operand is located. They can specify a constant, a register, or a memory location. Addressing modes: Immediate addressing is where the data is part of the instruction. Example: addi $t0, $t1, 64 Direct addressing is where the address of the data is given in the instruction. Example: Load 3 Indirect addressing gives the address of the address of the data in the instruction. Example: loadi 3

Addressing Modes Addressing modes specify where an operand is located. They can specify a constant, a register, or a memory location. Addressing modes: Register addressing is where the data is located in a register. Example: add $t0,$s1,$s2 Register indirect addressing uses a register to store the address of the address of the data. (Effective PC address = contents of register 'reg' ) Example: add AX,[BX]

Addressing Modes Addressing modes (con’t) Indexed addressing: use an index register to store an offset, which is added to the address in the operand to determine the effective address of the data. Index + signed displacement Useful to access elements of an array Displacement ==> points to the beginning of the array Index register ==> selects an element of the array (array index)

Addressing Modes Addressing modes (con’t) Based addressing is similar except that a base address register is used instead of an index register. base + signed displacement Useful to access fields of a structure or record » Base register ==> points to the base address of the structure » Displacement ==> relative offset within the structure The difference between these two is that an index register holds an offset relative to the address given in the instruction, a base register holds a base address where the address field represents an offset from this base.

Addressing Modes Addressing modes (con’t) Stack addressing: the operand is assumed to be on top of the stack. Variations to these addressing modes: Indirect indexed: use both indirect and indexed addressing. Base/offset: offset + a base register + the specified instruction. Self-relative: the address of the operand is an offset from the current instruction. Auto increment – decrement: automatically increment or decrement the register used.

Addressing Mode – Exercise 1 For the instruction shown, what value is loaded into the accumulator for each addressing mode?

Addressing Mode – Exercise 1 Solution For the instruction shown, what value is loaded into the accumulator for each addressing mode?