Machine Instructions Operations

Slides:



Advertisements
Similar presentations
CH10 Instruction Sets: Characteristics and Functions
Advertisements

Instruction Set Design
Integer Arithmetic: Multiply, Divide, and Bitwise Operations
Chapter 8: Central Processing Unit
Data Dependencies Describes the normal situation that the data that instructions use depend upon the data created by other instructions, or data is stored.
INSTRUCTION SET ARCHITECTURES
Princess Sumaya Univ. Computer Engineering Dept. Chapter 2: IT Students.
Machine Instructions Operations 1 ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson Slides4-1.ppt Modification date: March 18, 2015.
Machine Instructions Control Flow 1 ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson Slides4-1B.ppt Modification date: March 24, 2015.
1 ITCS 3181 Logic and Computer Systems B. Wilkinson Slides9.ppt Modification date: March 30, 2015 Processor Design.
Instruction Set Architecture Classification According to the type of internal storage in a processor the basic types are Stack Accumulator General Purpose.
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson slides3.ppt Modification date: March 16, Addressing Modes The methods used in machine instructions.
Octavian Cret, Kalman Pusztai Cristian Vancea, Balint Szente Technical University of Cluj-Napoca, Romania CREC: A Novel Reconfigurable Computing Design.
Computer Organization & Assembly Language
80x86 Instruction Set Dr. Qiang Lin.
Informationsteknologi Saturday, September 29, 2007 Computer Architecture I - Class 41 Today’s class More assembly language programming.
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
By Tien Phung CS 147 Dr. Sin-Min Lee. High-level Languages Assembly Languages Machine Languages.
Memory - Registers Instruction Sets
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Chapter 2.2 Machine Language.
What is an instruction set?
Specifying the Actions Internal Architecture of a Simple Processor
Implementation of a Stored Program Computer
ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides6.ppt Modification date: Oct 30, Processor Design Specifying the Actions Internal Architecture.
Machine Instructions Operations 1 ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides4-1.ppt Modification date: Oct 22, 2014.
RISC and CISC. Dec. 2008/Dec. and RISC versus CISC The world of microprocessors and CPUs can be divided into two parts:
Instruction Set Design by Kip R. Irvine (c) Kip Irvine, All rights reserved. You may modify and copy this slide show for your personal use,
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CS-334: Computer.
Implementation of a Stored Program Computer ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides2.ppt Modification date: Oct 16,
Registers and MAL Lecture 12. The MAL Architecture MAL is a load/store architecture. MAL supports only those addressing modes supported by the MIPS RISC.
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 7.
CSCI 136 Lab 1: 135 Review.
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
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson Slides4-2.ppt Modification date: March 23, Procedures Essential ingredient of high level.
Differences in ISA Instruction length
Computer Architecture Lecture 03 Fasih ur Rehman.
Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown.
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
October 1, 2003Serguei A. Mokhov, 1 SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003.
What is a program? A sequence of steps
Group # 3 Jorge Chavez Henry Diaz Janty Ghazi German Montenegro.
Chapter 7 Bit Manipulation. 7.1 Logical Operations.
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.
Microprocessor & Assembly Language
Computer and Information Sciences College / Computer Science Department CS 206 D Computer Organization and Assembly Language.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
Microprocessor Systems Design I
Computer Organization and Assembly Language (COAL)
Computer Organization and ASSEMBLY LANGUAGE
MISP Assembly.
Chapter 8 Central Processing Unit
Shift & Rotate Instructions)
ECEG-3202 Computer Architecture and Organization
Shift & Rotate Instructions)
Chapter 9 Instruction Sets: Characteristics and Functions
ECEG-3202 Computer Architecture and Organization
The ARM Instruction Set
Shift and Rotate Instructions.
CS-401 Computer Architecture & Assembly Language Programming
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

Machine Instructions Operations ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson Slides4-1A.ppt Modification date: March 18, 2015

Instructions We will use a simple instruction formats of a so-called reduced instruction set computer (RISC), which has the characteristics: Simple, fixed length instruction format A few addressing modes Limited number of operations Designed to achieve high speed of execution It was recognized in the 1980’s that such processors would actually execute programs faster that the prevalent CISCs (complex instruction set computers).

Instruction format Our instruction format is quite similar to the G4/G5 PowerPC and SUN Sparc processors and also similar but not identical to that used in the assembly language simulator in the labs. Intel 64/IA32 processor family -- uses a very complex and archaic instruction format, based upon the early 8086 processor (which was themselves loosely based upon even earlier Intel processors). However Intel processors now convert this complex instruction format (CISC) internally to simpler RISC formats for performance reasons.

Some Key Features of Processor Used Thirty-two 32-bit integer registers called R0 to R31 2. One register, R0, holds zero permanently 3 All arithmetic done only between registers: - Three-register format op-code, destination register, source register 1, source register 2 or - Immediate addressing op-code destination register, source register, constant 4. Memory operations limited to: load register, and store register using register indirect addressing plus offset only: LD/LB destination register, offset[source register] ST/SB source register, offset[source register] R0 R1 R2 R31 R30 R3 R29 R4 R28 0000 … 0000 R31 holds return address for procedures. R29 is a stack pointer see later.

Data Transfer Examples Instruction Comments Instructions that copy the contents of one location to another location. Examples MOV R1,R2 ;R1 = R2 LD R3,100[R2] ;Contents of memory whose address is ;given by 100 + R2 copied to R3. ST [R5],R4 ;Contents of R4 copied to memory loc. ;whose address held in R5. (Offset = 0) Note LD and ST cause 32-bit transfers. Use LB and SB to cause 8-bit transfers. Instruction Comments

Arithmetic Instructions Performs an arithmetic operation such as addition, subtraction, multiplication or division. Examples ADD R1,R2,R3 ;R1 = R2 + R3 SUB R5,R4,3 ;R5 = R4 – 3 For literals (immediate addressing) differences in assembly language notation. Might be written as: SUB R5,R4,#3 ;R5 = R4 - 3 or SBI R5,R4,3 ;R5 = R4 - 3 depending upon assembly language.

C/Java Language Examples Logical Instructions Performs bit-wise logical operation such as AND, OR, exclusive-OR, or NOT. AND, OR, exclusive-OR operate upon pairs of bits of two operands. Bit-wise AND, OR, Ex-OR, and NOT are available in C and Java (although you probably did not come across them!): C/Java Language Examples y = y & 1 ;bit-wise AND y with the number 1 z = z | 2 ;bit-wise OR z with the number 2

Machine Instruction Examples AND R1,R2,R3 ;R1 = R2 “AND” R3 if R2 = 10100010100101011000010100001111 R3 = 01011011111010100010100010111010 then R1 = 00000010100000000000000000001010 OR R1,R2,R3 ;R1 = R2 “OR” R3 then R1 = 11111011111111111010110110111111

C/Java language Examples Shift Instructions Moves the bits of a location one or more places left or right. Again available in C/Java (although you probably did not come across them!): C/Java language Examples y = y << 1 ;shift y 1 place left 1 z = z >> 2 ;shift z 2 places right

Machine Instruction Examples SHL R1,R1,1 ;Shift R1 left one place SHR R1,R1,1 ;Shift R1 right one place X = 0 or 1 see next slide

Arithmetical and Logical Shifts Two types of shift usually provided: “Logical” shift (SHL, SHR) Fill free end with 0, i.e. X = 0. “Arithmetic” shift (SAL, SAR) Arithmetic shifts multiple/divide by 2. Arithmetic shift right maintains value of sign bit, i.e. X = value of original sign bit.

Example Starting with a number 9 000 ... 0001001 Shift arithmetic left one place. Get 18 000 ... 0010010 Shift arithmetic right two places. Get 4 000 ... 0000100 i.e. lost the 0.5.

Note: Java has logical shift right - called unsigned right shift, >>>. Example x = x >>> 2;

Question What is the difference, if any, between arithmetic shift left and logical shift left, i.e. what is the difference, if any, between: SHL R1, R1, 1 and SAL R1, R1, 1 Answer Arithmetic shift left same as logical shift left (except arithmetic overflow may be detected).

Question Answer What is the effect of the sequence? SAR R1, R1, 1 SAL R1, R1, 1 Answer Makes number even if odd, i.e. 5 would become 4

Rotate Instructions Examples Moves bits of location one or more places left of right in a circular fashion. Examples ROL R1,R1,1 ;Rotate R1 left one place ROR R1,R1,1 ;Rotate R1 right one place Version of rotate exists where the rotate passes thro a Carry flag within the condition code register, see later about the CCR

Questions