CSE370, Lecture 2 Lecture 2: Number Systems  Logistics Webpage is up! HW1 is posted on the web in the calender --- due.

Slides:



Advertisements
Similar presentations
Company LOGO Edit your slogan here DKT 122/3 DIGITAL SYSTEM 1 WEEK #3 NUMBER SYSTEMS, OPERATION & CODES (PART 2)
Advertisements

Computer Engineering (Logic Circuits) Dr. Tamer Samy Gaafar Lec. # 2
ECE 331 – Digital System Design
King Fahd University of Petroleum and Minerals
Digital Fundamentals Floyd Chapter 2 Tenth Edition
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Number Systems Decimal (Base 10) Binary (Base 2) Hexadecimal (Base 16)
Sistemas Digitais I LESI - 2º ano Lesson 2 - Number Systems U NIVERSIDADE DO M INHO E SCOLA DE E NGENHARIA Prof. João Miguel Fernandes
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
Introduction to Number Systems
Prof. Hakim Weatherspoon CS 3410, Spring 2015 Computer Science Cornell University See: P&H Chapter 2.4, 3.2, B.2, B.5, B.6.
EE 261 – Introduction to Logic Circuits
Number Systems Lecture 02.
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
3. Representing Integer Data
ECE 2110: Introduction to Digital Systems Signed Number Conversions.
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Data Representation – Binary Numbers
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
EKT 121 / 4 ELEKTRONIK DIGIT 1 CHAPTER 1 : INTRODUCTION.
CMPE 325 Computer Architecture II Cem Ergün Eastern Mediterranean University Integer Representation and the ALU.
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
Data Representation and Computer Arithmetic
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
1 Digital Design: Number Systems Credits : Slides adapted from: J.F. Wakerly, Digital Design, 4/e, Prentice Hall, 2006 C.H. Roth, Fundamentals of Logic.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
Number Systems. Today Decimal Hexadecimal Binary –Unsigned Binary –1’s Complement Binary –2’s Complement Binary.
46 Number Systems Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs Display: Seven segment displays Inputs: Switches.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
Number systems, Operations, and Codes
Introduction to Computing Dr. Nadeem A Khan. Lecture 10.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
Lecture 2 Binary Values and Number Systems. The number 943 is an example of a number written in positional notation. The relative positions of the digits.
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 6, 2004 Lecture Number: 6.
ECE 331 – Digital System Design Representation and Binary Arithmetic of Negative Numbers and Binary Codes (Lecture #10) The slides included herein were.
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC
AEEE2031 Data Representation and Numbering Systems.
ECE 301 – Digital Electronics Representation of Negative Numbers, Binary Arithmetic of Negative Numbers, and Binary Codes (Lecture #11) The slides included.
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Digital Representations ME 4611 Binary Representation Only two states (0 and 1) Easy to implement electronically %0= (0) 10 %1= (1) 10 %10= (2) 10 %11=
69 Decimal (Base 10) Numbers n Positional system - each digit position has a value n 2534 = 2*1, * *10 + 4*1 n Alternate view: Digit position.
MECH1500 Chapter 3.
Chapter 1 Number Systems Digital Electronics. Topics discussed in last lecture Digital systems Advantages of using digital signals over analog. Disadvantages.
NUMBER SYSTEMS AND CODES. CS Digital LogicNumber Systems and Codes2 Outline Number systems –Number notations –Arithmetic –Base conversions –Signed.
1 COMS 161 Introduction to Computing Title: Computing Basics Date: September 8, 2004 Lecture Number: 7.
ECE 2110: Introduction to Digital Systems
Lecture 2: 8/29/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
Lecture 1.2 (Chapter 1) Prepared by Dr. Lamiaa Elshenawy
ECE 3110: Introduction to Digital Systems Signed Number Conversions and operations.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
CHAPTER 1 : INTRODUCTION
Logistics Always read the Calendar at
CSE 102 Introduction to Computer Engineering
University of Gujrat Department of Computer Science
Data Representation in Computer Systems
COMS 161 Introduction to Computing
Number Systems Rayat Shikshan Sanstha’s
Number Systems Rayat Shikshan Sanstha’s
Lecture 2: Number Systems
COMS 161 Introduction to Computing
Computer Architecture CST 250
CSE 370 – Winter Number syst.; Logic functions- 1
Presentation transcript:

CSE370, Lecture 2 Lecture 2: Number Systems  Logistics Webpage is up! HW1 is posted on the web in the calender --- due 10/1 10:30am Third TA: Tony Chick list: please sign up on the web. Lab1 starts next week: sections MTW --- show up to pick up your lab kit  Last lecture Class introduction and overview  Today Binary numbers Base conversion Number systems  Twos-complement A/D and D/A conversion

CSE370, Lecture 2

The “WHY” slide  Binary numbers All computers work with 0’s and 1’s so it is like learning alphabets before learning English  Base conversion For convenience, people use other bases (like decimal, hexdecimal) and we need to know how to convert from one to another.  Number systems There are more than one way to express a number in binary. So 1010 could be -2, -5 or -6 and need to know which one.  A/D and D/A conversion Real world signals come in continuous/analog format and it is good to know generally how they become 0’s and 1’s (and visa versa).

CSE370, Lecture 2 Digital  Digital = discrete Binary codes (example: BCD) Decimal digits 0-9  Binary codes Represent symbols using binary digits (bits)  Digital computers: I/O is digital  ASCII, decimal, etc. Internal representation is binary  Process information in bits Decimal Symbols BCD Code

CSE370, Lecture 2 The basics: Binary numbers  Bases we will use Binary: Base 2 Octal: Base 8 Decimal: Base 10 Hexadecimal: Base 16  Positional number system = 1× × × = 6× ×8 0 A1 16 = 10× ×16 0  Addition and subtraction –

CSE370, Lecture 2 Binary → hex/decimal/octal conversion  Conversion from binary to octal/hex Binary: Octal: 10 | 011 | 110 | 001= Hex: 100 | 1111 | 0001=4F1 16  Conversion from binary to decimal = 1× × ×2 0 = = 6× × ×8 –1 = A1 16 = 10× ×16 0 =

CSE370, Lecture 2 Decimal → binary/octal/hex conversion  Why does this work? N=56 10 = Q=N/2=56/2=111000/2=11100 remainder 0  Each successive divide liberates an LSB (least significant bit)

CSE370, Lecture 2 Number systems  How do we write negative binary numbers?  Historically: 3 approaches Sign-and-magnitude Ones-complement Twos-complement  For all 3, the most-significant bit (MSB) is the sign digit 0 ≡ positive 1 ≡ negative  twos-complement is the important one Simplifies arithmetic Used almost universally

CSE370, Lecture 2 Sign-and-magnitude  The most-significant bit (MSB) is the sign digit 0 ≡ positive 1 ≡ negative  The remaining bits are the number’s magnitude  Problem 1: Two representations for zero 0 = 0000 and also –0 = 1000  Problem 2: Arithmetic is cumbersome

CSE370, Lecture 2 Ones-complement  Negative number: Bitwise complement positive number 0011 ≡ ≡ –3 10  Solves the arithmetic problem  Remaining problem: Two representations for zero 0 = 0000 and also –0 = 1111

CSE370, Lecture 2 Twos-complement  Negative number: Bitwise complement plus one 0011 ≡ ≡ –3 10  Number wheel – 8 – 7 – 6 – 5 – 4 – 3 – 2 – 1  Only one zero!  MSB is the sign digit 0 ≡ positive 1 ≡ negative

CSE370, Lecture 2 Twos-complement (con’t)  Complementing a complement  the original number  Arithmetic is easy Subtraction = negation and addition  Easy to implement in hardware

CSE370, Lecture 2 Miscellaneous  Twos-complement of non-integers = – =  Sign extension Write +6 and –6 as twos complement  0110 and 1010 Sign extend to 8-bit bytes  and  Can’t infer a representation from a number is 25 (unsigned) is –9 (sign magnitude) is –6 (ones complement) is –7 (twos complement)

CSE370, Lecture 2 Twos-complement overflow  Summing two positive numbers gives a negative result  Summing two negative numbers gives a positive result  Make sure to have enough bits to handle overflow – 8 – 7 – 6 – 5 – 4 – 3 – 2 – – 8 – 7 – 6 – 5 – 4 – 3 – 2 – ⇒ –6 –7 – 3 ⇒ +6

CSE370, Lecture 2 Gray and BCD codes Decimal Symbols BCD Code Decimal Symbols Gray Code

CSE370, Lecture 2 The physical world is analog  Digital systems need to Measure analog quantities  Speech waveforms, etc Control analog systems  Drive motors, etc  How do we connect the analog and digital domains? Analog-to-digital converter (A/D)  Example: CD recording Digital-to-analog converter (D/A)  Example: CD playback

CSE370, Lecture 2 Sampling  Quantization Conversion from analog to discrete values  Quantizing a signal We sample it Datel Data Acquisition and Conversion Handbook

CSE370, Lecture 2 Conversion  Encoding Assigning a digital word to each discrete value  Encoding a quantized signal Encode the samples Typically Gray or binary codes Datel Data Acquisition and Conversion Handbook