# Lab 4 Large Number Arithmetic. ECE 375 Oregon State University Page 29

Save this PDF as:

Size: px
Start display at page:

Download "Lab 4 Large Number Arithmetic. ECE 375 Oregon State University Page 29"

## Transcription

1 Lab 4 Large Number Arithmetic ECE 375 Oregon State University Page 29

3 (1) (1) Possible Carry-In Bit R0 R1 Possible Carry-Out Bit (1) R2 R R4 R5 R6 As this calculation demonstrates, we need to add R1 to R3 and accommodate for any carry-in bit. The result of this operation is stored in R6. Next, we add R0 to R2 and accommodate for any carry-in bit from the previous operation. If there is a final carry-bit, then it is stored in R4. Note that since we want to reserve the carry out bit from the operation, we actually get a 17-bit result: 16-bit plus the carry. But since the AVR architecture inherently supports 8-bit numbers and we use 3 registers, we treat the result as a 24-bit number, where the most significant byte has the value of either 1 or 0 depending on the carry out bit. The AVR instruction set contains a special instruction to perform multiplication, MUL. This instruction multiplies two registers and stores the result in registers R0 and R1. Therefore a multiplication of 2 single byte registers generates a 2-byte result. This instruction can be used as a fast and efficient way to multiply two 8-bit numbers. Unfortunately, it can be very complicated to use when multiplying 16 or more bit numbers. The easiest way to understand how to multiply large numbers is to visualize it like using the paper method to multiply, this method is also known as the sum of products technique. The following figure illustrates the typical paper method. 24 * (4x6=24) 12- (2x6=12, shifted by one) 28- (4x7=28, shifted by one) (2x7=14, shifted by two) ECE 375 Oregon State University Page 31

4 As you can see, the paper method multiplies small numbers (numbers less than 10) and then adds all the products to get the final result. We can use this same technique for large binary numbers. Since there is an instruction that supports multiply, MUL, we can multiply two 8-bit numbers at a time and then add up all the products. Below is an example of how to multiple two 16-bit numbers. A1 A2 * B1 B2 -- H22 L22 H21 L21 H12 L12 + H11 L11 -- P1 P2 P3 P4 As you can see, the result of multiplying two 16-bit (or 2 byte) numbers gives a 32-bit (or 4 byte) result. In general, when multiplying to binary numbers, the result will be twice the size of the operands. For reference, the H and the L signify the high and low byte of the result of each multiplication and numbers signify which values where multiplied, B and A. For example, L21 is the resulting low byte of multiplying B2 and A1 together. Also note that the four results are just the following: P1 <= H11 + carry from P2 P2 <= H21 + H12 + L11 + carry from P3 P3 <= H22 + L21 + L12 P4 <= L22 The skeleton code provided for the lab will contain an algorithm that multiplies 2 16-bit numbers in the fashion described above. You will need to expand on this function for the lab assignment. Assignment Write a program in AVR Assembly that calculates the result of (A + B)^2. A and B are 16-bit numbers or 2 bytes, thus A + B will produce a 3-byte result since we want to save the carry bit. That result will then be ECE 375 Oregon State University Page 32

6 Referring back to the basic concepts of mathematics, multiplication has two operands, the multiplicand (or the operand to be multiplied) and the multiplier. When a decimal number is multiplied, it essentially adds the multiplicand to itself for the amount specified by the multiplier. This seems pretty obvious, until you use binary. In binary, the multiplier is used to determine whether the multiplicand is added or not. The figure below will demonstrate both decimal and binary multiplications. Decimal: 23 Multiplicand * 16 Multiplier * 32 = * 23 = 23 and then shift 23 left one = Final Multiplication Product Now, we apply this same knowledge to a binary system that uses 4-bit values. The basic principle is that we shift through the multiply. When a 1 is received, we add the multiplicand to the low bit of the result, if a zero is received we do nothing. We then shift the entire result one bit to the left, thus essentially multiplying the result by 2 and repeat the process. Below is an example. ECE 375 Oregon State University Page 34

7 Binary(4-bit): 1011 Multiplicand * 1101 Multiplier Multiplier (LSB) * 1011 =1011; 1011 shift left zero = * 1011 =0000; 0000 shift left one = Add results together * 1011 =1011; 1011 shift left two = Add results together (MSB) * 1011 =1011; 1011 shift left three = Add results together to get final product Proof: Multiplicand Multiplier Product Bin 1011 * 1101 = Dec 11 * 13 = 143 Correct Although the method above is sound and easily understandable, there is a more efficient method. For the purpose of this example, assume you are running on a 4-bit system where the registers are 4-bits. It would take 4 registers to do the method above. A better way would be to share the low result registers with the multiplier registers so you can shift all the registers at once and only use 3 registers. In order to do this, you would shift everything to the right instead of to the left and also rotate through the carry. So if the carry bit is set after the shift, add the multiplicand to the high register of the result and shift again; otherwise, just shift. Note that when shifting to the right, you need to rotate through the carry; this means that whatever is in the carry bit will be shifted in the most significant bit and the least significant bit will be shifted out into the carry bit. For example: C MSB LSB C Rotate Right Through Carry Bit ECE 375 Oregon State University Page 35

8 The following figure demonstrates this: Multiply 1011 Multiplicand * 1101 Multiplier Carry Load Multiplier into low register Shift right through carry 1011 Carry is set, so add multiplicand Result of addition Shift right through carry Don t add since carry is Result thus far Shift right through carry 1011 Add multiplicand since carry is set Result of carry Rotate right through carry 1011 Add multiplicand since carry is set Result of addition Result after final shift, note that a 1 was shifted in, because it was the carry that was set from the last addition. As you can see, the shift and add technique can be easily created with a simple for loop that loops a specific amount of times depending on the size of the data, for the case above we used 4-bit numbers so we looped 4 times. In the loop there is a simple rotate left and an add depending on the carry bit. This technique can be easily used for any sized number with minimal effort and is used internally for multiplications with most micro architectures. ECE 375 Oregon State University Page 36

### Computer Organization and Architecture

Computer Organization and Architecture Chapter 9 Computer Arithmetic Arithmetic & Logic Unit Performs arithmetic and logic operations on data everything that we think of as computing. Everything else in

### CS201: Architecture and Assembly Language

CS201: Architecture and Assembly Language Lecture Three Brendan Burns CS201: Lecture Three p.1/27 Arithmetic for computers Previously we saw how we could represent unsigned numbers in binary and how binary

### Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

ECE Department Summer LECTURE #5: Number Systems EEL : Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz Decimal Number System: -Our standard number system is base, also

### 5. Arithmetic and Logic Functions

5. Arithmetic and Logic Functions Background Arithmetic, shift/rotate, and logical operations are included in every microprocessor instruction set. This lab examines the x86 capabilities in these areas.

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

CS 16: Assembly Language Programming for the IBM PC and Compatibles First, a little about you Your name Have you ever worked with/used/played with assembly language? If so, talk about it Why are you taking

### (Refer Slide Time: 00:01:16 min)

Digital Computer Organization Prof. P. K. Biswas Department of Electronic & Electrical Communication Engineering Indian Institute of Technology, Kharagpur Lecture No. # 04 CPU Design: Tirning & Control

### TECH. Arithmetic & Logic Unit. CH09 Computer Arithmetic. Number Systems. ALU Inputs and Outputs. Binary Number System

CH09 Computer Arithmetic CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer Representation Integer Arithmetic Floating-Point Representation

### Integer multiplication

Integer multiplication Suppose we have two unsigned integers, A and B, and we wish to compute their product. Let A be the multiplicand and B the multiplier: A n 1... A 1 A 0 multiplicand B n 1... B 1 B

### A Short Introduction to Binary Numbers

A Short Introduction to Binary Numbers Brian J. Shelburne Department of Mathematics and Computer Science Wittenberg University 0. Introduction The development of the computer was driven by the need to

### Lecture 8: ARM Arithmetic and Bitweise Instructions

Lecture 8: ARM Arithmetic and Bitweise Instructions CSE 30: Computer Organization and Systems Programming Winter 2014 Diba Mirza Dept. of Computer Science and Engineering University of California, San

### Integer Numbers. The Number Bases of Integers Textbook Chapter 3

Integer Numbers The Number Bases of Integers Textbook Chapter 3 Number Systems Unary, or marks: /////// = 7 /////// + ////// = ///////////// Grouping lead to Roman Numerals: VII + V = VVII = XII Better:

### Arithmetic Circuits Addition, Subtraction, & Multiplication

Arithmetic Circuits Addition, Subtraction, & Multiplication The adder is another classic design example which we are obliged look at. Simple decimal arithmetic is something which we rarely give a second

### COMPUTER ARCHITECTURE. ALU (2) - Integer Arithmetic

HUMBOLDT-UNIVERSITÄT ZU BERLIN INSTITUT FÜR INFORMATIK COMPUTER ARCHITECTURE Lecture 11 ALU (2) - Integer Arithmetic Sommersemester 21 Leitung: Prof. Dr. Miroslaw Malek www.informatik.hu-berlin.de/rok/ca

### Chapter 6 Digital Arithmetic: Operations & Circuits

Chapter 6 Digital Arithmetic: Operations & Circuits Chapter 6 Objectives Selected areas covered in this chapter: Binary addition, subtraction, multiplication, division. Differences between binary addition

### Here 4 is the least significant digit (LSD) and 2 is the most significant digit (MSD).

Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26

### Binary Representation and Computer Arithmetic

Binary Representation and Computer Arithmetic The decimal system of counting and keeping track of items was first created by Hindu mathematicians in India in A.D. 4. Since it involved the use of fingers

### Unit 5 Central Processing Unit (CPU)

Unit 5 Central Processing Unit (CPU) Introduction Part of the computer that performs the bulk of data-processing operations is called the central processing unit (CPU). It consists of 3 major parts: Register

### 8051 Programming. The 8051 may be programmed using a low-level or a high-level programming language.

8051 Programming The 8051 may be programmed using a low-level or a high-level programming language. Low-Level Programming Assembly language programming writes statements that the microcontroller directly

### Binary. ! You are probably familiar with decimal

Arithmetic operations in assembly language Prof. Gustavo Alonso Computer Science Department ETH Zürich alonso@inf.ethz.ch http://www.inf.ethz.ch/department/is/iks/ Binary! You are probably familiar with

### Chapter 1 Basic Concepts

Chapter 1 Basic Concepts 1.1 Welcome to Assembly Language 1 1.1.1 Good Questions to Ask 2 1.1.2 Assembly language Applications 5 1.1.3 Section Review 6 1.2 Virtual Machine Concept 7 1.2.1 History of PC

### 1 Number System (Lecture 1 and 2 supplement)

1 Number System (Lecture 1 and 2 supplement) By Dr. Taek Kwon Many different number systems perhaps from the prehistoric era have been developed and evolved. Among them, binary number system is one of

### Lecture 8: Binary Multiplication & Division

Lecture 8: Binary Multiplication & Division Today s topics: Addition/Subtraction Multiplication Division Reminder: get started early on assignment 3 1 2 s Complement Signed Numbers two = 0 ten 0001 two

### Binary Multiplication. CMPE 325 Computer Architecture II. Implementing Multiplication. Multiplication. Solution #1. Solution #1: Operations

CMPE 5 Computer Architecture II Cem Ergün Eastern Mediterranean University Binary Multiplication At each step we multiply the multiplicand by a single digit from the multiplier. In binary, we multiply

### Simulation & Synthesis Using VHDL

Floating Point Multipliers: Simulation & Synthesis Using VHDL By: Raj Kumar Singh - B.E. (Hons.) Electrical & Electronics Shivananda Reddy - B.E. (Hons.) Electrical & Electronics BITS, PILANI Outline Introduction

### Let s put together a Manual Processor

Lecture 14 Let s put together a Manual Processor Hardware Lecture 14 Slide 1 The processor Inside every computer there is at least one processor which can take an instruction, some operands and produce

### Digital Electronics. 1.0 Introduction to Number Systems. Module

Module 1 www.learnabout-electronics.org Digital Electronics 1.0 Introduction to What you ll learn in Module 1 Section 1.0. Recognise different number systems and their uses. Section 1.1 in Electronics.

### 1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12

C5 Solutions 1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12 To Compute 0 0 = 00000000 To Compute 1 Step 1. Convert 1 to binary 00000001 Step 2. Flip the bits 11111110

### what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

Inside the CPU how does the CPU work? what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored? some short, boring programs to illustrate the

### NUMBERING SYSTEMS C HAPTER 1.0 INTRODUCTION 1.1 A REVIEW OF THE DECIMAL SYSTEM 1.2 BINARY NUMBERING SYSTEM

12 Digital Principles Switching Theory C HAPTER 1 NUMBERING SYSTEMS 1.0 INTRODUCTION Inside today s computers, data is represented as 1 s and 0 s. These 1 s and 0 s might be stored magnetically on a disk,

### Chapter 4. Arithmetic for Computers

Chapter 4 Arithmetic for Computers Arithmetic Where we've been: Performance (seconds, cycles, instructions) What's up ahead: Implementing the Architecture operation a b 32 32 ALU 32 result 2 Constructing

### Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

Decimal Division Remember 4th grade long division? 43 // quotient 12 521 // divisor dividend -480 41-36 5 // remainder Shift divisor left (multiply by 10) until MSB lines up with dividend s Repeat until

### Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 1: Basic Concepts. Chapter Overview. Welcome to Assembly Language

Assembly Language for Intel-Based Computers, 4 th Edition Kip R. Irvine Chapter 1: Basic Concepts Slides prepared by Kip R. Irvine Revision date: 10/27/2002 Chapter corrections (Web) Printing a slide show

### Integer Multiplication and Division

6 Integer Multiplication and Division 6.1 Objectives After completing this lab, you will: Understand binary multiplication and division Understand the MIPS multiply and divide instructions Write MIPS programs

### Computer Science 281 Binary and Hexadecimal Review

Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two

### CS-208 Computer Architecture

CS-208 Computer Architecture Lecture 5 Computer Arithmetic II: Shifters & Multipliers Fall 2014 Prof. Babak Falsafi parsa.epfl.ch/courses/cs208/ Adapted from slides originally developed by Profs. Hill,

### Binary Numbers Again. Binary Arithmetic, Subtraction. Binary, Decimal addition

Binary Numbers Again Recall than N binary digits (N bits) can represent unsigned integers from 0 to 2 N -1. 4 bits = 0 to 15 8 bits = 0 to 255 16 bits = 0 to 65535 Besides simply representation, we would

### Notes on Assembly Language

Notes on Assembly Language Brief introduction to assembly programming The main components of a computer that take part in the execution of a program written in assembly code are the following: A set of

### Assembly Language Lab # 9 Shift,Rotate,Multiplication and Division Instruction

Faculty of Engineering Computer Engineering Department Islamic University of Gaza Assembly Language Lab # 9 Shift,Rotate,Multiplication and Division Instruction Eng. Alaa.I.Haniya Assembly Language Fundamentals

### Assembly Language Instructions

Experiment 4 Assembly Language Instructions Lab Objective In this lab, we will learn some basic ARM assembly language instructions and write a simple programs in assembly language. ARM Assembly Instructions

### CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

CS101 Lecture 26: Low Level Programming John Magee 30 July 2013 Some material copyright Jones and Bartlett 1 Overview/Questions What did we do last time? How can we control the computer s circuits? How

### Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Digital Logic II May, I before starting the today s lecture

### 3D1 / Microprocessor Systems I. Binary Arithmetic. Binary Arithmetic. Addition

3D / Microprocessor Systems I Addition 7 6 33 22 Carry 3D / Microprocessor Systems I What happens if we run out of digits? Adding two numbers each stored in byte (8 bits) may produce a 9-bit result 8 bits

### NUMBER REPRESENTATIONS IN THE COMPUTER for COSC 120

NUMBER REPRESENTATIONS IN THE COMPUTER for COSC 120 First, a reminder of how we represent base ten numbers. Base ten uses ten (decimal) digits: 0, 1, 2,3, 4, 5, 6, 7, 8, 9. In base ten, 10 means ten. Numbers

### 198:211 Computer Architecture

198:211 Computer Architecture Topics: Lecture 8 & 9 Fall 2012 Integer Arithmetic Chapter 2.3 Overflow Integer Multiplication and Division Integer Arithmetic In a computer, all numbers are represented with

### Fixed-Point Arithmetic

Fixed-Point Arithmetic Fixed-Point Notation A K-bit fixed-point number can be interpreted as either: an integer (i.e., 20645) a fractional number (i.e., 0.75) 2 1 Integer Fixed-Point Representation N-bit

### Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 1: Basic Concepts

Assembly Language for Intel-Based Computers, 4 th Edition Kip R. Irvine Chapter 1: Basic Concepts Slides prepared by Kip R. Irvine Revision date: 07/21/2002 Chapter corrections (Web) Assembly language

### ORG ; ZERO. Introduction To Computing

Dec 0 Hex 0 Bin 00000000 ORG ; ZERO Introduction To Computing OBJECTIVES this chapter enables the student to: Convert any number from base 2, base 10, or base 16 to any of the other two bases. Add and

### COMPUTER ARCHITECTURE IT0205

COMPUTER ARCHITECTURE IT0205 M.Thenmozhi/Kayalvizhi Jayavel/M.B.Panbu Asst.Prof.(Sr.G)/Asst.Prof.(Sr.G)/Asst.Prof.(O.G) Department of IT SRM University, Kattankulathur 1 Disclaimer The contents of the

### Decimal to Binary Conversion

Decimal to Binary Conversion A tool that makes the conversion of decimal values to binary values simple is the following table. The first row is created by counting right to left from one to eight, for

### Chapter 4. Computer Arithmetic

Chapter 4 Computer Arithmetic 4.1 Number Systems A number system uses a specific radix (base). Radices that are power of 2 are widely used in digital systems. These radices include binary (base 2), quaternary

### Introduction ToNumber Systems

Introduction ToNumber Systems Collected by: Zainab Alkadhem Page 1 of 25 Digital systems have such a prominent role in everyday life that we refer to the present technological period as the digital age.

### Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1

Divide: Paper & Pencil Computer Architecture ALU Design : Division and Floating Point 1001 Quotient Divisor 1000 1001010 Dividend 1000 10 101 1010 1000 10 (or Modulo result) See how big a number can be

### Data Representation Binary Numbers

Data Representation Binary Numbers Integer Conversion Between Decimal and Binary Bases Task accomplished by Repeated division of decimal number by 2 (integer part of decimal number) Repeated multiplication

### CHAPTER 3 Number System and Codes

CHAPTER 3 Number System and Codes 3.1 Introduction On hearing the word number, we immediately think of familiar decimal number system with its 10 digits; 0,1, 2,3,4,5,6, 7, 8 and 9. these numbers are called

### Computer Organization I. Lecture 3: von Neumann Architecture (Part I) von Neumann Architecture

Computer Organization I Lecture 3: von Neumann Architecture (Part I) von Neumann Architecture Overview General Architecture of von Neumann Machine - Memory Subsystem; - Arithmetic Logic Unit; - Control

### Compiler Lab: Generating Assembly Code

Compiler Lab: Generating Assembly Code October 14, 2015 Contents 1 Introduction 1 2 Logistics 2 3 Background 2 4 The RPN compiler 3 5 Testing your code 8 5.1 Your code should compile....................

### CPU Organization and Assembly Language

COS 140 Foundations of Computer Science School of Computing and Information Science University of Maine October 2, 2015 Outline 1 2 3 4 5 6 7 8 Homework and announcements Reading: Chapter 12 Homework:

### AZ303. Antonio Ramos. June 2007 Advanced Math Methods: Taking Out Floating Point

June 2007 Advanced Math Methods: Taking Out Floating Point AZ303 Antonio Ramos Basic Concepts Basic Concepts (1) What are the units of a bit? Bits aren t associated to any unit. Although we may use them

### Number System Decimal, Binary, OtlH Octal, Hex Conversion (one to another)

Number system Number System Outline Decimal, Binary, OtlH Octal, Hex Conversion (one to another) Decimal to Binary, Octal, Hex & Vice Versa Binary to HEX & vice versa Other representation Signed, Unsigned,

### CHAPTER 3 Numbers and Numeral Systems

CHAPTER 3 Numbers and Numeral Systems Numbers play an important role in almost all areas of mathematics, not least in calculus. Virtually all calculus books contain a thorough description of the natural,

### Simple Practice Programs. ; store the higher byte

Simple Practice Programs Program 1: - Exchange the content of FFh and FF00h Solution: - Here one is internal memory location and other is memory external location. so first the content of ext memory location

### NUMBER SYSTEMS. 1.1 Introduction

NUMBER SYSTEMS 1.1 Introduction There are several number systems which we normally use, such as decimal, binary, octal, hexadecimal, etc. Amongst them we are most familiar with the decimal number system.

### MT1 Number Systems. In general, the number a 3 a 2 a 1 a 0 in a base b number system represents the following number:

MT1 Number Systems MT1.1 Introduction A number system is a well defined structured way of representing or expressing numbers as a combination of the elements of a finite set of mathematical symbols (i.e.,

### EEE130 Digital Electronics I Lecture #2

EEE130 Digital Electronics I Lecture #2 -Number Systems, Operations and Codes- By Dr. Shahrel A. Suandi Topics to be discussed 2-1 Decimal Numbers 2-2 Binary Numbers 2-3 Decimal-to-Binary Conversion 2-4

### Chapter 2: Number Systems

Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This two-valued number system is called binary. As presented earlier, there are many

### Lab 1d. Fixed-point Conversions

Lab 1d Fixed-point Conversions Page 1d.1 Lab 1d. Fixed-point Conversions This laboratory assignment accompanies the book, Embedded Microcomputer Systems: Real Time Interfacing, Second edition, by, published

### A Little Perspective Combinational Logic Circuits

A Little Perspective Combinational Logic Circuits COMP 251 Computer Organization and Architecture Fall 2009 Motivating Example Recall our machine s architecture: A Simple ALU Consider an ALU that can perform

### AN617. Fixed Point Routines FIXED POINT ARITHMETIC INTRODUCTION. Thi d t t d ith F M k 4 0 4. Design Consultant

Thi d t t d ith F M k 4 0 4 Fixed Point Routines AN617 Author: INTRODUCTION Frank J. Testa Design Consultant This application note presents an implementation of the following fixed point math routines

### The largest has a 0 in the sign position and 0's in all other positions:

10.2 Sign Magnitude Representation Sign Magnitude is straight-forward method for representing both positive and negative integers. It uses the most significant digit of the digit string to indicate the

### 2011, The McGraw-Hill Companies, Inc. Chapter 3

Chapter 3 3.1 Decimal System The radix or base of a number system determines the total number of different symbols or digits used by that system. The decimal system has a base of 10 with the digits 0 through

### CHAPTER TWO. 2.1 Unsigned Binary Counting. Numbering Systems

CHAPTER TWO Numbering Systems Chapter one discussed how computers remember numbers using transistors, tiny devices that act like switches with only two positions, on or off. A single transistor, therefore,

### Switching Circuits & Logic Design

Switching Circuits & Logic Design Jie-Hong Roland Jiang 江介宏 Department of Electrical Engineering National Taiwan University Fall 2013 1 1 Number Systems and Conversion Babylonian number system (3100 B.C.)

### Binary Numbers The Computer Number System

Binary Numbers The Computer Number System Number systems are simply ways to count things. Ours is the base-0 or radix-0 system. Note that there is no symbol for 0 or for the base of any system. We count,2,3,4,5,6,7,8,9,

### Arithmetic. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. See P&H 2.4 (signed), 2.5, 2.6, C.6, and Appendix C.

Arithmetic Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University See P&H 2.4 (signed), 2.5, 2.6, C.6, and Appendix C.6 Goals for today Binary (Arithmetic) Operations One-bit and four-bit

### Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6

Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6 Number Systems No course on programming would be complete without a discussion of the Hexadecimal (Hex) number

### GMP implementation on CUDA - A Backward Compatible Design With Performance Tuning

1 GMP implementation on CUDA - A Backward Compatible Design With Performance Tuning Hao Jun Liu, Chu Tong Edward S. Rogers Sr. Department of Electrical and Computer Engineering University of Toronto haojun.liu@utoronto.ca,

### Programming the Basic Computer. lecture 8

Programming the Basic Computer lecture 8 Programming the Basic Computer A computer system includes both hardware and software. Hardware consist of the physical components. Software refers to computer programs.

### Data types. lecture 4

Data types lecture 4 Information in digital computers is represented using binary number system. The base, i.e. radix, of the binary system is 2. Other common number systems: octal (base 8), decimal (base

### Arithmetic of Number Systems

2 Arithmetic of Number Systems INTRODUCTION Arithmetic operations in number systems are usually done in binary because designing of logic networks is much easier than decimal. In this chapter we will discuss

### 2 Boolean Arithmetic. Counting is the religion of this generation, its hope and salvation. Gertrude Stein ( )

2 Boolean Arithmetic Counting is the religion of this generation, its hope and salvation. Gertrude Stein (1874 1946) In this chapter we build gate logic designs that represent numbers and perform arithmetic

### Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Lecture 2: Number Systems and Arithmetic Number Systems - Base The number system that we use is base : 734 = + 7 + 3 + 4 = x + 7x + 3x + 4x = x 3 + 7x

### Chapter II Binary Data Representation

Chapter II Binary Data Representation The atomic unit of data in computer systems is the bit, which is actually an acronym that stands for BInary digit. It can hold only 2 values or states: 0 or 1, true

### The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway

The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway Abstract High Level Languages (HLLs) are rapidly becoming the standard

### Square roots by subtraction

Square roots by subtraction Frazer Jarvis When I was at school, my mathematics teacher showed me the following very strange method to work out square roots, using only subtraction, which is apparently

### This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

This Unit: Floating Point Arithmetic CIS 371 Computer Organization and Design Unit 7: Floating Point App App App System software Mem CPU I/O Formats Precision and range IEEE 754 standard Operations Addition

### Arithmetic Operations

Arithmetic Operations Dongbing Gu School of Computer Science and Electronic Engineering University of Essex UK Spring 2013 D. Gu (Univ. of Essex) Arithmetic Operations Spring 2013 1 / 34 Outline 1 Introduction

### CHAPTER THREE. 3.1 Binary Addition. Binary Math and Signed Representations

CHAPTER THREE Binary Math and Signed Representations Representing numbers with bits is one thing. Doing something with them is an entirely different matter. This chapter discusses some of the basic mathematical

### 1 Classical Universal Computer 3

Chapter 6: Machine Language and Assembler Christian Jacob 1 Classical Universal Computer 3 1.1 Von Neumann Architecture 3 1.2 CPU and RAM 5 1.3 Arithmetic Logical Unit (ALU) 6 1.4 Arithmetic Logical Unit

### Binary Numbers. Binary Octal Hexadecimal

Binary Numbers Binary Octal Hexadecimal Binary Numbers COUNTING SYSTEMS UNLIMITED... Since you have been using the 10 different digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 all your life, you may wonder how

### Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

Digital Logic 1 Data Representations 1.1 The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The system we

### Assembly Language: Overview! Jennifer Rexford!

Assembly Language: Overview! Jennifer Rexford! 1 Goals of this Lecture! Help you learn:! The basics of computer architecture! The relationship between C and assembly language! IA-32 assembly language,

### Logic Design. Dr. Yosry A. Azzam

Logic Design Dr. Yosry A. Azzam Binary systems Chapter 1 Agenda Binary Systems : Binary Numbers, Binary Codes, Binary Logic ASCII Code (American Standard Code for Information Interchange) Boolean Algebra

### Lecture 1: Digital Systems and Binary Numbers

Lecture 1: Digital Systems and Binary Numbers Matthew Shuman September 30th, 2009 1 Digital Systems 1-1 in Text 1.1 Analog Systems Analog systems are continuous. Look at the analog clock in figure 1. The

### 6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10

Lesson The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base- system. When you

### Quiz for Chapter 3 Arithmetic for Computers 3.10

Date: Quiz for Chapter 3 Arithmetic for Computers 3.10 Not all questions are of equal difficulty. Please review the entire quiz first and then budget your time carefully. Name: Course: Solutions in RED

### Lab 1: Combinational Arithmetic Circuits CEG 360/560 - EE 451/651

Lab 1: Combinational Arithmetic Circuits CEG 360/560 - EE 451/651 PURPOSE The purpose of this introductory laboratory project is to familiarize students with the digital design and simulation software

### Lab 1: Information Representation I -- Number Systems

Unit 1: Computer Systems, pages 1 of 7 - Department of Computer and Mathematical Sciences CS 1408 Intro to Computer Science with Visual Basic 1 Lab 1: Information Representation I -- Number Systems Objectives:

### Lab 1: Information Representation I -- Number Systems

Unit 1: Computer Systems, pages 1 of 7 - Department of Computer and Mathematical Sciences CS 1410 Intro to Computer Science with C++ 1 Lab 1: Information Representation I -- Number Systems Objectives: