Arithmetic operations Programming

Slides:



Advertisements
Similar presentations
Microprocessors.
Advertisements

Conversion and Coding (12)10.
MOV Instruction MOV destination, source ; copy source to dest. MOV A,#55H ;load value 55H into reg. A MOV R0,A ;copy contents of A into R0 ;(now A=R0=55H)
Arithmetic in Computers Chapter 4 Arithmetic in Computers2 Outline Data representation integers Unsigned integers Signed integers Floating-points.
2.3) Example of program execution 1. instruction  B25 8 Op-code B means to change the value of the program counter if the contents of the indicated register.
EECC250 - Shaaban #1 lec #14 Winter Binary Coded Decimal (BCD) Arithmetic Binary Coded Decimal (BCD) is a way to store decimal numbers.
ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS
Binary Addition Rules Adding Binary Numbers = = 1
King Fahd University of Petroleum and Minerals
Assembly Language for Intel-Based Computers Chapter 2: IA-32 Processor Architecture Kip Irvine.
1.6 Signed Binary Numbers.
The M68HC11 Basic Instruction Set Basic Arithmetic Instructions
Binary Addition Addition Rules: = = = = = carry 1 1 carry 1 Example 1: Example 2:
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
Simple Data Type Representation and conversion of numbers
Data Representation – Binary Numbers
The 8051 Microcontroller and Embedded Systems
Conversion Between Lengths Positive number pack with leading zeros +18 = = Negative numbers pack with leading ones -18 =
How Computers Work Dr. John P. Abraham Professor UTPA.
Binary Arithmetic & Data representation
Digital Logic Design Lecture 3 Complements, Number Codes and Registers.
Embedded System Spring, 2011 Lecture 10: Arithmetic, Logic Instruction and Programs Eng. Wazen M. Shbair.
Mohammad Amin Kuhail M.Sc. (York, UK) University of Palestine Faculty of Engineering and Urban planning Software Engineering Department Digital Logic Design.
Cosc 2150: Computer Organization Chapter 2 Part 1 Integers addition and subtraction.
Positional Number Systems
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
ECE 447: Lecture 12 Logic, Arithmetic, Data Test and Control Instructions of MC68HC11.
 Lecture 2 Processor Organization  Control needs to have the  Ability to fetch instructions from memory  Logic and means to control instruction sequencing.
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design Slide 1 of 14.
Outline Binary Addition 2’s complement Binary Subtraction Half Adder
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Fri, Aug 28 CEC 220 Digital Circuit Design Slide 1 of 14.
Microcontroller Fundamentals & Programming Arithmetic Instructions.
DIGITAL SYSTEMS Number systems & Arithmetic Rudolf Tracht and A.J. Han Vinck.
CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS.
Execution Architecture MTT CPU08 Core M CPU08 INTRODUCTION.
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 8 Dr. Shi Dept. of Electrical and Computer Engineering.
Chapter 8 Computer Arithmetic. 8.1 Unsigned Notation Non-negative notation  It treats every number as either zero or a positive value  Range: 0 to 2.
Nguyen Le CS147.  2.4 Signed Integer Representation  – Signed Magnitude  – Complement Systems  – Unsigned Versus Signed Numbers.
COSC2410: LAB 2 BINARY ARITHMETIC SIGNED NUMBERS FLOATING POINT REPRESENTATION BOOLEAN ALGEBRA 1.
11001 / 101, / ) Perform subtraction on the given unsigned binary numbers using the 2's complement of the subtrahend. Where the result.
Unit I From Fundamentals of Logic Design by Roth and Kinney.
Cosc 2150: Computer Organization
Sistem Bilangan Oleh : Sri Heranurweni.
Array multiplier TU/e Processor Design 5Z032.
Addressing Modes in Microprocessors
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.
ECE 3430 – Intro to Microcomputer Systems
Integer Real Numbers Character Boolean Memory Address CPU Data Types
11001 / 101 , / ) Perform subtraction on the given unsigned binary numbers using the 2's complement of the subtrahend. Where the.
Chapter 3 Data Representation
Number Systems.
Exercise: Add these two single precision IEEE 754 numbers: … …0 Left number: 1.101x24 Right number: 1.011x 22= x24.
Memory Organisation Source: under
Integers in 2’s compliment Floating point
Chapter 11 © 2011, The McGraw-Hill Companies, Inc.
The University of Adelaide, School of Computer Science
And conditional branching
CS 101 – Sept. 4 Number representation Integer Unsigned √ Signed √
C1 Number systems.
CNET 315 Microprocessor & Assembly Language
Chapter 6: Computer Arithmetic
Numbers representations
ECE 331 – Digital System Design
ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS
CSC 220: Computer Organization Signed Number Representation
COMS 161 Introduction to Computing
Negative Bit Representation Outline
Computer Organization and Assembly Language
Presentation transcript:

Arithmetic operations Programming Representation of digits in micro-processing systems 8-bit two’s complement Binary sign Binary value Decimal sign Decimal value 1111 1111 (max) + 255 0000 0001 (min) 1 0000 0000 1111 1111 (min) - 0000 0000 (max) 256

Addition and Subtraction Concept of Carry / Borrow bit: 9-th bit in 8-bit “Add” or “Subtract “operations or 17-th bit in 16-bit “Add” or “Subtract” operations is considered as a special C-bit (C-flag) in Condition Code Register (CCR) + $ 99 1001 1001 + $ 39 0011 1001 + 57 - - + $ 74 0111 0100 + $ 74 0111 0100 + 116 + $ 99 1001 1001 + $ 39 0011 1001 + + + $ 74 1 1000 1011+1 + $ 74 1 1000 1011+1 + $ 25 1 0010 0101 - $ C5 1 1100 0101 - $C5 = 0011 1010+1 - 59

Programming the Subtraction operation Org $1500 ; Starting address of the program LDAA # $ 39 ; Load BCD digit $39 (0011 1001) SBCA # $ 74 ; Subtract BCD $ 74 (0111 0100) STAA $1001 ; Store the result in address $1001 END Please read pp. 50 to 60: “Multi-precision operations, BCD operations and Multiplication & Division operations. Read example programs.

Condition Code Register (CCR) Condition code Register (CCR) is special purpose register which contains set of flags indicating conditions of the operation recently executed Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 H N Z V C Bit 0: C-bit => Carry Flag Bit 1: V-bit => Overflow Flag. Whenever result of a two’s compliment operation is out of range V=1 Bit 2: Z-bit => Zero Flag. Whenever result is 0 than Z=1, otherwise Z=0 Bit 3: N-bit => Whenever the most significant bit of the result of operation is = 1, than N=1, Otherwise, N=0 Bit 5: H-bit => Half-carry flag is carry flag for lower 4-bits to the upper 4 bits.

Program Loops Loop is program element for repetitive operation with determined segment of algorithm. Definition 1: Finite loop a sequence of instructions that will be executed for finite number of times Definition2: Endless loop a sequence of instructions that will be executed forever if started (until power off)

Program Loops Loop is program element for repetitive operation with determined segment of algorithm. Definition 1: Finite loop a sequence of instructions that will be executed for finite number of times Definition2: Endless loop a sequence of instructions that will be executed forever if started (until power off)