# 1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Save this PDF as:

Size: px
Start display at page:

Download "1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9"

## Transcription

1 CS 64 Lecture 2 Data Representation Reading: FLD Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 ) + (1x10 0 ) ?= ?= 1

2 Numbers: positional notation Number Base B => B symbols per digit: Base 10 (Decimal): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Base 2 (Binary): 0, 1 Number representation: d 31 d d 2 d 1 d 0 is a 32 digit number value = d 31 x B 31 + d 30 x B d 2 x B 2 + d 1 x B 1 + d 0 x B 0 Binary: 0, = 1x x x x x x2 + 0x1 = = 90 An Example The number 2001 A base that converts to binary easily? 2

3 Anything Wrong with This Picture? Hexadecimal Numbers: Base 16 Hexadecimal: 0,1,2,3,4,5,6,7,8,9, A, B, C, D, E, F 0xEDF Conversion: Binary Hex 1 hex digit represents 16 decimal values 4 binary digits represent 16 decimal values => 1 hex digit replaces 4 binary digits Examples: (binary) =? (hex) (binary) = (binary) =? 3F9(hex) =? (binary) 3

4 Octal Numbers: Base 8 0,1,2,3,4,5,6,7 Conversion: Binary Octal 1 octal digit represents 8 decimal values 3 binary digits represent 8 decimal values => 1 octal digit replaces 3 binary digits Examples: (binary) =? (oct) How to convert Octal Hex Conversion from One to Another(1) 4

5 Conversion from One to Another(2) Examples of octal-to-binary and hexadecimal-tobinary conversion. Exercise I (binary) =? (hex) (binary) = (binary) =? (hex) =? (octal) 3F9(hex) =? (binary) =? (octal) A B C D E F

6 Some tricks Multiplication by a constant of power of 2 Shifting the number left by some bits The number of bits should be? 2 x 2 = x 4 = 8 010? 3 x 8 =?? 011? Much faster to implement a shift instruction(1 clock cycle) than multiple instruction (32 clock cycles) What about divisions? 4 / 2 =? Even or Odd numbers? An Example = = / 2 = 5 = / 2 = 2 = / 2 = 1 =

7 Decimal Binary Decimal Binary By successive halving, starting at the top and working downward, record the quotient and the remainder. 1492/2= /2= /2= /2= /2= 0..1 Record the reminders from right (LSD) to left (MSD) 7

8 Exercise Convert 96 from decimal to binary Convert 37 to binary, shift it left by one and convert back to decimal. What is the result? In 'C', an unsigned integer is usually 16 bits. What is the largest number that can be represented by an unsigned integer? Binary Decimal By Double-and-Add, scanning the binary number from left to right, start with the leftmost 1 8

9 A Short Review Data representation Hex, decimal, octal, binary Conversion between them Hex, octal, binary Decimal hex, octal, binary Multiply by a number that is a power of 2 Divide by a number that is a power of 2 Even and odd numbers Binary Arithmetic ADDITION SUBTRACTION MULTIPLICATION DIVISION 9

10 What to do with representations of numbers? Just what we do with numbers! Add them Subtract them Multiply them Divide them Compare them add in binary that we can build circuits to do it subtraction also just as you would in decimal Rules of Binary Addition = = = = 0, and carry 1 to the next more significant bit Example =

11 Rules of Binary Subtraction 0-0 = = 1, and borrow 1 from the next more significant bit 1-0 = = = Rules of Binary Multiplication 0 x 0 = 0 0 x 1 = 0 1 x 0 = 0 1 x 1 = 1, and no carry or borrow bits Example =

12 Rules of Binary Division Binary division is the repeated process of subtraction, just as in decimal division. Example = Comparison How do you tell if X > Y? See if X - Y > 0 12

13 Representing Negative Numbers Clarification N BITS BINARY NUMBER 13

14 Attempt #1: sign and magnitude So far, unsigned numbers Obvious solution: sign and magnitude define leftmost bit (most significant bit) to be sign! 0 => +, 1 => - Rest of bits can be numerical value of number MIPS uses N= 32-bit integers. +1 ten would be: And - 1 ten in sign and magnitude would be: Shortcomings of sign and magnitude? Arithmetic circuit more complicated Special steps depending whether signs are the same or not Also, Two zeros (dirty zero) 0x = +0 ten 0x = -0 ten What would it mean for programming? Sign and magnitude abandoned! 14

15 Attempt #2: complement the bits Example: 7 10 = = Called one s Complement Note: positive numbers have leading 0s, negative numbers have leadings 1s What is ? How many positive numbers in N bits? How many negative ones? Shortcomings of ones complement? Arithmetic not too hard Still two zeros 0x = +0ten 0xFFFFFFFF = -0ten What would it mean for programming? A conventional binary addition & add any resulting carry back into the resulting sum One s complement eventually abandoned because another solution was better 15

16 Attempt #3: two s complement Avoid multiple representations of 0 and the need of examining the sign before operations The leftmost bit of a signed binary numeral indicates the sign 0 (+) To get the magnitude: all the bits are the numerical value of number 1 (-) To get the magnitude: all the bits are inverted then 1 is added to the result Example (8 bits binary number) 1 10 = = =

17 Two s Complement Formula Can represent positive and negative numbers in terms of the bit value times a power of 2: d 31 x d 30 x d 2 x d 1 x d 0 x 2 0 Example two = 1x x x x2 2 +0x2 1 +0x2 0 = = -2,147,483,648 ten + 2,147,483,644 ten = -4 ten Note: need to specify width: we use 32 bits Negation in Two s Complement Number Systems Invert every 0 to 1 and every 1 to 0, then add 1 to the result Sum of number and its one s complement must be two two = -1 ten Let x mean the inverted representation of x Then x + x = -1 x + x + 1 = 0 x + 1 = -x Example: -4 to +4 to -4 x : two x : two +1: two () : two +1: two 17

18 Two s Complement in MIPS two = 0 ten two = 1 ten two =2 ten two =2,147,483,645 ten two =2,147,483,646 ten two = 2,147,483,647 ten two = 2,147,483,648 ten two = 2,147,483,647 ten two = 2,147,483,646 ten two = 3 ten two = 2 ten two = 1 ten One zero, 1st bit >=0 or <0, called sign bit but one negative with no positive 2,147,483,648 ten Two s Complement Number line 2^N-1 non-negatives 2^N-1 negatives one zero how many positives? comparison? overflow?

19 Two s complement: Weird number Start with any number in two's complement representation, flip all the bits and add 1 we get the two's complement representation of the negative of that number, except for one -2 N-1 Example (assuming N=8) ( 128) (inverted bits) (add one) Two s complement: Sign Extension Convert 2 s complement number using N bits to more than N bits Simply replicate the most significant bit (sign bit) of smaller to fill new bits 2 s comp. positive number has infinite 0s 2 s comp. negative number has infinite 1s Decimal 4 bit 2 s complement 8 bit 2 s complement

20 Two s complement: Zero Extension Simply replicate 0 to fill new bits Decimal 4 bit 2 s complement 8 bit 2 s complement Two s complement: Arithmetic (carry) (15) (-5) =========== (10) (borrow) (15) ( 5) =========== (20) What about multiplication and division use 2 s complement to convert negative numbers to positive ones add sign to the results 20

21 What if too big? Binary bit patterns above are simply representatives of numbers Numbers really have an infinite number of digits with almost all being zero except for a few of the rightmost digits Just don t normally show leading zeros If result of add (or -,*/) cannot be represented by these rightmost HW bits, overflow is said to have occurred Detection of overflows 0111 (carry) 0111 (7) (3) ============= 1010 ( 6) invalid! Overflow of N bits binary representations NO --The left two bits of carry are 11 or 00 Overflow The left two bits of carry are 10 or 01 21

22 Put it together: Negative Numbers Format Positive or Negative?? Compute magnitude Zero?? (in 32 bit) Example -1(decimal) Sign & Magnitude The left most bit 0 = positive 1 = negative The rest bits as unsigned binary = (A) 0x x x One s Compliment The left most bit 0 = positive 1 = negative Positive =(A) If negative, compliment each bit 0x xFFFFFFFF 0xFFFFFFFE Two s Compliment The left most bit 0 = positive 1 = negative Positive =(A) If negative, compliment each bit and add 1 0x xFFFFFFFF Put it together: Negative Numbers Format Positive or Negative?? Compute magnitude Zero?? (in 32 bit) Example -1(decimal) Sign & Magnitude The left most bit 0 = positive 1 = negative The rest bits as unsigned binary = (A) 0x x x One s Compliment The left most bit 0 = positive 1 = negative Positive =(A) If negative, compliment each bit 0x xFFFFFFFF 0xFFFFFFFE Two s Compliment The left most bit 0 = positive 1 = negative Positive =(A) If negative, compliment each bit and add 1 0x xFFFFFFFF 22

23 The range of different formats Format (N bits) Positive numbers Negative numbers Zero?? (in 32 bit) Sign & Magnitude 1 to (2 N-1-1) -1 to -(2 N-1-1) 0x x One s Compliment 1 to (2 N-1-1) -1 to -(2 N-1-1) 0x xFFFFFFFF Two s Compliment 1 to (2 N-1-1) -1 to -(2 N-1 ) 0x The range of different formats Format (N bits) Positive numbers Negative numbers Zero?? (in 32 bit) Sign & Magnitude 1 to (2 N-1-1) -1 to -(2 N-1-1) 0x x One s Compliment 1 to (2 N-1-1) -1 to -(2 N-1-1) 0x xFFFFFFFF Two s Compliment 1 to (2 N-1-1) -1 to -(2 N-1 ) 0x

24 Homework 1 Assigned Due April 11 th 5pm, use the CS 64 HW box located in the HFH CS mailroom (2 nd floor) Part I: Fundamental of Logic Design (PLD), Chapter 1: Page 24-25, 1.5, 1.6, 1.7, 1.8, 1.36, 1.37 Part II: Consider the 16-bit hexadecimal number 0x98FD What is the value of the bit pattern (in decimal) if it is coded in unsigned integer? What is the value of the bit pattern (in decimal) if it is coded in signed integer (in two s compliment format) Consider the 16-bit hexadecimal number 0x067F What is the value of the bit pattern (in decimal) if it is coded in unsigned integer? What is the value of the bit pattern (in decimal) if it is coded in signed integer (in two s compliment format) 24

### A complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation

Complement Number Systems A complement number system is used to represent positive and negative integers A complement number system is based on a fixed length representation of numbers Pretend that integers

### EE 109 Unit 6 Binary Arithmetic

EE 109 Unit 6 Binary Arithmetic 1 2 Semester Transition Point At this point we are going to start to transition in our class to look more at the hardware organization and the low-level software that is

### BINARY SYSTEM. Binary system is used in digital systems because it is:

CHAPTER 2 CHAPTER CONTENTS 2.1 Binary System 2.2 Binary Arithmetic Operation 2.3 Signed & Unsigned Numbers 2.4 Arithmetic Operations of Signed Numbers 2.5 Hexadecimal Number System 2.6 Octal Number System

Octal and Hexadecimal Integers CS 350: Computer Organization & Assembler Language Programming A. Why? Octal and hexadecimal numbers are useful for abbreviating long bitstrings. Some operations on octal

### Lecture 2: Number Systems

Lecture 2: Number Systems Syed M. Mahmud, Ph.D ECE Department Wayne State University Original Source: Prof. Russell Tessier of University of Massachusetts Aby George of Wayne State University Contents

### Binary Representations and Arithmetic

Binary Representations and Arithmetic 9--26 Common number systems. Base : decimal Base 2: binary Base 6: hexadecimal (memory addresses) Base 8: octal (obsolete computer systems) Base 64 (email attachments,

### 4/8/17. Admin. Assignment 5 BINARY. David Kauchak CS 52 Spring 2017

4/8/17 Admin! Assignment 5 BINARY David Kauchak CS 52 Spring 2017 Diving into your computer Normal computer user 1 After intro CS After 5 weeks of cs52 What now One last note on CS52 memory address binary

### Digital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand

Digital Arithmetic Digital Arithmetic: Operations and Circuits Dr. Farahmand Binary Arithmetic Digital circuits are frequently used for arithmetic operations Fundamental arithmetic operations on binary

### Number representations

Number representations Number bases Three number bases are of interest: Binary, Octal and Hexadecimal. We look briefly at conversions among them and between each of them and decimal. Binary Base-two, or

### Chapter 2 Data Representations

Computer Engineering Chapter 2 Data Representations Hiroaki Kobayashi 4/21/2008 4/21/2008 1 Agenda in Chapter 2 Translation between binary numbers and decimal numbers Data Representations for Integers

### Module 2: Computer Arithmetic

Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N

### Signed umbers. Sign/Magnitude otation

Signed umbers So far we have discussed unsigned number representations. In particular, we have looked at the binary number system and shorthand methods in representing binary codes. With m binary digits,

### 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

### Inf2C - Computer Systems Lecture 2 Data Representation

Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack

### Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

Contents Number systems and conversion Binary arithmetic Representation of negative numbers Addition of two s complement numbers Addition of one s complement numbers Binary s Readings Unit.~. UNIT NUMBER

### Microcomputers. Outline. Number Systems and Digital Logic Review

Microcomputers Number Systems and Digital Logic Review Lecture 1-1 Outline Number systems and formats Common number systems Base Conversion Integer representation Signed integer representation Binary coded

### Fundamentals of Programming Session 2

Fundamentals of Programming Session 2 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2013 Sharif University of Technology Outlines Programming Language Binary numbers Addition Subtraction

### Data Representations & Arithmetic Operations

Data Representations & Arithmetic Operations Hiroaki Kobayashi 7/13/2011 7/13/2011 Computer Science 1 Agenda Translation between binary numbers and decimal numbers Data Representations for Integers Negative

### D I G I T A L C I R C U I T S E E

D I G I T A L C I R C U I T S E E Digital Circuits Basic Scope and Introduction This book covers theory solved examples and previous year gate question for following topics: Number system, Boolean algebra,

### Positional Number System

Positional Number System A number is represented by a string of digits where each digit position has an associated weight. The weight is based on the radix of the number system. Some common radices: Decimal.

### Signed Binary Numbers

Signed Binary Numbers Unsigned Binary Numbers We write numbers with as many digits as we need: 0, 99, 65536, 15000, 1979, However, memory locations and CPU registers always hold a constant, fixed number

### IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

IT 1204 Section 2.0 Data Representation and Arithmetic 2009, University of Colombo School of Computing 1 What is Analog and Digital The interpretation of an analog signal would correspond to a signal whose

### COMP 122/L Lecture 2. Kyle Dewey

COMP 122/L Lecture 2 Kyle Dewey Outline Operations on binary values AND, OR, XOR, NOT Bit shifting (left, two forms of right) Addition Subtraction Twos complement Bitwise Operations Bitwise AND Similar

### Number Systems. Both numbers are positive

Number Systems Range of Numbers and Overflow When arithmetic operation such as Addition, Subtraction, Multiplication and Division are performed on numbers the results generated may exceed the range of

### Learning the Binary System

Learning the Binary System www.brainlubeonline.com/counting_on_binary/ Formated to L A TEX: /25/22 Abstract This is a document on the base-2 abstract numerical system, or Binary system. This is a VERY

### 10.1. Unit 10. Signed Representation Systems Binary Arithmetic

0. Unit 0 Signed Representation Systems Binary Arithmetic 0.2 BINARY REPRESENTATION SYSTEMS REVIEW 0.3 Interpreting Binary Strings Given a string of s and 0 s, you need to know the representation system

### CS/EE1012 INTRODUCTION TO COMPUTER ENGINEERING SPRING 2013 HOMEWORK I. Solve all homework and exam problems as shown in class and sample solutions

CS/EE2 INTRODUCTION TO COMPUTER ENGINEERING SPRING 23 DUE : February 22, 23 HOMEWORK I READ : Related portions of the following chapters : È Chapter È Chapter 2 È Appendix E ASSIGNMENT : There are eight

### Digital Fundamentals

Digital Fundamentals Tenth Edition Floyd Chapter 1 Modified by Yuttapong Jiraraksopakun Floyd, Digital Fundamentals, 10 th 2008 Pearson Education ENE, KMUTT ed 2009 Analog Quantities Most natural quantities

### COMP 303 Computer Architecture Lecture 6

COMP 303 Computer Architecture Lecture 6 MULTIPLY (unsigned) Paper and pencil example (unsigned): Multiplicand 1000 = 8 Multiplier x 1001 = 9 1000 0000 0000 1000 Product 01001000 = 72 n bits x n bits =

### Chapter 2 Bits, Data Types, and Operations

Chapter 2 Bits, Data Types, and Operations How do we represent data in a computer? At the lowest level, a computer is an electronic machine. works by controlling the flow of electrons Easy to recognize

### Lecture 6: Signed Numbers & Arithmetic Circuits. BCD (Binary Coded Decimal) Points Addressed in this Lecture

Points ddressed in this Lecture Lecture 6: Signed Numbers rithmetic Circuits Professor Peter Cheung Department of EEE, Imperial College London (Floyd 2.5-2.7, 6.1-6.7) (Tocci 6.1-6.11, 9.1-9.2, 9.4) Representing

### Octal & Hexadecimal Number Systems. Digital Electronics

Octal & Hexadecimal Number Systems Digital Electronics What, More Number Systems? Why do we need more number systems? Humans understand decimal Check out my ten digits! Digital electronics (computers)

### 9/23/15. Agenda. Goals of this Lecture. For Your Amusement. Number Systems and Number Representation. The Binary Number System

For Your Amusement Number Systems and Number Representation Jennifer Rexford Question: Why do computer programmers confuse Christmas and Halloween? Answer: Because 25 Dec = 31 Oct -- http://www.electronicsweekly.com

### Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Website is up

### Fundamentals of Programming (C)

Borrowed from lecturer notes by Omid Jafarinezhad Fundamentals of Programming (C) Group 8 Lecturer: Vahid Khodabakhshi Lecture Number Systems Department of Computer Engineering Outline Numeral Systems

### Chapter 2 Bits, Data Types, and Operations

Chapter 2 Bits, Data Types, and Operations Computer is a binary digital system. Digital system: finite number of symbols Binary (base two) system: has two states: 0 and 1 Basic unit of information is the

### Number Systems and Computer Arithmetic

Number Systems and Computer Arithmetic Counting to four billion two fingers at a time What do all those bits mean now? bits (011011011100010...01) instruction R-format I-format... integer data number text

### Lecture 2: Number Representa2on

CSE 30: Computer Organization and Systems Programming Lecture 2: Number Representa2on Diba Mirza University of California, San Diego 1 Levels of Representation High Level Language Program (e.g., C) Compiler

### Number Systems MA1S1. Tristan McLoughlin. November 27, 2013

Number Systems MA1S1 Tristan McLoughlin November 27, 2013 http://en.wikipedia.org/wiki/binary numeral system http://accu.org/index.php/articles/1558 http://www.binaryconvert.com http://en.wikipedia.org/wiki/ascii

### CS61c Midterm Review (fa06) Number representation and Floating points From your friendly reader

CS61c Midterm Review (fa06) Number representation and Floating points From your friendly reader Number representation (See: Lecture 2, Lab 1, HW#1) KNOW: Kibi (2 10 ), Mebi(2 20 ), Gibi(2 30 ), Tebi(2

### Numeral Systems. -Numeral System -Positional systems -Decimal -Binary -Octal. Subjects:

Numeral Systems -Numeral System -Positional systems -Decimal -Binary -Octal Subjects: Introduction A numeral system (or system of numeration) is a writing system for expressing numbers, that is a mathematical

### Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example

Appendix F Number Systems Binary Numbers Decimal notation represents numbers as powers of 10, for example 1729 1 103 7 102 2 101 9 100 decimal = + + + There is no particular reason for the choice of 10,

### Excerpt from "Art of Problem Solving Volume 1: the Basics" 2014 AoPS Inc.

Chapter 5 Using the Integers In spite of their being a rather restricted class of numbers, the integers have a lot of interesting properties and uses. Math which involves the properties of integers is

### CO Computer Architecture and Programming Languages CAPL. Lecture 9

CO20-320241 Computer Architecture and Programming Languages CAPL Lecture 9 Dr. Kinga Lipskoch Fall 2017 A Four-bit Number Circle CAPL Fall 2017 2 / 38 Functional Parts of an ALU CAPL Fall 2017 3 / 38 Addition

### CSCI 2212: Intermediate Programming / C Chapter 15

... /34 CSCI 222: Intermediate Programming / C Chapter 5 Alice E. Fischer October 9 and 2, 25 ... 2/34 Outline Integer Representations Binary Integers Integer Types Bit Operations Applying Bit Operations

### Chapter 1. Digital Systems and Binary Numbers

Chapter 1. Digital Systems and Binary Numbers Tong In Oh 1 1.1 Digital Systems Digital age Characteristic of digital system Generality and flexibility Represent and manipulate discrete elements of information

### CS 101: Computer Programming and Utilization

CS 101: Computer Programming and Utilization Jul-Nov 2017 Umesh Bellur (cs101@cse.iitb.ac.in) Lecture 3: Number Representa.ons Representing Numbers Digital Circuits can store and manipulate 0 s and 1 s.

### Chapter 5: Computer Arithmetic

Slide 1/29 Learning Objectives Computer Fundamentals: Pradeep K. Sinha & Priti Sinha In this chapter you will learn about: Reasons for using binary instead of decimal numbers Basic arithmetic operations

### Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems

Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems In everyday life, we humans most often count using decimal or base-10 numbers. In computer science, it

### ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

### Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:

N Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as: a n a a a The value of this number is given by: = a n Ka a a a a a

### CS101 Lecture 04: Binary Arithmetic

CS101 Lecture 04: Binary Arithmetic Binary Number Addition Two s complement encoding Briefly: real number representation Aaron Stevens (azs@bu.edu) 25 January 2013 What You ll Learn Today Counting in binary

### Chapter 2. Binary Values and Number Systems

Chapter 2 Binary Values and Number Systems Numbers Natural numbers, a.k.a. positive integers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative numbers A

### Basic Arithmetic (adding and subtracting)

Basic Arithmetic (adding and subtracting) Digital logic to show add/subtract Boolean algebra abstraction of physical, analog circuit behavior 1 0 CPU components ALU logic circuits logic gates transistors

### QUIZ: Generations of computer technology. Hardware:

QUIZ: Generations of computer technology Hardware: 1. 2. 3. 4. 5. 1 QUIZ: Generations of computer technology Software: 1. 2. 3. 4. 5. 6. 2 Chapter 2 Binary Values and Number Systems Numbers Natural numbers,

### LECTURE 1-2. Introduction and Number Systems

LECTURE 1-2 Introduction and Number Systems 1 BASIC INFORMATION Course Code: CSE 115 Course Title: Computing Concepts Course Teacher: Dr. Muhammad Asif H. Khan (Mfs), Associate Professor, Dept. of Computer

### Chapter 2. Data Representation in Computer Systems

Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting

### 1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1.1 Introduction Given that digital logic and memory devices are based on two electrical states (on and off), it is natural to use a number

### But first, encode deck of cards. Integer Representation. Two possible representations. Two better representations WELLESLEY CS 240 9/8/15

Integer Representation Representation of integers: unsigned and signed Sign extension Arithmetic and shifting Casting But first, encode deck of cards. cards in suits How do we encode suits, face cards?

### CS2630: Computer Organization Homework 1 Bits, bytes, and memory organization Due January 25, 2017, 11:59pm

CS2630: Computer Organization Homework 1 Bits, bytes, and memory organization Due January 25, 2017, 11:59pm Instructions: Show your work. Correct answers with no work will not receive full credit. Whether

### Chapter 10 Error Detection and Correction 10.1

Chapter 10 Error Detection and Correction 10.1 10-1 INTRODUCTION some issues related, directly or indirectly, to error detection and correction. Topics discussed in this section: Types of Errors Redundancy

### Arithmetic Operations

Arithmetic Operations Arithmetic Operations addition subtraction multiplication division Each of these operations on the integer representations: unsigned two's complement 1 Addition One bit of binary

### P( Hit 2nd ) = P( Hit 2nd Miss 1st )P( Miss 1st ) = (1/15)(15/16) = 1/16. P( Hit 3rd ) = (1/14) * P( Miss 2nd and 1st ) = (1/14)(14/15)(15/16) = 1/16

CODING and INFORMATION We need encodings for data. How many questions must be asked to be certain where the ball is. (cases: avg, worst, best) P( Hit 1st ) = 1/16 P( Hit 2nd ) = P( Hit 2nd Miss 1st )P(

### ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

ECE 550D Fundamentals of Computer Systems and Engineering Fall 2017 Combinational Logic Prof. John Board Duke University Slides are derived from work by Profs. Tyler Bletsch and Andrew Hilton (Duke) Last

### Review. Steps to writing (stateless) circuits: Create a logic function (one per output)

MIPS ALU Review Steps to writing (stateless) circuits: Create a truth table Go through all different combinations of inputs For each row, generate each output based on the problem description Create a

### CPS 104 Computer Organization and Programming

CPS 104 Computer Organization and Programming Lecture 9: Integer Arithmetic. Robert Wagner CPS104 IMD.1 RW Fall 2000 Overview of Today s Lecture: Integer Multiplication and Division. Read Appendix B CPS104

### Chapter 2 Binary Values and Number Systems

Chapter 2 Binary Values and Number Systems Chapter Goals 10 進位 2 / 8 / 16 進位 進位系統間轉換 各進位系統小數表示 各進位系統加減法 各進位系統乘除法 2 24 6 Numbers Natural Numbers Zero and any number obtained by repeatedly adding one to

### The ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop.

CS 320 Ch 10 Computer Arithmetic The ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop. Signed integers are typically represented in sign-magnitude

### Module 3: Representing Values in a Computer

Module 3: Representing Values in a Computer Due Dates Assignment #1 is due Thursday January 19th at 4pm Pre-class quiz #4 is due Thursday January 19th at 7pm. Assigned reading for the quiz: Epp, 4th edition:

### Programming Studio #1 ECE 190

Programming Studio #1 ECE 190 Programming Studio #1 Announcements In Studio Assignment Introduction to Linux Command-Line Operations Recitation Floating Point Representation Binary & Hexadecimal 2 s Complement

### EEM 232 Digital System I

EEM 232 Digital System I Instructor : Assist. Prof. Dr. Emin Germen egermen@anadolu.edu.tr Course Book : Logic and Computer Design Fundamentals by Mano & Kime Third Ed/Fourth Ed.. Pearson Grading 1 st

### Number System (Different Ways To Say How Many) Fall 2016

Number System (Different Ways To Say How Many) Fall 2016 Introduction to Information and Communication Technologies CSD 102 Email: mehwish.fatima@ciitlahore.edu.pk Website: https://sites.google.com/a/ciitlahore.edu.pk/ict/

### Extended Introduction to Computer Science CS1001.py. Lecture 5 Part A: Integer Representation (in Binary and other bases)

Extended Introduction to Computer Science CS1001.py Lecture 5 Part A: Integer Representation (in Binary and other bases) Instructors: Daniel Deutch, Amir Rubinstein Teaching Assistants: Michal Kleinbort,

### UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS (09 periods) Computer Arithmetic: Data Representation, Fixed Point Representation, Floating Point Representation, Addition and

### Numbers and Representations

Çetin Kaya Koç http://koclab.cs.ucsb.edu/teaching/cs192 koc@cs.ucsb.edu Çetin Kaya Koç http://koclab.cs.ucsb.edu Fall 2016 1 / 38 Outline Computational Thinking Representations of integers Binary and decimal

### Chapter 3 Arithmetic for Computers

Chapter 3 Arithmetic for Computers 1 Arithmetic Where we've been: Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's up ahead: Implementing the Architecture operation

### ENE 334 Microprocessors

Page 1 ENE 334 Microprocessors Lecture 10: MCS-51: Logical and Arithmetic : Dejwoot KHAWPARISUTH http://webstaff.kmutt.ac.th/~dejwoot.kha/ ENE 334 MCS-51 Logical & Arithmetic Page 2 Logical: Objectives

### 4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

4 Operations On Data 4.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List the three categories of operations performed on data.

### CHAPTER 2 Data Representation in Computer Systems

CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting

### CARLETON UNIVERSITY. Laboratory 2.0

CARLETON UNIVERSITY Department of Electronics ELEC 267 Switching Circuits Jan 3, 28 Overview Laboratory 2. A 3-Bit Binary Sign-Extended Adder/Subtracter A binary adder sums two binary numbers for example

### Appendix 2 Number Representations

Appendix 2 Number Representations There are many different ways to represent whole numbers. While we are comfortable counting in decimal (0,1,2,3,4,5,6,7,8,9,10,11,12, ), that is only one set of names

### IBM 370 Basic Data Types

IBM 370 Basic Data Types This lecture discusses the basic data types used on the IBM 370, 1. Two s complement binary numbers 2. EBCDIC (Extended Binary Coded Decimal Interchange Code) 3. Zoned Decimal

### Arithmetic Logic Unit

Arithmetic Logic Unit A.R. Hurson Department of Computer Science Missouri University of Science & Technology A.R. Hurson 1 Arithmetic Logic Unit It is a functional bo designed to perform "basic" arithmetic,

### l l l l l l l Base 2; each digit is 0 or 1 l Each bit in place i has value 2 i l Binary representation is used in computers

198:211 Computer Architecture Topics: Lecture 8 (W5) Fall 2012 Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book Computer Architecture What do computers do? Manipulate stored information

### Chapter 10 - Computer Arithmetic

Chapter 10 - Computer Arithmetic Luis Tarrataca luis.tarrataca@gmail.com CEFET-RJ L. Tarrataca Chapter 10 - Computer Arithmetic 1 / 126 1 Motivation 2 Arithmetic and Logic Unit 3 Integer representation

### 1.1. INTRODUCTION 1.2. NUMBER SYSTEMS

Chapter 1. 1.1. INTRODUCTION Digital computers have brought about the information age that we live in today. Computers are important tools because they can locate and process enormous amounts of information

### Computer Arithmetic Ch 8

Computer Arithmetic Ch 8 ALU Integer Representation Integer Arithmetic Floating-Point Representation Floating-Point Arithmetic 1 Arithmetic Logical Unit (ALU) (2) (aritmeettis-looginen yksikkö) Does all

### Computer Arithmetic Ch 8

Computer Arithmetic Ch 8 ALU Integer Representation Integer Arithmetic Floating-Point Representation Floating-Point Arithmetic 1 Arithmetic Logical Unit (ALU) (2) Does all work in CPU (aritmeettis-looginen

### Computer Architecture Set Four. Arithmetic

Computer Architecture Set Four Arithmetic Arithmetic Where we ve been: Performance (seconds, cycles, instructions) Abstractions: Instruction Set Architecture Assembly Language and Machine Language What

### Electronic Data and Instructions

Lecture 2 - The information Layer Binary Values and Number Systems, Data Representation. Know the different types of numbers Describe positional notation Convert numbers in other bases to base 10 Convert

### UNIT 2 NUMBER SYSTEM AND PROGRAMMING LANGUAGES

UNIT 2 NUMBER SYSTEM AND PROGRAMMING LANGUAGES Structure 2.0 Introduction 2.1 Unit Objectives 2.2 Number Systems 2.3 Bits and Bytes 2.4 Binary Number System 2.5 Decimal Number System 2.6 Octal Number System

### Assembler Language "Boot Camp" Part 1 - Numbers and Basic Arithmetic SHARE 115 in Boston August 1-5, 2010

Assembler Language "Boot Camp" Part 1 - Numbers and Basic Arithmetic SHARE 115 in Boston August 1-5, 2010 Introduction Who are we? John Ehrman, IBM Software Group Dan Greiner, IBM Systems & Technology

### Tailoring the 32-Bit ALU to MIPS

Tailoring the 32-Bit ALU to MIPS MIPS ALU extensions Overflow detection: Carry into MSB XOR Carry out of MSB Branch instructions Shift instructions Slt instruction Immediate instructions ALU performance

### Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

Course Schedule CS 221 Computer Architecture Week 3: Information Representation (2) Fall 2001 W1 Sep 11- Sep 14 Introduction W2 Sep 18- Sep 21 Information Representation (1) (Chapter 3) W3 Sep 25- Sep

### Chapter 4: Data Representations

Chapter 4: Data Representations Integer Representations o unsigned o sign-magnitude o one's complement o two's complement o bias o comparison o sign extension o overflow Character Representations Floating

### Applied Computer Programming

Applied Computer Programming Representation of Numbers. Bitwise Operators Course 07 Lect.eng. Adriana ALBU, PhD Politehnica University Timisoara Internal representation All data, of any type, processed