CPU: SOFTWARE ARCHITECTURE INSTRUCTION SET (PART

Size: px
Start display at page:

Download "CPU: SOFTWARE ARCHITECTURE INSTRUCTION SET (PART"

Transcription

1 General Introduction CPU: SOFTWARE ARCHITECTURE INSTRUCTION SET (PART 1) General Introduction (1/5): On Instructions Instruction operate with data or with the flow of the program The following information is absolutely needed to define an instruction: OpCode: What is the operation to be done Operands: What operands are involved Addressing mode: Where is data to be found Additional information may include size of operands or other modifiers. General Introduction (2/5): On instructions The number and type of instructions, i.e., what they do, depend on the MCU or MPU family and model. Several types of instructions are found in almost any MCU or MPU Syntax may be different An instruction set is not necessarily independent It may happen that the operation of one instruction may be realized with other with proper operands. 1

2 General Introduction (3/5): On operands The maximum number of operands of instructions depends on MCU or MPU model Most small microcontrollers work with two operands. Some specific families work with three operands In many instances, one or more operands may be implicit Two operands (data) are considered: destination and source General Introduction (4/5): Destination The result of an instruction, except for some cases, is stored either as a CPU register content memory cell (or cells, depending on data size) contents contents of register of an IO device. The place where the result is stored is called destination (dest) General Introduction (5/5): Source The source is the other datum involved in the operation It may be a Constant data or a CPU Register, memory cell(s) or IO register contents Abusing of language, source is referred to as The source itself alone An expression that involves the source and destination (as in source + destination) An expression that includes the source and other information Register Transfer Notation (RTN) The register transfer notation (RTN) is a symbolic, MCU independent notation to indicate CPU transactions, operations in programs, etc. Arrow points to destination: dest src In an expression such as dest dest + source, the destination data in dest + source is the one previous to the transaction, and dest on the left is the data after transaction PC NewAddress is mentioned as Jump to NewAddress or GOTO Newaddress 2

3 Hybrid RTN and convention (1/3) Convention: When RTN is too complicated, a simple sentence is preferred Jump to address, instead a PC address Operands are denoted as follows: For a CPU register, the register name is given. In MSP430: R4, R5, etc. INTEL 8086: AX, AH, BL, etc. In general, simply register Reg X, or RX A constant data by the number or #number Example R6 34h, or R6 #34h means R6 is stored with number 34h Hybrid RTN and convention (2/3) When data is to be stored in memory, or IO device register, the address at memory is provided in parenthesis or preceded by &. (2030h) denotes data at address 2030h (Hello) denotes data at address defined by a label named Hello. (R5) denotes data at address given by contents of register R5 (R5 + X) denotes data at address given by the result of adding X to the contents of register RTN Conventions (3/3) Data to register pertaining an I/O subsystem device: same notation as in memory, except that address belong to the Device register, and it must be indicated. Usually, use the name of the register (P1OUT) denotes the address of Output Register of Port 1 (WDTCTL) denotes the address of the Watchdog Timer Control Register Addresses are also denoted with & (loan from C) (2030h) same as &2030h (P1OUT) same as &P1OUT Machine Language Machine language instruction is the set of n- bit words that define an instruction If there are more than one word, the first in the set is called instruction word The instruction word contains: OpCode: field of bits that define the operation Destination and Source bit fields Addressing Mode field: That define how and where to read data, destination and source fields. 3

4 Example: MSP430 instructions From machine to assembly (1/2) Assembly language is make programming in machine language much easier and direct Each machine language instruction is associated to one and only one assembly language instruction Converting an assembly language to its machine language version is to assemble. The software tools to assemble are assembler : works all instructions before assembling Interpreter or line interpreter : works with an isolated instruction From machine to assembly (2/2) An assembly language instruction consists of A mnemonics: Name given to the opcode, Operands written in a specific syntax for addressing mode The specific syntax for mnemonics, operands and order in the instruction is CPU family dependent. The three examples below all express an instruction of the form dest (0204h), dest is a CPU register and the data size is a byte MSP430 mov.b 0204h, R6 (CPU register is R6) Intel 8086 mov AH, [0204h] (CPU register is AH) M68CH11 LDAA $0204 (CPU register is accumulator A) Instruction Types INSTRUCTION SET (PART 2) 4

5 Instruction Types (1/2) Data transfer instructions (dest src) For reading and writing to and from memory and IO registers, Storing with data, copy from registers. These instructions in general do not affect flags Arithmetic and logic operations Of the type dest dest * src (* means an operation), with flags being or not affected Of the type (dest*src), affecting only flags Instruction Types (2/2) Register operations: manipulates bit order Shift, roll and rotation Flow program operations: On execution, they modify the content of the PC register Jump instructions (PC New Address) Subroutine instructions: Call and Return Interrupt instructions: Return from Interrupt. Transfer operations (1/2) Move instructions: copy source data onto destination data (dest src) MSP430 mnemonics mov, mov.w, mov.b Also called load, store instructions Input and output transfer instructions For those MCU with IO mapped IO systems Input*: dest (Input Port) Output*: (Output port) Source Common Data Transfer Instructions Stack transfer operations, managed by SP register (explained later) Push: (TOS) src Pop or Pull: dest (TOS) TOS means Top Of Stack Swap: dest source (exchange of contents; both operands are erased and reloaded) 5

6 Arithmetic instructions (1/2) Addition and Subtraction Addition Operations: Addition: dest dest + src Addition with carry: dest dest + src + CFlag Subtraction Operations: Usually with two s complement addition Subtraction: dest dest src Subtraction with borrow : dest dest src BF for dual Carry/Borrow cases dest dest + NOT(src) + CF, when CF=0 denotes borrow Compare operation: dest src; only flags affected Arithmetic instructions (2/2) Multiplication and division Not all microcontrollers ALU s implement these operations. Operands and destination sizes are of outmost importance. When not supported, these operations are done by software Special cases are dedicated peripherals. Logic Instructions General introduction Bitwise and not bitwise Most microcontrollers support only bitwise logic operations Non bitwise logic operation principles: Yield a boolean result (usually in a flag) In source, 1 means operand is not zero; 0 means operand is zero Used mainly in high performance systems or as part of high level instructions Bitwise Logic Operations (1) dest dest*source means dest(j) dest(j)*source(j) Bitwise operations permit individual bit manipulations The source is usually called mask 1 s in mask indicate which bits are to be affected AND: dest dest.and. src OR: dest dest.or. src XOR: dest dest.xor. Src NOT: dest NOT(dest) 6

7 Bit manipulation : CLEAR Bit manipulation : SET 0.AND.X=0; 1.AND.X=X To clear specific bits in destination, the binary expression of the source has 0 at the bit positions to clear and 1 elsewhere 0.OR.X=X; 1.OR.X=1 To set specific bits in destination, the binary expression of the source has 1 at the bit positions to set and 0 elsewhere 0.XOR.X=X; 1.XOR.X=X Bit manipulation : TOGGLE To toggle specific bits in destination, the binary expression of the source has 1 at the bit positions to invert and 0 elsewhere Register operations: Shifts, rolls and rotates Shift (or roll) right logically: 0 dest(n-1) dest(n-2). dest(1) dest(0) CF Shift left: C dest(n-1) dest(n-2). dest(1) dest(0) 0 Shift (or roll) right arithmetically: Dest(N-1) dest(n-1) dest(n-2). dest(1) dest(0) CF Rotate right through: CF old dest(n-1) dest(n-2). dest(1) dest(0) CF 7

8 Shift and rotate examples Carry Old Carry X Original X Shift right logically X Shift right arithmetically X Shift left Program Flow Instructions (1) Jumps or Branch -- ACTION: PC NewAddress Unconditional jumps: (jmp) GOTO!!!!!!!!!!! Ohhhhhhh!!!!!! Conditional jumps: test a flag condition Basic tools for decisions A A 1 Shift left with carry Original A A rotate right through carry Conditional jumps (simple flags) Conditional jump Condition Jump if zero (jz) Z=1 Jump if not zero (jnz) Z=0 Jump if carry (jc) C=1 Jump if not carry (jnc) C=0 Jump if negative (jn) N=1 Jump if not negative (jp) N=0 Jump if overflow (jv) V=1 Jump if not overflow (jnv) V=0 Other names and otherconditional jumps To be used after a compare operation A-B, for numeric decisions) Conditional jump Condition Note Jump if equal (je) (= Jump if zero) Z=1 Jump if not equal (jne) (= Jump if not zero) Z=0 Jump if larger or equal (= Jump if carry) C=1 Unsigned numbers Jump if lower (= Jump if not carry) C=0 Unsigned numbers Jump if greater or equal (jge) N=V Signed numbers Jump if less N~=V Signed numbers Other combinations available.. 8

9 Remarks on jumps A jump is also called a branch instruction Unconditional jumps are present in almost any CPU Not all conditional jumps are necessarily present in the CPU architecture The use of jumps is indispensable to devise non sequencial programs. Subroutines and Procedures Subroutines (also called functions or procedures) are pieces of executable code written and stored apart from the main code They are to be executed when invoked from main code or other subroutine, but flow must return to original normal flow The Address of first instruction is called Entry Address Subroutine Instructions: Subroutine process Call instruction: Saves the present value of the PC register and then loads the PC with the entry address of the subroutine a) (TOS) PC PC Sub. Entry Address Return instruction: Retrieves the address following the call in the main code [PC (TOS)] Important note: Subroutine programming must ensure that return is well done Important remark: Subroutine must be designed so that when RET is encountered SP is pointing to the right location 1. Just before CALL execution PC points to next memory location after CALL. 2. Upon execution, the content of PC is pushed onto stack, and PC loaded with address of subroutine entry line 3. Subroutine is executed until instruction RET (return) is found. 4. Execution of RET pops PC, restoring the address of the instruction just after CALL --- This happens every time CALL is executed 9

10 Call and Return Example 1: Delay loop F24A F248 Inst Bla bla Next Instr. CALL SUB Entry Addr E420 E402 E400 Return Entry line Before Fetch of call: PC = F248 After decode of call, and before execute phase: PC = F24A First step of execution: PC = F24A, (TOS) = F24A Second Step of Execution PC = E400 (TOS) = F24A After return: PC = F24A Example 2: Repeat process N times Examples of composed Conditional Structures using basic structure Single Flag(s) condition Instruction affecting flags Counter N Yes FLAG? No Label: Do process counter counter -1 Jump if not zero to Label Multiple Flags: FLAG_A AND FLAG_B Instruction affecting flags Multiple Flags: FLAG_A OR FLAG_B Instruction affecting flags FLAG_A? No Yes FLAG_A? Yes No Yes FLAG_B? No Yes FLAG_B? No 10

11 Pop TOS 6/30/2014 STACK AND STACK POINTER Stack Definition and Characteristics Stack is a specialized memory segment which works in LIFO (Last In-First Out) mode. Managed by the Stack Pointer Register (SP) Hardwired stack: physically defined, cannot change Software defined: First address in stack defined by initialization of SP (by user or by compiler) Stack Operations: PUSH: storing a new data at the next available location POP or PULL: retrieving last data available from the sequence (to be stored in some destination) Important Note: A retrieved data is not deleted, but cannot be retrieved again with a stack operation Top of Stack (TOS): memory address used in the stack operation (different for push or pop) Basics of stack operation Basics of stack operation PUSH (garbage not shown) X x x x x x x x x x Empty at start (Only garbagge) D0 11

12 Pop TOS Pop TOS Pop TOS Pop TOS 6/30/2014 Basics of stack operation Basics of stack operation D0 D1 PUSH D0 D1 D2 PUSH Basics of stack operation Basics of stack operation D0 D1 D2 POP D0 D1 D3 PUSH 12

13 Pop TOS Pop TOS 6/30/2014 Basics of stack operation Basics of stack operation D0 D1 D3 POP D0 D1 D3 POP xxxx xxxx-n xxxx-2n xxxx-3n xxxx-4n xxxx xxxx-n xxxx-2n xxxx-3n xxxx-4n Empty D0 D1 D2 After a push Software Defined Stack Grows Downwards PopTOS xxxx xxxx-n xxxx-2n xxxx-3n xxxx-4n xxxx D0 After a push xxxx-n xxxx-2n xxxx-3n xxxx-4n D0 D1 D2 After a pop PopTOS PopTOS xxxx xxxx-n xxxx-2n xxxx-3n xxxx-4n xxxx xxxx-n xxxx-2n xxxx-3n xxxx-4n D0 D1 After a push D0 D1 D3 After a push PopTOS PopTOS Stack and Stack Pointer The Stack Pointer contents is an address associated to the stack operation The contents of SP is sometimes called Top-of- Stack Since contents is unique, and two addresses are associated to the TOS, there are 2 possibilities: SP contains the PUSH-TOS (Example: Freescale) SP contains the POP TOS (Example: MSP430) 13

14 SP points to PUSH TOS SP points to POP TOS To do a PUSH: 1. Store (SP) Data 2. Update SP SP - N To do a POP: 1. Update SP SP+N 2. Retrieve Dest (SP) These steps are done automatically by CPU. (SP+N) (SP) D0 D1 D2 PopTOS To do a PUSH: 1. Update SP SP -N 2. Store (SP) Data To do a POP: 1. Retrieve Dest (SP) 2. Update SP SP+N These steps are done automatically by CPU. (SP) (SP-N) D0 D1 D2 PopTOS Stack Pointer in MSP430 SP is register R1 It is always even, since the least significant bit is hardwired to 0 There is an error if user tries to load an odd number onto SP It points to the last pushed item (first to pop) N=2: That is, update is always If pushing a byte, the msb of the word becomes 00h Important Remarks Without any reference to the actual meaning of SP contents, and the fact that the address for pushing and pulling are different, the following conventions are generally adopted: Contents of SP is called TOP-OF-STACK (TOS) PUSH operation is denoted as (TOS) source POP or PULL operation is denoted as dest (TOS) You should be aware of differences!! 14

15 General introduction(1/2) ADDRESSING MODES Addressing mode is the way to denote where to find (or store) the datum used in an operation A datum or result to store can be referred to explicitely (immediate mode) as contents of a CPU register (register mode) By the address of the memory or IO register(s) where it is to be found General introduction (2/2) Actual addressing modes and mode names in a family or model should be consulted in data sheet or user guide Cases presented here are common, names may differ Syntax depends on family system Note: we use msp430 syntax for examples. Specific restrictions for use is also family dependent Orthogonal system: it accepts all registers and addressing modes in both source and destination Except immediate mode, not valid for destination Immediate and register modes (1/2) Immediate mode is when datum is explicitly given It is valid only for source Syntax in MSP430 #Datum (#N) Register mode is when datum is the contents of a CPU register Syntax in MSP430 (and almost all MCU): Register Name Rn. 15

16 Immediate and Register Modes (2/2) Examples MSP430 examples: Explanation: mov src, dest stands for dest src Examples: (Register contents in hex notation) If R5=245A, then after execution of instruction mov #0x2AC, R5 R5 = 02AC If R5=245A, then after execution of instruction mov #-20285, R5 R5 = B0C3 If R5 = 245A and R6 = ABCD, then after execution of instruction mov R5, R6 R5 = 245A, R6=245A Instruction does not modify source mov R5,#435 is not valid! Memory related addressing modes: Direct mode (or absolute mode): address is explicitely given MSP430 notation: Address_value (X) Register indirect (or indirect): address is given as contents of a CPU register MSP430 Indexed ( register relative; or base indexed): Address is given as the addition of a number X and contents of a CPU register MSP430 notation: X(Rn) Examples (1/2) Word size data address and content before each example (all hex notation): [0308]= 23FE, [030A]=012D Direct mode: mov 0308h, R6 R6 = 23FE If R6 = 9ABC, then mov R6, 0308h [0308] = 9ABC Register indirect: If R5 = 0308, then R6 R6=23FE, R5=0308 0x030A [030A]= 23FE Examples (2/2) Word size data address and content before each example (all hex notation): [0308]= 23FE, [030A]=012D Indexed Mode: If R5 = 0308, and R6= 3FEC before each instruction then mov 2(R5), R6 R6=012D, R5=0308 mov 0(R5), 0x030A [030A]= 23FE mov R6, 2(R5) [030A] = 3FEC, R5= 0308, R6 = 3FEC mov # 128, 0(R5) [0308] = 8000 Comments: Indexed mode is very handy for arrays. 16

Micro computer Organization

Micro computer Organization Micro computer Organization I Base Basic Components CPU SYSTEM BUSES VDD CLK RESET 1 MPU vs MCU Microprocessor Unit (MPU) CPU (called Microprocessor) is a die All components external to die Basically on

More information

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

UNIT-II. Part-2: CENTRAL PROCESSING UNIT Page1 UNIT-II Part-2: CENTRAL PROCESSING UNIT Stack Organization Instruction Formats Addressing Modes Data Transfer And Manipulation Program Control Reduced Instruction Set Computer (RISC) Introduction:

More information

It is possible to define a number using a character or multiple numbers (see instruction DB) by using a string.

It is possible to define a number using a character or multiple numbers (see instruction DB) by using a string. 1 od 5 17. 12. 2017 23:53 (https://github.com/schweigi/assembler-simulator) Introduction This simulator provides a simplified assembler syntax (based on NASM (http://www.nasm.us)) and is simulating a x86

More information

SOEN228, Winter Revision 1.2 Date: October 25,

SOEN228, Winter Revision 1.2 Date: October 25, SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003 1 Contents Flags Mnemonics Basic I/O Exercises Overview of sample programs 2 Flag Register The flag register stores the condition flags that retain

More information

SN8F5000 Family Instruction Set

SN8F5000 Family Instruction Set SONiX Technology Co., Ltd. 8051-based Microcontroller 1 Overview SN8F5000 is 8051 Flash Type microcontroller supports comprehensive assembly instructions and which are fully compatible with standard 8051.

More information

Assembly Language Programming of 8085

Assembly Language Programming of 8085 Assembly Language Programming of 8085 Topics 1. Introduction 2. Programming model of 8085 3. Instruction set of 8085 4. Example Programs 5. Addressing modes of 8085 6. Instruction & Data Formats of 8085

More information

Contents 8051 Instruction Set BY D. BALAKRISHNA, Research Assistant, IIIT-H Chapter I : Control Transfer Instructions Lesson (a): Loop Lesson (b): Jump (i) Conditional Lesson (c): Lesson (d): Lesson (e):

More information

Grundlagen Microcontroller Processor Core. Günther Gridling Bettina Weiss

Grundlagen Microcontroller Processor Core. Günther Gridling Bettina Weiss Grundlagen Microcontroller Processor Core Günther Gridling Bettina Weiss 1 Processor Core Architecture Instruction Set Lecture Overview 2 Processor Core Architecture Computes things > ALU (Arithmetic Logic

More information

PHYS 319. Things to do before next week's lab Whirlwind tour of the MSP430 CPU and its assembly language Activity 1.

PHYS 319. Things to do before next week's lab Whirlwind tour of the MSP430 CPU and its assembly language Activity 1. PHYS 319 Things to do before next week's lab Whirlwind tour of the MSP430 CPU and its assembly language Activity 1. Before next week's lab: Read manual for Lab 2 and your OS setup guide then prepare your

More information

Microcontroller Intel [Instruction Set]

Microcontroller Intel [Instruction Set] Microcontroller Intel 8051 [Instruction Set] Structure of Assembly Language [ label: ] mnemonic [operands] [ ;comment ] Example: MOV R1, #25H ; load data 25H into R1 2 8051 Assembly Language Registers

More information

CHAPTER 8: Central Processing Unit (CPU)

CHAPTER 8: Central Processing Unit (CPU) CS 224: Computer Organization S.KHABET CHAPTER 8: Central Processing Unit (CPU) Outline Introduction General Register Organization Stack Organization Instruction Formats Addressing Modes 1 Major Components

More information

8051 Overview and Instruction Set

8051 Overview and Instruction Set 8051 Overview and Instruction Set Curtis A. Nelson Engr 355 1 Microprocessors vs. Microcontrollers Microprocessors are single-chip CPUs used in microcomputers Microcontrollers and microprocessors are different

More information

Assembly Language Programming of 8085

Assembly Language Programming of 8085 Assembly Language Programming of 8085 1. Introduction A microprocessor executes instructions given by the user Instructions should be in a language known to the microprocessor Microprocessor understands

More information

Microcontrollers. Microcontroller

Microcontrollers. Microcontroller Microcontrollers Microcontroller A microprocessor on a single integrated circuit intended to operate as an embedded system. As well as a CPU, a microcontroller typically includes small amounts of RAM and

More information

Ex: Write a piece of code that transfers a block of 256 bytes stored at locations starting at 34000H to locations starting at 36000H. Ans.

Ex: Write a piece of code that transfers a block of 256 bytes stored at locations starting at 34000H to locations starting at 36000H. Ans. INSTRUCTOR: ABDULMUTTALIB A H ALDOURI Conditional Jump Cond Unsigned Signed = JE : Jump Equal JE : Jump Equal ZF = 1 JZ : Jump Zero JZ : Jump Zero ZF = 1 JNZ : Jump Not Zero JNZ : Jump Not Zero ZF = 0

More information

Before next weeks lab:

Before next weeks lab: Before next weeks lab: - To sign in to lab computers use student and Phys319. - read the lab manual for week two. - look at the tools installation guide for OS of your choice and/or lab computer guide,

More information

Computer Organization CS 206 T Lec# 2: Instruction Sets

Computer Organization CS 206 T Lec# 2: Instruction Sets Computer Organization CS 206 T Lec# 2: Instruction Sets Topics What is an instruction set Elements of instruction Instruction Format Instruction types Types of operations Types of operand Addressing mode

More information

CPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA)

CPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA) CPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA) Aleksandar Milenković Email: milenka@uah.edu Web: http://www.ece.uah.edu/~milenka Objective Introduce MSP430 Instruction Set Architecture (Class of ISA,

More information

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING CHAPTER 2 8051 ASSEMBLY LANGUAGE PROGRAMMING Registers Register are used to store information temporarily: A byte of data to be processed An address pointing to the data to be fetched The vast majority

More information

CS401 - Computer Architecture and Assembly Language Programming Glossary By

CS401 - Computer Architecture and Assembly Language Programming Glossary By CS401 - Computer Architecture and Assembly Language Programming Glossary By absolute address : A virtual (not physical) address within the process address space that is computed as an absolute number.

More information

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller of 8085 microprocessor 8085 is pronounced as "eighty-eighty-five" microprocessor. It is an 8-bit microprocessor designed by Intel in 1977 using NMOS technology. It has the following configuration 8-bit

More information

Microcontroller. Instruction set of 8051

Microcontroller. Instruction set of 8051 UNIT 2: Addressing Modes and Operations: Introduction, Addressing modes, External data Moves, Code Memory, Read Only Data Moves / Indexed Addressing mode, PUSH and POP Opcodes, Data exchanges, Example

More information

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY BACKGROUND 8086 CPU has 8 general purpose registers listed below: AX - the accumulator register (divided into AH / AL): 1. Generates shortest machine code 2. Arithmetic, logic and data transfer 3. One

More information

Computer Organization and Architecture, Pt. 2

Computer Organization and Architecture, Pt. 2 Computer Organization and Architecture, Pt. 2 Charles Abzug, Ph.D. Department of Computer Science James Madison University Harrisonburg, VA 22807 Voice Phone: 540-568-8746, E-mail: CharlesAbzug@ACM.org

More information

(2) Explain the addressing mode of OR What do you mean by addressing mode? Explain diff. addressing mode for 8085 with examples.

(2) Explain the addressing mode of OR What do you mean by addressing mode? Explain diff. addressing mode for 8085 with examples. (1) Explain instruction format and Opcode format of 8085 μp with example. OR With help of examples, explain the formation of opcodes of 8085 OR What is an instruction? List type of instruction based on

More information

8051 Microcontrollers

8051 Microcontrollers 8051 Microcontrollers Richa Upadhyay Prabhu NMIMS s MPSTME richa.upadhyay@nmims.edu March 15, 2016 8051 INSTRUCTIONS JUMP, LOOP AND CALL INSTRUCTIONS 8051 INSTRUCTIONS Repeating a sequence of instructions

More information

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram: The CPU and Memory How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram: 1 Registers A register is a permanent storage location within

More information

Instruction Set Instruction set of 8085 can be classified in following groups: Data Transfer Instructions These instructions can perform data transfer operations between Registers of 8085 e.g. MOV 8085

More information

Assembly level Programming. 198:211 Computer Architecture. (recall) Von Neumann Architecture. Simplified hardware view. Lecture 10 Fall 2012

Assembly level Programming. 198:211 Computer Architecture. (recall) Von Neumann Architecture. Simplified hardware view. Lecture 10 Fall 2012 19:211 Computer Architecture Lecture 10 Fall 20 Topics:Chapter 3 Assembly Language 3.2 Register Transfer 3. ALU 3.5 Assembly level Programming We are now familiar with high level programming languages

More information

CSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1

CSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1 CSIS1120A 10. Instruction Set & Addressing Mode CSIS1120A 10. Instruction Set & Addressing Mode 1 Elements of a Machine Instruction Operation Code specifies the operation to be performed, e.g. ADD, SUB

More information

INSTRUCTION SET OF 8085

INSTRUCTION SET OF 8085 INSTRUCTION SET OF 8085 Instruction Set of 8085 An instruction is a binary pattern designed inside a microprocessor to perform a specific function. The entire group of instructions that a microprocessor

More information

Chapter 7 Central Processor Unit (S08CPUV2)

Chapter 7 Central Processor Unit (S08CPUV2) Chapter 7 Central Processor Unit (S08CPUV2) 7.1 Introduction This section provides summary information about the registers, addressing modes, and instruction set of the CPU of the HCS08 Family. For a more

More information

Mark II Aiken Relay Calculator

Mark II Aiken Relay Calculator Introduction to Embedded Microcomputer Systems Lecture 6.1 Mark II Aiken Relay Calculator 2.12. Tutorial 2. Arithmetic and logical operations format descriptions examples h 8-bit unsigned hexadecimal $00

More information

Basic Assembly SYSC-3006

Basic Assembly SYSC-3006 Basic Assembly Program Development Problem: convert ideas into executing program (binary image in memory) Program Development Process: tools to provide people-friendly way to do it. Tool chain: 1. Programming

More information

Microprocessors 1. The 8051 Instruction Set. Microprocessors 1 1. Msc. Ivan A. Escobar Broitman

Microprocessors 1. The 8051 Instruction Set. Microprocessors 1 1. Msc. Ivan A. Escobar Broitman Microprocessors 1 The 8051 Instruction Set Microprocessors 1 1 Instruction Groups The 8051 has 255 instructions Every 8-bit opcode from 00 to FF is used except for A5. The instructions are grouped into

More information

9/25/ Software & Hardware Architecture

9/25/ Software & Hardware Architecture 8086 Software & Hardware Architecture 1 INTRODUCTION It is a multipurpose programmable clock drive register based integrated electronic device, that reads binary instructions from a storage device called

More information

Practical Malware Analysis

Practical Malware Analysis Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the

More information

DR bit RISC Microcontroller. Instructions set details ver 3.10

DR bit RISC Microcontroller. Instructions set details ver 3.10 DR80390 8-bit RISC Microcontroller Instructions set details ver 3.10 DR80390 Instructions set details - 2 - Contents 1. Overview 7 1.1. Document structure. 7 2. Instructions set brief 7 2.1. Instruction

More information

TYPES OF INTERRUPTS: -

TYPES OF INTERRUPTS: - There are 3 types of interrupts. TYPES OF INTERRUPTS: - External Interrupts. Internal Interrupts. Software interrupts. Hardware Interrupts (1) External interrupts come from I/O devices, from a timing device

More information

Intel Instruction Set (gas)

Intel Instruction Set (gas) Intel Instruction Set (gas) These slides provide the gas format for a subset of the Intel processor instruction set, including: Operation Mnemonic Name of Operation Syntax Operation Examples Effect on

More information

Section 001. Read this before starting!

Section 001. Read this before starting! Points missed: Student's Name: Total score: /100 points East Tennessee State University Department of Computer and Information Sciences CSCI 2150 (Tarnoff) Computer Organization TEST 3 for Fall Semester,

More information

Instruction Sets: Characteristics and Functions Addressing Modes

Instruction Sets: Characteristics and Functions Addressing Modes Instruction Sets: Characteristics and Functions Addressing Modes Chapters 10 and 11, William Stallings Computer Organization and Architecture 7 th Edition What is an Instruction Set? The complete collection

More information

reply db y prompt db Enter your favourite colour:, 0 colour db 80 dup(?) i db 20 k db? num dw 4000 large dd 50000

reply db y prompt db Enter your favourite colour:, 0 colour db 80 dup(?) i db 20 k db? num dw 4000 large dd 50000 Declaring Variables in Assembly Language As in Java, variables must be declared before they can be used Unlike Java, we do not specify a variable type in the declaration in assembly language Instead we

More information

8051 Microcontroller Assembly Programming

8051 Microcontroller Assembly Programming 8051 Microcontroller Assembly Programming EE4380 Fall 2002 Class 3 Pari vallal Kannan Center for Integrated Circuits and Systems University of Texas at Dallas Topics Machine code 8051 Addressing Modes

More information

The von Neumann Architecture. IT 3123 Hardware and Software Concepts. The Instruction Cycle. Registers. LMC Executes a Store.

The von Neumann Architecture. IT 3123 Hardware and Software Concepts. The Instruction Cycle. Registers. LMC Executes a Store. IT 3123 Hardware and Software Concepts February 11 and Memory II Copyright 2005 by Bob Brown The von Neumann Architecture 00 01 02 03 PC IR Control Unit Command Memory ALU 96 97 98 99 Notice: This session

More information

Fig: Computer memory with Program, data, and Stack. Blog - NEC (Autonomous) 1

Fig: Computer memory with Program, data, and Stack. Blog -   NEC (Autonomous) 1 Central Processing Unit 1. Stack Organization A useful feature that is included in the CPU of most computers is a stack or last in, first out (LIFO) list. A stack is a storage device that stores information

More information

Programming Model 2 A. Introduction

Programming Model 2 A. Introduction Programming Model 2 A. Introduction Objectives At the end of this lab you should be able to: Use direct and indirect addressing modes of accessing data in memory Create an iterative loop of instructions

More information

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

CSC 2400: Computer Systems. Towards the Hardware: Machine-Level Representation of Programs CSC 2400: Computer Systems Towards the Hardware: Machine-Level Representation of Programs Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32)

More information

8051 Microcontroller

8051 Microcontroller 8051 Microcontroller EE4380 Fall 2001 Pari vallal Kannan Center for Integrated Circuits and Systems University of Texas at Dallas 8051 Architecture Programmer s View Register Set Instruction Set Memory

More information

Digital Blocks Semiconductor IP

Digital Blocks Semiconductor IP 805 SFR Bus Digital Blocks Semiconductor IP 805 Microcontroller Configurable Peripherals General Description The Digital Blocks (Configurable Peripherals) Microcontroller Verilog IP Core is complaint with

More information

Computer Architecture /

Computer Architecture / Computer Architecture 02-201 / 02-601 The Conceptual Architecture of a Computer PC CPU register 0 register 1 register 2 registers hold small amounts of data for processing by the CPU Reading / writing

More information

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers o How to disassemble an MC9S12 instruction sequence o Binary numbers are a code and represent what the programmer intends for the

More information

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers o How to disassemble an MC9S12 instruction sequence o Binary numbers are a code and represent what the programmer intends for the

More information

When an instruction is initially read from memory it goes to the Instruction register.

When an instruction is initially read from memory it goes to the Instruction register. CS 320 Ch. 12 Instruction Sets Computer instructions are written in mnemonics. Mnemonics typically have a 1 to 1 correspondence between a mnemonic and the machine code. Mnemonics are the assembly language

More information

3.0 Instruction Set. 3.1 Overview

3.0 Instruction Set. 3.1 Overview 3.0 Instruction Set 3.1 Overview There are 16 different P8 instructions. Research on instruction set usage was the basis for instruction selection. Each instruction has at least two addressing modes, with

More information

Programming of 8085 microprocessor and 8051 micro controller Study material

Programming of 8085 microprocessor and 8051 micro controller Study material 8085 Demo Programs Now, let us take a look at some program demonstrations using the above instructions Adding Two 8-bit Numbers Write a program to add data at 3005H & 3006H memory location and store the

More information

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

Microprocessor and Assembly Language Week-5. System Programming, BCS 6th, IBMS (2017) Microprocessor and Assembly Language Week-5 System Programming, BCS 6th, IBMS (2017) High Speed Memory Registers CPU store data temporarily in these location CPU process, store and transfer data from one

More information

CSC 8400: Computer Systems. Machine-Level Representation of Programs

CSC 8400: Computer Systems. Machine-Level Representation of Programs CSC 8400: Computer Systems Machine-Level Representation of Programs Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32) 1 Compilation Stages

More information

8085 INSTRUCTION SET INSTRUCTION DETAILS

8085 INSTRUCTION SET INSTRUCTION DETAILS 8085 INSTRUCTION SET INSTRUCTION DETAILS DATA TRANSFER INSTRUCTIONS MOV Rd, Rs Copy from source to destination This instruction copies the contents of the source register Rs into the destination register

More information

MSP430 instruction set *

MSP430 instruction set * OpenStax-CNX module: m23503 1 MSP430 instruction set * Pedro Dinis António Espírito Santo Bruno Ribeiro This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License

More information

CS401 Assembly Language Solved MCQS From Midterm Papers

CS401 Assembly Language Solved MCQS From Midterm Papers CS401 Assembly Language Solved MCQS From Midterm Papers May 14,2011 MC100401285 Moaaz.pk@gmail.com MC100401285@gmail.com PSMD01(IEMS) Question No:1 ( Marks: 1 ) - Please choose one The first instruction

More information

ME 4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 6

ME 4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 6 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics Instructor: Professor Charles Ume LECTURE 6 MC9S12C Microcontroller Covered in Lecture 5: Quick Introduction

More information

UNIT 2 THE 8051 INSTRUCTION SET AND PROGRAMMING

UNIT 2 THE 8051 INSTRUCTION SET AND PROGRAMMING UNIT 2 THE 8051 INSTRUCTION SET AND PROGRAMMING Instructions Alphabetical List of Instructions ACALL: Absolute Call ADD, ADDC: Add Accumulator (With Carry) AJMP: Absolute Jump ANL: Bitwise AND CJNE: Compare

More information

Module 3 Instruction Set Architecture (ISA)

Module 3 Instruction Set Architecture (ISA) Module 3 Instruction Set Architecture (ISA) I S A L E V E L E L E M E N T S O F I N S T R U C T I O N S I N S T R U C T I O N S T Y P E S N U M B E R O F A D D R E S S E S R E G I S T E R S T Y P E S O

More information

Computer Organization & Assembly Language Programming. CSE 2312 Lecture 15 Addressing and Subroutine

Computer Organization & Assembly Language Programming. CSE 2312 Lecture 15 Addressing and Subroutine Computer Organization & Assembly Language Programming CSE 2312 Lecture 15 Addressing and Subroutine 1 Sections in 8088 Code TEXT section, for the processor instructions. DATA section for the initialization

More information

Summer 2003 Lecture 4 06/14/03

Summer 2003 Lecture 4 06/14/03 Summer 2003 Lecture 4 06/14/03 LDS/LES/LSS General forms: lds reg,mem lseg reg,mem Load far pointer ~~ outside of current segment {E.g., load reg w/value @ mem, & seg w/mem+2 XCHG Exchange values General

More information

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI-621213. QUESTION BANK DEPARTMENT: EEE SUB CODE: EE2324 YR/ SEM:III/ VI SUB NAME: MICROPROCESSORS & MICROCONTROLLERS UNIT 2- PROGRAMMING OF 8085 MICROPROCESSORS

More information

Registers. Registers

Registers. Registers All computers have some registers visible at the ISA level. They are there to control execution of the program hold temporary results visible at the microarchitecture level, such as the Top Of Stack (TOS)

More information

Digital Blocks Semiconductor IP

Digital Blocks Semiconductor IP Digital Blocks Semiconductor IP 805 Microcontroller General Description The Digital Blocks Microcontroller Verilog IP Core is complaint with the MCS 5 Instruction Set and contains standard 805 MCU peripherals,

More information

CPU Design John D. Carpinelli, All Rights Reserved 1

CPU Design John D. Carpinelli, All Rights Reserved 1 CPU Design 1997 John D. Carpinelli, All Rights Reserved 1 Outline Register organization ALU design Stacks Instruction formats and types Addressing modes 1997 John D. Carpinelli, All Rights Reserved 2 We

More information

Digital Blocks Semiconductor IP

Digital Blocks Semiconductor IP Digital Blocks Semiconductor IP DB805C-FSM 805 Microcontroller FSM Finite State Machine General Description The Digital Blocks DB805C-FSM IP Core contains Digital Blocks compact DB805C CPU Core & GPIO

More information

Hacettepe University

Hacettepe University MSP430 Teaching Materials Week 3 Further into the MSP430 Hacettepe University Copyright 2009 Texas Instruments All Rights Reserved MSP430MtFaFbMc Mt: Memory Type C: ROM F: Flash P: OTP E: EPROM (for developmental

More information

Machine code. Nils Jansen December 12, 2017

Machine code. Nils Jansen December 12, 2017 Machine code Nils Jansen December 12, 2017 Overview So far Circuits Memory ALU Data Path Fetch-Decode-Execute Cycle Fetch-decode-execute cycle Today Machine code Stack 2 Recap: Execute-phase: Computation

More information

Microcontroller Systems

Microcontroller Systems µcontroller systems 1 / 43 Microcontroller Systems Engineering Science 2nd year A2 Lectures Prof David Murray david.murray@eng.ox.ac.uk www.robots.ox.ac.uk/ dwm/courses/2co Michaelmas 2014 µcontroller

More information

Q. Classify the instruction set of 8051 and list out the instructions in each type.

Q. Classify the instruction set of 8051 and list out the instructions in each type. INTRODUCTION Here is a list of the operands and their meanings: A - accumulator; Rn - is one of working registers (R0-R7) in the currently active RAM memory bank; Direct - is any 8-bit address register

More information

ELEG3924 Microprocessor

ELEG3924 Microprocessor Department of Electrical Engineering University of Arkansas ELEG3924 Microprocessor Ch.2 Assembly Language Programming Dr. Jing Yang jingyang@uark.edu 1 OUTLINE Inside 8051 Introduction to assembly programming

More information

CN310 Microprocessor Systems Design

CN310 Microprocessor Systems Design CN310 Microprocessor Systems Design Instruction Set (AVR) Nawin Somyat Department of Electrical and Computer Engineering Thammasat University Outline Course Contents 1 Introduction 2 Simple Computer 3

More information

MC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes. Summary of HCS12 addressing modes ADDRESSING MODES

MC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes. Summary of HCS12 addressing modes ADDRESSING MODES MC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes o Review of Addressing Modes o Which branch instruction to use (signed vs unsigned) o Using X and Y registers

More information

Chapter 2A Instructions: Language of the Computer

Chapter 2A Instructions: Language of the Computer Chapter 2A Instructions: Language of the Computer Copyright 2009 Elsevier, Inc. All rights reserved. Instruction Set The repertoire of instructions of a computer Different computers have different instruction

More information

ELEG3923 Microprocessor Ch.2 Assembly Language Programming

ELEG3923 Microprocessor Ch.2 Assembly Language Programming Department of Electrical Engineering University of Arkansas ELEG3923 Microprocessor Ch.2 Assembly Language Programming Dr. Jingxian Wu wuj@uark.edu OUTLINE 2 Inside 8051 Introduction to assembly programming

More information

Introduction to Assembly Language Programming (Instruction Set) 1/18/2011 1

Introduction to Assembly Language Programming (Instruction Set) 1/18/2011 1 Introduction to Assembly Language Programming (Instruction Set) 1/18/2011 1 High Level Language Compiler Assembly Language Assembler Machine Code Microprocessor Hardware 1/18/2011 2 8085A Instruction Set

More information

Organization in Memory

Organization in Memory in 16 addresses for sub-routines Is written once prior to initialization, however it can be changed in chunks of 512 bytes during operation two small blocks programmed via scatt.-fl. only 2kB fast RAM

More information

Program Exploitation Intro

Program Exploitation Intro Program Exploitation Intro x86 Assembly 04//2018 Security 1 Univeristà Ca Foscari, Venezia What is Program Exploitation "Making a program do something unexpected and not planned" The right bugs can be

More information

EC2304-MICROPROCESSOR AND MICROCONROLLERS 2 marks questions and answers UNIT-I

EC2304-MICROPROCESSOR AND MICROCONROLLERS 2 marks questions and answers UNIT-I EC2304-MICROPROCESSOR AND MICROCONROLLERS 2 marks questions and answers 1. Define microprocessors? UNIT-I A semiconductor device(integrated circuit) manufactured by using the LSI technique. It includes

More information

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad Introduction to MS-DOS Debugger DEBUG In this laboratory, we will use DEBUG program and learn how to: 1. Examine and modify the contents of the 8086 s internal registers, and dedicated parts of the memory

More information

Arithmetic and Logic Instructions And Programs

Arithmetic and Logic Instructions And Programs Dec Hex Bin 3 3 00000011 ORG ; FOUR Arithmetic and Logic Instructions And Programs OBJECTIVES this chapter enables the student to: Demonstrate how 8-bit and 16-bit unsigned numbers are added in the x86.

More information

2. Arithmetic Instructions addition, subtraction, multiplication, divison (HCS12 Core Users Guide, Sections 4.3.4, and ).

2. Arithmetic Instructions addition, subtraction, multiplication, divison (HCS12 Core Users Guide, Sections 4.3.4, and ). AS12 Assembler Directives A Summary of 9S12 instructions Disassembly of 9S12 op codes Huang Section 1.8, Chapter 2 MC9S12 V1.5 Core User Guide Version 1.2, Section 12 o A labels is a name assigned the

More information

2. ADDRESSING METHODS

2. ADDRESSING METHODS 2 Addressing Methods STUDY MATERIALS ON COMPUTER ORGANIZATION (As per the curriculum of Third semester BSc Electronics of Mahatma Gandh Uniiversity) Compiled by Sam Kollannore U Lecturer in Electronics

More information

MICROPROCESSOR PROGRAMMING AND SYSTEM DESIGN

MICROPROCESSOR PROGRAMMING AND SYSTEM DESIGN MICROPROCESSOR PROGRAMMING AND SYSTEM DESIGN ROAD MAP SDK-86 Intel 8086 Features 8086 Block Diagram 8086 Architecture Bus Interface Unit Execution Unit 8086 Architecture 8086 Programmer s Model Flag Register

More information

Computer System Architecture

Computer System Architecture CSC 203 1.5 Computer System Architecture Department of Statistics and Computer Science University of Sri Jayewardenepura Addressing 2 Addressing Subject of specifying where the operands (addresses) are

More information

THE MICROPROCESSOR Von Neumann s Architecture Model

THE MICROPROCESSOR Von Neumann s Architecture Model THE ICROPROCESSOR Von Neumann s Architecture odel Input/Output unit Provides instructions and data emory unit Stores both instructions and data Arithmetic and logic unit Processes everything Control unit

More information

Section 001. Read this before starting!

Section 001. Read this before starting! Points missed: Student's Name: Total score: /100 points East Tennessee State University -- Department of Computer and Information Sciences CSCI 2150 Computer Organization Final Exam for Spring Semester,

More information

Read this before starting!

Read this before starting! Points missed: Student's Name: Total score: /100 points East Tennessee State University Department of Computer and Information Sciences CSCI 2150 (Tarnoff) Computer Organization TEST 3 for Fall Semester,

More information

Question Bank Part-A UNIT I- THE 8086 MICROPROCESSOR 1. What is microprocessor? A microprocessor is a multipurpose, programmable, clock-driven, register-based electronic device that reads binary information

More information

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud. Chapter 1 Microprocessor architecture ECE 3130 Dr. Mohamed Mahmoud The slides are copyright protected. It is not permissible to use them without a permission from Dr Mahmoud http://www.cae.tntech.edu/~mmahmoud/

More information

CC411: Introduction To Microprocessors

CC411: Introduction To Microprocessors CC411: Introduction To Microprocessors OBJECTIVES this chapter enables the student to: Describe the Intel family of microprocessors from 8085 to Pentium. In terms of bus size, physical memory & special

More information

BAHAR DÖNEMİ MİKROİŞLEMCİLER LAB4 FÖYÜ

BAHAR DÖNEMİ MİKROİŞLEMCİLER LAB4 FÖYÜ LAB4 RELATED INSTRUCTIONS: Compare, division and jump instructions CMP REG, memory memory, REG REG, REG memory, immediate REG, immediate operand1 - operand2 Result is not stored anywhere, flags are set

More information

Section 002. Read this before starting!

Section 002. Read this before starting! Points missed: Student's Name: _ Total score: /100 points East Tennessee State University -- Department of Computer and Information Sciences CSCI 2150 Computer Organization Final Exam for Fall Semester,

More information

Chapter. Computer Architecture

Chapter. Computer Architecture Chapter 4 Computer Architecture Figure 4.1 Input device Central processing unit Main memory Output device Bus Data flow Control Figure 4.2 Central processing unit () Status bits ( ) Accumulator ( ) Index

More information

COS 140: Foundations of Computer Science

COS 140: Foundations of Computer Science COS 140: Foundations of Computer Science CPU Organization and Assembly Language Fall 2018 CPU 3 Components of the CPU..................................................... 4 Registers................................................................

More information