And conditional branching

Slides:



Advertisements
Similar presentations
COMP3221: Microprocessors and Embedded Systems
Advertisements

Microprocessors.
Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU
ACOE2511 Assembly Language Arithmetic and Logic Instructions.
TK 2633 Microprocessor & Interfacing
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Ch. 5 from Yu & Marut. Registers 14(16-bit) registers: 1.Data reg. – to hold data for an op. 2.Address reg – to hold addr of an instruction or data.
Khaled A. Al-Utaibi  Introduction  Arithmetic Instructions  Basic Logical Instructions  Shift Instructions  Rotate Instructions.
Model Computer CPU Arithmetic Logic Unit Control Unit Memory Unit
ECE 447: Lecture 12 Logic, Arithmetic, Data Test and Control Instructions of MC68HC11.
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 8.
3.4 Addressing modes Specify the operand to be used. To generate an address, a segment register is used also. Immediate addressing: the operand is a number.
Introduction to Computer Organization and Assembly Language
ECE 447: Lecture 11 Introduction to Programming in Assembly Language.
Computer Science 210 Computer Organization Machine Language Instructions: Control.
8085 Microprocessor Architecture
Unit 1 Instruction set M.Brindha AP/EIE
COMP2121: Microprocessors and Interfacing
CHAPTER 9 COMPUTER ARITHMETIC - ALU
Status Register Status = system byte (supervisor only) + user byte = system status + condition code register usually, it is not important to know.
Control Unit Lecture 6.
Overview of Architecture Assembly Programming Concepts
Homework Reading Labs PAL, pp
ECE 3430 – Intro to Microcomputer Systems
ARM Registers Register – internal CPU hardware device that stores binary data; can be accessed much more rapidly than a location in RAM ARM has.
3.Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV
Addition of Signed Numbers
8086 Microprocessor.
ICS312 SET 7 Flags.
Lecture Set 5 The 8051 Instruction Set.
ECE 3430 – Intro to Microcomputer Systems
The FLAGS Register An x bit means an unidentified value 9/12/2018
Assembly Language for Intel-Based Computers, 5th Edition
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Microcomputer Programming
8085 microprocessor.
Intel 8088 (8086) Microprocessor Structure
Data Processing Instructions
Microcomputer & Interfacing Lecture 1
CS-401 Assembly Language Programming
COMP3221: Microprocessors and Embedded Systems
Arithmetic and Logic Chapter 5
Computer Science 210 Computer Organization
Processor Organization and Architecture
Chapter 5 The LC-3.
Memory Organisation Source: under
LC-3 Details and Examples
Lecture 4 ( Assembly Language).
Arithmetic operations Programming
Flags Register & Jump Instruction
Computer Science 210 Computer Organization
Introduction to Assembly Chapter 2
Chapter 5 The LC-3.
Intel 8088 (8086) Microprocessor Structure
Computer Science 210 Computer Organization
Introduction to Computer Engineering
Addressing Modes Register Direct, with 1 and 2 registers I/O Direct
Tim Sumner, Imperial College, Rm: 1009, x47552
ECE 3430 – Intro to Microcomputer Systems
University of Gujrat Department of Computer Science
Introduction to Assembly Chapter 2
CNET 315 Microprocessor & Assembly Language
A 1-Bit Arithmetic Logic Unit
Arithmetic and Logic Chapter 5
March 2006 Saeid Nooshabadi
Branching instructions
Central Processing Unit.
Computer Operation 6/22/2019.
Embedded Systems- Instruct set
Ch. 5 – Intel 8086 – study details from Yu & Marut
Presentation transcript:

And conditional branching Status Register And conditional branching CS-280 Dr. Mark L. Hornick

RJMP is an Unconditional Branch instruction RJMP <addr> <addr> must be gt -2048 and lt 2047 i.e. RJMP can branch to addresses relative to the current instruction 12 bits (bits 0-11) are used for the address These bits represent a signed value So bit 11 (s) represents the sign bit 1100 sbbb bbbb bbbb CS-280 Dr. Mark L. Hornick

JMP is another Unconditional Branch instruction JMP <addr> <addr> is an absolute program address i.e. JMP can branch to any absolute address between 0 and 4M JMP is a 32-bit (2-word) instruction 22 bits are used for the address These bits represent an unsigned value 1001 010b bbbb 110b bbbb bbbb bbbb bbbb CS-280 Dr. Mark L. Hornick

SREG is a special-purpose register that indicates the status of the last instruction executed by the ALU These bits are altered automatically by the ALU with each instruction executed. But you can set or clear them explicitly (e.g. use SEH, CLH to set/clear the H flag) CS-280 Dr. Mark L. Hornick

Example: if a register is decremented and the result is 0, the Zero bit (Z) is set by the ALU LDI R20, 1 ;initialize R20 to 1 DEC R20 ;decrement by 1 Z is set if the result of last operation is 0 (if all bits are 0) CS-280 Dr. Mark L. Hornick

Example: if two registers are added together and the unsigned result > 255, the Carry bit (C) is set by the ALU C is set to 1 if: addition generates a carry subtraction produces a borrow shift or rotate shifts out a 1 LDI R20, 0x80 ; 1000 0000 LDI R21, 0x80 ; 1000 0000 ADD R20, R21 ;1 0000 0000 CS-280 Dr. Mark L. Hornick

Example: if two registers are added together and bit 7 in the result is set to 1, the Negative bit (N) is set by the ALU N is set whenever bit 7 is 1 LDI R20, 0x80 ; 0100 0011 LDI R21, 0x80 ; 0100 0101 ADD R20, R21 ; 1000 1000 CS-280 Dr. Mark L. Hornick

Example: if two registers containing signed values are added together and bit 7 in the result changes, the two’s-complement overflow bit (V) is set by the ALU V is set to1 if: positive + positive = negative negative + negative = positive Example: 60 + 70 = 130 (>127) LDI R20, 0x80 ; 0011 1100 LDI R21, 0x80 ; 0100 0110 ADD R20, R21 ; 1000 0010 CS-280 Dr. Mark L. Hornick

The status of the bits in SREG are used in Conditional Branch instructions Demo CS-280 Dr. Mark L. Hornick

Conditional Branch instructions that execute according to the settings of the SREG bits Taken from AVR_Instruction_Set.pdf CS-280 Dr. Mark L. Hornick