The Instruction Set. Chapter 5

Similar documents
Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 2: IA-32 Processor Architecture Included elements of the IA-64 bit

Complex Instruction Set Computer (CISC)

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM

Module 3 Instruction Set Architecture (ISA)

Computer Architecture and Organization. Instruction Sets: Addressing Modes and Formats

Computer Organization & Assembly Language Programming

Introduction to IA-32. Jo, Heeseung

INTRODUCTION TO IA-32. Jo, Heeseung

Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD /12/2014 Slide 1

Computer System Architecture

Addressing Modes. Immediate Direct Indirect Register Register Indirect Displacement (Indexed) Stack

Basic Execution Environment

Assembly Language. Lecture 2 - x86 Processor Architecture. Ahmed Sallam

Assembler Programming. Lecture 2

We can study computer architectures by starting with the basic building blocks. Adders, decoders, multiplexors, flip-flops, registers,...

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to

Low Level Programming Lecture 2. International Faculty of Engineerig, Technical University of Łódź

Assembly Language. Lecture 2 x86 Processor Architecture

Hardware and Software Architecture. Chapter 2

Addressing Modes on the x86

Memory Models. Registers

The Microprocessor and its Architecture

CS 16: Assembly Language Programming for the IBM PC and Compatibles

Lecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86

Assembly Language for x86 Processors 7 th Edition. Chapter 2: x86 Processor Architecture

MICROPROCESSOR TECHNOLOGY

Machine-level Representation of Programs. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

The x86 Architecture

Computer System Architecture

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 11 Instruction Sets: Addressing Modes and Formats

Load Effective Address Part I Written By: Vandad Nahavandi Pour Web-site:

Microprocessor and Assembly Language Week-5. System Programming, BCS 6th, IBMS (2017)

Lecture (02) The Microprocessor and Its Architecture By: Dr. Ahmed ElShafee

Chapter 11. Instruction Sets: Addressing Modes and Formats. Yonsei University

6/17/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

Code segment Stack segment

Interfacing Compiler and Hardware. Computer Systems Architecture. Processor Types And Instruction Sets. What Instructions Should A Processor Offer?

IA-32 Architecture COE 205. Computer Organization and Assembly Language. Computer Engineering Department

Practical Malware Analysis

Chapter 2: The Microprocessor and its Architecture

CC411: Introduction To Microprocessors

Chapter 11. Addressing Modes

Computer Organization (II) IA-32 Processor Architecture. Pu-Jen Cheng

CS 31: Intro to Systems ISAs and Assembly. Martin Gagné Swarthmore College February 7, 2017

EEM336 Microprocessors I. The Microprocessor and Its Architecture

Computer Organization CS 206 T Lec# 2: Instruction Sets

Introduction to Microprocessor

X86 Addressing Modes Chapter 3" Review: Instructions to Recognize"

Faculty of Engineering Computer Engineering Department Islamic University of Gaza Assembly Language Lab # 2 Assembly Language Fundamentals

Computer Architecture 1 ح 303

SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013)

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

Machine and Assembly Language Principles

Assembly Language Programming Introduction

Marking Scheme. Examination Paper Department of CE. Module: Microprocessors (630313)

Moodle WILLINGDON COLLEGE SANGLI (B. SC.-II) Digital Electronics

Instruction Sets: Characteristics and Functions Addressing Modes

SYSC3601 Microprocessor Systems. Unit 2: The Intel 8086 Architecture and Programming Model

Computer Processors. Part 2. Components of a Processor. Execution Unit The ALU. Execution Unit. The Brains of the Box. Processors. Execution Unit (EU)

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 2: IA-32 Processor Architecture. Chapter Overview.

IA32 Intel 32-bit Architecture

Chapter 2. lw $s1,100($s2) $s1 = Memory[$s2+100] sw $s1,100($s2) Memory[$s2+100] = $s1

Chapter 2 Instruction Set Architecture

Assembly Language for Intel-Based Computers, 4 th Edition. Kip R. Irvine. Chapter 2: IA-32 Processor Architecture

UMBC. A register, an immediate or a memory address holding the values on. Stores a symbolic name for the memory location that it represents.

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College February 9, 2016

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College September 25, 2018

Internal architecture of 8086

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-11: 80x86 Architecture

Advanced Microprocessors

History of the Intel 80x86

x86 architecture et similia

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

icroprocessor istory of Microprocessor ntel 8086:

An Introduction to x86 ASM

Assembly Language Each statement in an assembly language program consists of four parts or fields.

CSC 2400: Computer Systems. Towards the Hardware: Machine-Level Representation of Programs

Chapter Three Addressing Mode MOV AX, BX

CMSC Lecture 03. UMBC, CMSC313, Richard Chang

Scott M. Lewandowski CS295-2: Advanced Topics in Debugging September 21, 1998

EC-333 Microprocessor and Interfacing Techniques

Lecture 5: Computer Organization Instruction Execution. Computer Organization Block Diagram. Components. General Purpose Registers.

INTRODUCTION TO MICROPROCESSORS

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

UMBC. contain new IP while 4th and 5th bytes contain CS. CALL BX and CALL [BX] versions also exist. contain displacement added to IP.

Intel 8086 MICROPROCESSOR. By Y V S Murthy

Processes and Tasks What comprises the state of a running program (a process or task)?

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

MODE (mod) FIELD CODES. mod MEMORY MODE: 8-BIT DISPLACEMENT MEMORY MODE: 16- OR 32- BIT DISPLACEMENT REGISTER MODE

Real instruction set architectures. Part 2: a representative sample

Lecture 5:8086 Outline: 1. introduction 2. execution unit 3. bus interface unit

CNIT 127: Exploit Development. Ch 1: Before you begin. Updated

Instruction Set Principles. (Appendix B)

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 03, SPRING 2013

Intel 8086 MICROPROCESSOR ARCHITECTURE

x86 Assembly Tutorial COS 318: Fall 2017

EECE416 :Microcomputer Fundamentals and Design. X86 Assembly Programming Part 1. Dr. Charles Kim

iapx Systems Electronic Computers M

CSE2421 FINAL EXAM SPRING Name KEY. Instructions: Signature

UNIT- 5. Chapter 12 Processor Structure and Function

Transcription:

The Instruction Set Architecture Level(ISA) Chapter 5 1

ISA Level The ISA level l is the interface between the compilers and the hardware. (ISA level code is what a compiler outputs) 2

Memory Models An 8-byte word in a little-endian memory. (a) Aligned. (b) Not aligned. Some machines require that words in memory be aligned. 3

Overview of the Pentium 4 ISA Level The Pentium 4 s primary registers. P4 fetches 8bytes at a time from the memory. 80386 is 32-bit, all called IA-32. 4

1. Special purpose register 2. General purpose register Registers SPR : program counter, stack pointer. GPR : hold local variable, intermediate results of calculations. P4 has three operating modes: real mode: ------------------behaves like 8088, any wrong in the program ----- crash. Virtual 8086 mode: operating system control the whole machine. Protected mode: behaves like P4. 5

Registers a) Use 8-bit name, 16-bit name, or 32-bit name b) Applies to EAX, EBX, ECX, and EDX 8 AH 8 AL 8 bits + 8 bits AX 16 bits EAX 32 bits 6

General-Purpose Registers a) EAX Accumulator for operands and results data, div&mul b) EBX Pointer to data in the DS segment (Memory address) c) ECX Counter for string and loop operations d) EDX I/O pointer e) ESI (Source index) Pointer to data in the segment pointed to by the DS register; source pointer for string operations f) EDI (Destination index) Pointer to data (or destination) in the segment pointed to by the ES register; destination pointer for string operations g) ESP (Stack pointer) Stack pointer (in the SS segment) h) EBP (Base pointer )Pointer to data on the stack (in the SS segment) point to the base of the current stack. 7

Register a) Segment CS code segment DS data segment SS stack segment ES, FS, GS - additional segments b) EIP instruction pointer c) EFLAGS control flags (control CPU s operation, e.g. break, interrupt, enter 8086/protected mode) Status flag each flag is a single binary bit (set or clear) 8

Status Flags Carry (CF) unsigned arithmetic out of range Overflow (OF) signed arithmetic out of range Sign (SF) result is negative Zero (ZF) result is zero Auxiliary Carry (AC) carry from bit 3 to bit 4 in 8-bit operand Parity (PF) sum of 1 bits in least-significant byte is an even number 9

Segment Registers 10

Overview of the 8051 ISA Level (a) On chip memory organization for the 8051 (a) On-chip memory organization for the 8051. (b) Major 8051 registers. 11

8051 Summary of features of the standard 8051 4K bytes internal ROM (program) 128 bytes internal RAM (data) Four 8-bit I/O ports Two 16-bit timers Serial interface 64K external code memory space 64K external data memory space 210 bit-addressable bl locations 12

8051 8051 implements a separate memory space for programs (code) and data. Both code and data may be internal, however, both expand using external components to a maximum of 64K code memory and 64K data memory. Internal memory consists of on-chip ROM and on-chip data RAM. On-chip RAM contains a rich arrangement of general purpose p storage, bit addressable storage, register banks, and special function registers. In the 8051, the registers and input/output ports are memory mapped and accessible like any other memory location. In the 8051, the stack resides within the internal RAM, rather than in external RAM. 13

14

15

16

17

Data Types on the Pentium 4 The Pentium 4 numeric data types. Supported types are marked with. 18

Data Types on the 8051 The 8051 numeric data types. Supported types are marked with. 19

Instruction Formats (1) Four common instruction formats: (a) Zero-address instruction. (b) One-address instruction (c) Two-address instruction. (d) Three-address instruction. 20

Instruction Formats (2) Some possible relationships between instruction and word length. 21

Expanding Opcodes (1) An instruction ti with a 4-bit opcode and three 4-bit address fields. 22

Expanding Opcodes (2) An expanding opcode allowing 15 three-address instructions, 14 two-address instructions, 31 one-address instructions, and 16 zero-address instructions. ti The fields marked xxxx, yyyy, and zzzz are 4-bit address fields. 23

The Pentium 4 Instruction Formats The Pentium 4 instruction ti formats. 24

The 8051 Instruction Formats The 8051 instruction ti formats. 25

Addressing Modes a) Immediate b) Direct c) Indirect d) Register e) Register Indirect f) Displacement (Indexed) g) Stack 26

Immediate Addressing a) Operand is part of instruction b) Operand = address field c) e.g. ADD 5 Add 5 to contents of accumulator 5 is operand d) No memory reference to fetch data e) Fast f) Limited range Opcode Operand 27

Direct Addressing a) Address field contains address of operand b) Effective address (EA) = address field (A) c) e.g. ADD A Add contents of cell A to accumulator Look in memory at address A for operand d) Single memory reference to access data e) No additional calculations to work out effective address f) Limited address space 28

Direct Addressing Diagram Instruction ti Opcode Address A Memory Operand 29

Indirect Addressing (1) a) Memory cell pointed to by address field contains the address of (pointer to) the operand b) EA = (A) Look in A, find address (A) and look there for operand c) e.g. ADD (A) Add contents of cell pointed to by contents of A to accumulator 30

Indirect Addressing (2) a) Large address space b) 2 n where n = word length c) Multiple memory accesses to find operand d) Hence slower 31

Indirect Addressing Diagram Instruction Opcode Address A Memory Pointer to operand Operand 32

Register Addressing (1) a) Operand is held in register named in address filed b) EA = R c) Limited number of registers d) Very small address field needed Shorter instructions Faster instruction fetch 33

Register Addressing (2) a) No memory access b) Very fast execution c) Very limited address space d) Multiple registers helps performance e) Direct addressing 34

Register Addressing Diagram Instruction ti Opcode Register Address R Registers s Operand 35

Register Indirect Addressing a) indirect addressing b) EA = (R) c) Operand is in memory cell pointed to by contents of register R d) Large address space (2 n ) e) One fewer memory access than indirect addressing 36

Register Indirect Addressing Diagram Instruction Opcode Register Address R Memory Registers Pointer to Operand Operand 37

Displacement Addressing a) EA = A + (R) b) Address field hold two values A = base value R = register that holds displacement or vice versa 38

Displacement Addressing Diagram Instruction Opcode Register R Address A Memory Registers Pointer to Operand + Operand 39

Relative Addressing a) A version of displacement addressing b) R = Program counter, PC c) EA = A + (PC) d) i.e. get operand from A cells from current location pointed to by PC e) locality of reference & cache usage

Base-Register Addressing a) A holds displacement b) R holds pointer to base address c) R may be explicit or implicit d) e.g. segment registers in 80x8686

Indexed Addressing a) A = base b) R = displacement c) EA = A + R d) Good for accessing arrays EA = A + R R++

Indexed Addressing (1) A generic assembly program for computing the OR of Ai AND Bi for two 1024-element arrays.

Indexed Addressing (2) A possible representation of MOV R4,A(R2).

Combinations a) Post index b) EA = (A) + (R) c) Pre index d) EA = (A+(R))

Pentium Addressing Modes a) Virtual or effective address is offset into segment Starting address plus offset gives linear address This goes through page translation if paging enabled b) 12 addressing modes available Immediate Register operand Displacement Base Base with displacement Scaled index with displacement Base with index and displacement Base scaled index with displacement

he Pentium 4 Addressing Modes (1) The Pentium 4 32-bit addressing modes. M[x]

he Pentium 4 Addressing Modes (2) Access to a[i].

Loop Control (a) Test-at-the-end loop. (b) Test-at-the-beginning loop.

Input/Output (1) Three different I/O schemes are in current use in personal computers Programmed I/O with busy waiting. Interrupt-driven I/O. DMA I/O.

Input/Output (1) Device registers for a simple terminal (Status & Data). 4, each is 1 Byte, two for (In) and two for (out). Memory mapped I/O, part of the memory, Ordinary instructions. Otherwise use IN, OUT. Bit 7 sits by the hardware whenever a character arrives. If the software has previously set bit 6, an interrupt is generated In programmed I/O, CPU sits a tight loop repeatedly reading the keyboard status register then the software read the buffer. To write a character to the screen, the software first reads the display status t register to see if the READY bit is 1.

Input/Output (2) An example of programmed I/O.

Input/Output (2) Disadvantage of programmed I/O. CPU spends most of the time waiting the device to be ready (called busy waiting) The way to get rid of busy waiting is to have the CPU start the I/O device and tell it to generate an interrupt when it is done. Disadvantage is that, interrupt is required for every character transmitted.

Input/Output (3) DMA (Direct Memory Access) chip has at least four registers. The first one contains the memory address to be read. The second one contains the count, how many bytes (or word ) are to be transferred. The third one specifies the device number or I/O space address to use. Thus specifying i which h I/O device is desired. d The fourth one tells whether data are to be read from or writing to the I/O device. To write a block of 32 bytes from memory address 100 to terminal 4, the CPU writes 32, 100, 4, and 1 for write. DMA controller makes a bus request to read from memory, the another request to write to the terminal. When the count reach 0, DMA controller asserts the interrupt line on the CPU chip.

Input/Output t t (3) A system with a DMA controller.

The Pentium 4 Instructions (1) A selection of the Pentium 4 integer instructions.

The Pentium 4 Instructions (2) A selection of the Pentium 4 integer instructions.

The Pentium 4 Instructions (3) A selection of the Pentium 4 integer instructions.

The Pentium 4 Instructions (4) A selection of the Pentium 4 integer instructions.

8051 Instructions (1) The 8051 Instruction set.

8051 Instructions (2) The 8051 Instruction set.

8051 Instructions (3) The 8051 Instruction set.

8051 Instructions (4) The 8051 Instruction set.

8051 Instructions (5) The 8051 Instruction set.