Systems I: Computer Organization and Architecture



Similar documents
The string of digits in the binary number system represents the quantity

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

Chapter 1: Digital Systems and Binary Numbers

LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

Levent EREN A-306 Office Phone: INTRODUCTION TO DIGITAL LOGIC

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

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

Number Representation

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

COMPSCI 210. Binary Fractions. Agenda & Reading

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

CSI 333 Lecture 1 Number Systems

Computer Science 281 Binary and Hexadecimal Review

Chapter 4: Computer Codes

Sheet 7 (Chapter 10)

Lecture 2. Binary and Hexadecimal Numbers

Useful Number Systems

NUMBER SYSTEMS. 1.1 Introduction

Base Conversion written by Cathy Saxton

Goals. Unary Numbers. Decimal Numbers. 3,148 is s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1

HOMEWORK # 2 SOLUTIO

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:

CS201: Architecture and Assembly Language

Numbering Systems. InThisAppendix...

Lecture 11: Number Systems

CS321. Introduction to Numerical Methods

Binary Representation

Number and codes in digital systems

MATH-0910 Review Concepts (Haugen)

Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi)

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

Digital codes. Resources and methods for learning about these subjects (list a few here, in preparation for your research):

Binary Number System. 16. Binary Numbers. Base 10 digits: Base 2 digits: 0 1

Solution for Homework 2

Binary Numbers. Binary Octal Hexadecimal

Binary, Hexadecimal, Octal, and BCD Numbers

This 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30));

CPEN Digital Logic Design Binary Systems

Chapter 1. Binary, octal and hexadecimal numbers

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

MEP Y9 Practice Book A

Section 1.4 Place Value Systems of Numeration in Other Bases

Chapter 5. Binary, octal and hexadecimal numbers

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

Digital Logic Design. Introduction

Number Systems. Introduction / Number Systems

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:

2 Number Systems. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

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

Lecture 8: Binary Multiplication & Division

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

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

3. Convert a number from one number system to another

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems

Binary Numbering Systems

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın

Chapter 2. Binary Values and Number Systems

NUMBER SYSTEMS. William Stallings

Memory is implemented as an array of electronic switches

DNA Data and Program Representation. Alexandre David

The finite field with 2 elements The simplest finite field is

The Answer to the 14 Most Frequently Asked Modbus Questions

Basic Use of the TI-84 Plus

Data Storage 3.1. Foundations of Computer Science Cengage Learning

=

CHAPTER 5 Round-off errors

Decimal to Binary Conversion

Unsigned Conversions from Decimal or to Decimal and other Number Systems

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

This is great when speed is important and relatively few words are necessary, but Max would be a terrible language for writing a text editor.

Micro Motion Modbus Interface Tool

Intel Hexadecimal Object File Format Specification Revision A, 1/6/88

A Step towards an Easy Interconversion of Various Number Systems

Counting in base 10, 2 and 16

Exponents, Radicals, and Scientific Notation

Chapter Binary, Octal, Decimal, and Hexadecimal Calculations

Virtual Integrated Design Getting started with RS232 Hex Com Tool v6.0

ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

Number Systems and Radix Conversion

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

ASCII Code. Numerous codes were invented, including Émile Baudot's code (known as Baudot

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

ASCII and BCD Arithmetic. Chapter 11 S. Dandamudi

THE BINARY NUMBER SYSTEM

26 Integers: Multiplication, Division, and Order

1.Eastron SDM220Modbus Smart Meter Modbus Protocol Implementation V1.0

The ASCII Character Set

COURSE TITLE: INTRODUCTION TO COMPUTER DESIGN

YOU MUST BE ABLE TO DO THE FOLLOWING PROBLEMS WITHOUT A CALCULATOR!

Hexadecimal Object File Format Specification

The Hexadecimal Number System and Memory Addressing

Cyber Security Workshop Encryption Reference Manual

ND48-RS ASCII A2.04 Communication Protocol

Positional Numbering System

PREPARATION FOR MATH TESTING at CityLab Academy

Transcription:

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 2 + 3x + 4x 724.5 = 7x + 2x + 4x + 5x. = 7x 2 + 2x + 4x + 5x - Why use base?

Number Systems - Base 2 For computers, base 2 is more convenient (why?) 2 = x6 + x8 + x4 + x2 + x = 9 2 = x32 + x6 + x8 + x4 + x2 + x = 34. 2 = x4 + x2 + x + x.5 + x.25 + x.25 = 5.25 Example - 2 =? 2 =?. 2 =? Number Systems - Base 6 Hexadecimal (base 6) numbers are commonly used because it is convert them into binary (base 2) and vice versa. 8CE 6 = 8x256 + 2x6 + 4x = 248 + 92 + 4 = 2254 3F9 = 3x256 + 5x6 + 9x = 768 + 24 + 9 = 7

Number Systems - Base 6 (continued) Base 2 is easily converted into base 6: 2 = = 8 C E 6 2 = = D B A 9 6 2 =? 6 2 =? 6 Number Systems - Base 6 (continued) Converting base 6 into base 2 works the same way: F3A5 6 = 2 76EF 6 = 2 AB3D 6 =? 2 5C.38 6 =? 2

Number Systems Base 8 Octal (base 8) numbers used to be commonly used because it is convert them into binary (base 2) and vice versa. However, the absence of 8 and 9 is not obvious enough and they were frequently mistaken for decimal values. 436 8 = 4 x 8 3 + 3 x 8 2 + x 8 + 6 x 8 = 4 x 52 + 3 x 64 + x 8 + 6 x = 248 + 92 + 8 + 6 = 2254 Number Systems - Base 8 (continued) Base 2 is easily converted into base 8: 2 = = 4 3 6 8 2 = = 35565 8 2 =? 8 2 =? 8

Number Systems - Base 8 (continued) Converting base 8 into base 2 works the same way: 3635 8 = 2 73357 8 = 2 2436 8 =? 2 573 8 =? 2 Converting From Decimal to Binary 9 9 R 4 R 2 2 R R R

Converting From Decimal to Hexadecimal 6 237 4 R 3 R 4 ED 6 Converting From Decimal to Octal 8 237 29 R 5 3 R 5 R 3 355 8

Binary, Octal, Decimal and Hexadecimal Equivalents Binary Binary Decimal Decimal Hex. Hex. 2 3 4 5 6 7 2 3 4 5 6 7 8 9 2 3 4 5 8 A B C D 9 F E Octal 2 3 4 5 6 7 Octal 2 3 4 5 6 7 Addition of Binary Numbers C X Y X+Y 9 4 33 + + C X Y X+Y 27 63 9 + +

Addition of Binary Numbers (continued) C X Y X+Y + 74 44 27 + C X Y X+Y + 7 85 255 + C X Y X+Y Addition of Hexadecimal Numbers 9B9 6 C7E6 6 E9F 6 2 4 4 E 9 7 7 6+ 4 25 6+9 9 9 6 5 5 F

Complements There are several different ways in which we can represent negative numbers: Signed-Magnitude Representation s Complement Representation 2s Complement Representation Signed-Magnitude Representation In signed-magnitude representation, the sign bit is set to if negative and cleared to if positive: 6 +3 9-6 + +3 + 7 ( = -9)

s Complement Representation In signed-magnitude representation, the sign bit is set to if negative and the other bits are also reversed. 6 +3 9-6 + +3 + 7 ( = +6) overflow bit 2s Complement Representation In 2s complement representation, we subtract the absolute value from 2 n : -6 + +3 + 7 ( = +7)

2s Complement Representation (continued) The 2s complement representation can also be found by reversing the bits (into s complement) and then adding : 6 => => + 43 => => + Overflow If an addition operation produces a result that exceeds our number system s range, overflow has occurred. Addition of two numbers of the same sign produces overflow; addition two numbers of opposite sign cannot cause overflow. -3 +5 +6 +6 +3 = +3 + = -5-8 +7-8 +7-6 = +4 = -2

Subtraction Subtraction works in a similar fashion, but the borrow (an initial carry bit) is a : +4 initial carry - +3 - + + +3 - +4 - + - Subtraction (continued) +3 - - 4 - + - 7-3 - -4 - + -

Binary Multiplication Multiplication is repeated addition of the multiplicand, where the number of additions depends on the multiplier: x 3 33 43 multiplicand multiplier shifted multiplicands product Partial Product Method It is more convenient to add each shifted multiplicand as it is created to a partial product: partial products x x 3 43 shifted multiplicands

Partial Product Method Another Example -5 x -3 shifted multiplicand shifted and negated multiplicand Binary Division reduced divisor shifted divisor remainder

Binary Representation of Decimal Numbers Decimal Digit BCD (842) 242 Excess-3 2 3 4 5 6 7 8 9 Floating Point Representations The floating point representation of a number has two part: fraction and an exponent: +632.789 = +.632789 x 4 In general, a number can be expressed as m x r e where m is the mantissa, r is the radix and e is the exponent. Because we know that computer always use binary numbers (radix = 2), only m and e need to be represented. Therefore, we can represent. using m = and e = (because. = +. x 2 +4 )

Floating Point Representations (continued) A floating-point number is normalized if the most significant place in the mantissa is nonzero. 35 is normalized 35 is not normalized. is not normalized, but is normalized; this requires changing the exponent to 4. The standard method of storing exponent is excess-64, where an exponent of is zero an exponent of is positive an exponent of is negative. Gray Codes Sometimes electromechanical applications of digital systems (machine tools, automotive brake systems and copiers) require a digital value that indicates a mechanical position. A standard binary code may see more than one bit change from one position to another, which could lead to an incorrect reading if mechanical assembly is imperfect.

Binary Code vs. Gray Code Binary Code Gray Code ASCII representation of characters ASCII (American Standard Code for Information Interchange) is a numeric code used to represent characters. All characters are represented this way including: words (character strings) numbers punctuation control characters There are separate values for upper case and lower case characters: A 65 z 22 B 66 blank 32 Z 9 $ 52 a 97 48 b 98 9 57

Control Codes ASCII (a 7-bit code) has 2 7 = 28 values. We only need 62 for alphanumeric characters. Even after accounting for common punctuation, there are far more available code values than we need. What do we use them for? Control codes include DEL (for delete), NUL (for null). STX (Start of Text), CR (for carriage return), etc. Error Detection Codes An error is a corruption of the data from its correct state. There are several codes that allow use to detect an error. These include: Parity CRC Checksum

Parity Parity is an extra bit appended to our data which indicates whether the data bits add up to an even (for even parity) or odd (for odd parity) value. Parity Generation Message (xyz) P(odd) P(even)

x y z Odd Parity x y z P(odd) CRC CRC (Cyclic Redundancy Check) is an error detecting code. CRC can spot single-bit errors as well as clustered error.

Checksum Checksum codes involve adding bytes modulo 256. This allows checksums to spot one-byte errors. Checksums can use other modulos which would allow for spotting different errors as well.