Some material taken from Assembly Language for x86 Processors by Kip Irvine © Pearson Education, 2010 Slides revised 2/2/2014 by Patrick Kelley.

Slides:



Advertisements
Similar presentations
Integer Arithmetic: Multiply, Divide, and Bitwise Operations
Advertisements

INSTRUCTION SET ARCHITECTURES
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and.
ELEN 468 Advanced Logic Design
Instruction Set Architecture Classification According to the type of internal storage in a processor the basic types are Stack Accumulator General Purpose.
Instruction Set Architecture
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.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
331 W02.1Spring 05 Announcements  HW1 is due on this Friday  Appendix A (on CD) is very helpful to HW1.
Computer Architecture CPSC 321 E. J. Kim. Overview Logical Instructions Shifts.
Assembly Language for Intel-Based Computers, 4th Edition
RISC Concepts, MIPS ISA and the Mini–MIPS project
Assembly Language for Intel-Based Computers Chapter 2: IA-32 Processor Architecture Kip Irvine.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
331 W02.1Fall 2003 Announcements  HW1 is due on this Friday (Sept 12 th )  Appendix A is very helpful to HW1. Check out system calls on Page A-48. 
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
MIPS Instruction Set Advantages
Assembly Language for Intel-Based Computers, 5th Edition
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP
Basic Operational Concepts of a Computer
Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and copy this slide show for your personal use, or for.
Basic Microcomputer Design. Inside the CPU Registers – storage locations Control Unit (CU) – coordinates the sequencing of steps involved in executing.
CSU0014 Assembly Languages Homepage: Textbook: Kip R. Irvine, Assembly Language for Intel-Based Computers,
Summer 2014 Chapter 1: Basic Concepts. Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Chapter Overview Welcome to Assembly Language.
Assembly Language for x86 Processors 7th Edition
Machine Instruction Characteristics
Chapter 1: Basic Concepts
Instruction Set Architecture
Computer Engineering IntroLab1 page 1 Beginners explanation on how a processor works! The labs will teach you the truth.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Assembly Language for x86 Processors 7 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and copy this.
CSE331 W02.1Irwin Fall 2001 PSU Computer Architecture Discussion Lecture # 2 MIPS Programming.
Memory and Addressing How and Where Information is Stored.
Fall 2012 Chapter 2: x86 Processor Architecture. Irvine, Kip R. Assembly Language for x86 Processors 6/e, Chapter Overview General Concepts IA-32.
Chapter 19 Number Systems. Irvine, Kip R. Assembly Language for Intel-Based Computers, Translating Languages English: Display the sum of A times.
1 Computer Architecture COSC 3430 Lecture 3: Instructions.
Chapter 5 The LC Instruction Set Architecture ISA = All of the programmer-visible components and operations of the computer memory organization.
CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface.
4-1 Chapter 4 - The Instruction Set Architecture Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
Execution of an instruction
Module : Algorithmic state machines. Machine language Machine language is built up from discrete statements or instructions. On the processing architecture,
The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Computer Organization Rabie A. Ramadan Lecture 3.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Computer Organization and Assembly Languages Yung-Yu Chuang 2005/09/29
Arrays in MIPS Assembly Computer Organization and Assembly Language: Module 6.
Lecture 2: Instruction Set Architecture part 1 (Introduction) Mehran Rezaei.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Chapter Overview General Concepts IA-32 Processor Architecture
Assembly Language for x86 Processors 6th Edition
Computer Architecture Instruction Set Architecture
MIPS Instruction Set Advantages
Control Unit Lecture 6.
Data Representation Binary Numbers Binary Addition
ELEN 468 Advanced Logic Design
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Instruction Format MIPS Instruction Set.
Chapter 5 The LC-3.
The University of Adelaide, School of Computer Science
Computer Instructions
Instruction Format MIPS Instruction Set.
Instruction Set Principles
Computer Organization and Assembly Languages Yung-Yu Chuang 2005/09/29
COMPUTER ORGANIZATION AND ARCHITECTURE
Part I Data Representation and 8086 Microprocessors
Presentation transcript:

Some material taken from Assembly Language for x86 Processors by Kip Irvine © Pearson Education, 2010 Slides revised 2/2/2014 by Patrick Kelley

Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Comparing ASM to High-Level Languages

Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Translating Languages English: Display the sum of A times B plus C. C++: cout << (A * B + C); Assembly Language: mov eax,A mul B add eax,C call WriteInt Intel Machine Language: A F E

Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Binary Numbers Digits are 1 and 0 1 = true 0 = false MSB – most significant bit LSB – least significant bit Bit numbering:

Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Integer Storage Sizes What is the largest unsigned integer that may be stored in 20 bits? Standard sizes: The above chart is for Intel x86 processors. In MIPS, a word is 32 bits, a half-word is 16 bits and there is no ‘quadword’. A byte is still a byte.

6 Ranges of Signed Integers The highest bit is reserved for the sign. This limits the range: Practice: What is the largest positive value that may be stored in 20 bits? Storage TypeRange(low-high)Powers of 2 Signed byte-128 to to (2 7 -1) Signed half-word-32,768 to to ( ) Signed word-2,147,483,648 to + 2,147,483, to ( )

7 Character Storage Character sets Standard ASCII(0 – 127) Extended ASCII (0 – 255) Unicode (0 – 65,535) SPIM System IO only handles ASCII Null-terminated String Array of characters followed by a null byte Using the ASCII table Appendix B in MIPS book

Irvine, Kip R. Assembly Language for x86 Processors 6/e, Basic Microcomputer Design clock synchronizes CPU operations control unit (CU) coordinates sequence of execution steps ALU performs arithmetic and bitwise processing

9 MIPS Architechture Control Logic Program Counter Instruction Register Rs Rd Rt ALU

10 Instruction Execution Cycle Fetch Memory at PC moved to IR Decode Opcode to ALU Register Operands selected Immediate Operand to ALU Fetch operands In other architectures but not MIPS Execute Store output Register to Memory operation (MIPS) PC Incremented Instruction Addresses on 4-byte boundary Branch may change PC instead of incrementing

11 Addressable Memory Addresses are 32 bits 2 32 locations = 4GB = 4,294,967,296 locations The ‘B’ in GB stands for ‘bytes’ Range is 0 to Half-word 16 bits or 2 bytes long Successive half-words have addresses that increment by 2 Word 32 bits or 4 bytes long Successive words have addresses that increment by 4

12 Register ‘File’ MIPS has 32 accessible 32-bit registers The registers are numbered 0 to 31 They also have short names The names will indicate the register’s purpose Purpose may be by convention or design Special registers may not be user accessible MIPS includes the IR, PC, and ALU registers Sometimes special registers are read only Other architectures have additional registers Commonly, there is a ‘status’ register IO port registers are also common.

13 Register ‘File’ (continued) RegisterNumberUsage zero0Constant 0 at1Reserved for assembler v02Used for return values from function calls v13 a04Used to pass arguments to functions a15 a26 a37

14 Register ‘File’ (continued) RegisterNumberUsage t08Temporary Caller saved Called function need not save or protect these t19 t210 t311 t412 t513 t614 t715 t824 t925

15 Register ‘File’ (continued) RegisterNumberUsage s016Saved Temporary Callee saved Called function must protect these by saving and then restoring before returning to caller s117 s218 s319 s420 s521 s622 s723

16 Register ‘File’ (continued) RegisterNumberUsage k026Reserved for OS kernel k127 gp28Pointer to global area sp29Stack Pointer fp30Frame Pointer ra31Return Address for function calls

17 Instruction Format Op-codeRsRtRdunusedFunction SSSSSTTTTTDDDDD00000FFFFFF Register format Op-codeRsRtImmediate constant SSSSSTTTTTIIIIIIIIIIIIIIII Immediate format Op-codeTarget 00001FTTTTTTTTTTTTTTTTTTTTTTTTTT Jump format Jump destination is PC + (Target Left Shift by 2)

18 Using Memory IR addresses memory directly via the PC MIPS ISA is ‘load/store’ Typically, only a load or store instruction affects memory All other operations affect only registers Registers are used to point to memory for load/store Addressing mode is Base/Displacement Displacement is also known as Offset One register will hold a base address, another the displacement Concatenating the two produces an effective address Other architectures use different modes Direct addressing – specifies the location directly Indirect addressing – part of the address is stored in memory Indexed addressing – displacement is multiplied by a constant Segment/offset – used to address large memory