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

Slides:



Advertisements
Similar presentations
Appendix 1 Number Systems Objectives: Review of number systems and radix conversion methods Review of binary, octal, hexadecimal and BCD unsigned codes.
Advertisements

HEXADECIMAL NUMBERS Code
Chapter 1 Binary Systems 1-1. Digital Systems
Wakerly Section 2.4 and further Addition and Subtraction of Nondecimal Numbers.
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Assembly Language and Computer Architecture Using C++ and Java
Assembly Language and Computer Architecture Using C++ and Java
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Number Representation (1) Fall 2005 Lecture 12: Number Representation Integers and Computer Arithmetic.
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
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.
Two’s Complement 1.As an action: (Assume the starting value is 1011) 1.Flip the bits from the starting value => Add one to get the answer.
Introduction to Number Systems
Information Representation and Number Systems BIL- 223 Logic Circuit Design Ege University Department of Computer Engineering.
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.
Fixed-Point Negative Numbers Two Common Forms: 1.Signed-Magnitude Form 2.Complement Forms Signed-Magnitude Numbers First Digit is Sign Digit, Remaining.
NEGATIVE BINARY NUMBER – Digital Circuit 1 Choopan Rattanapoka.
Dr. Bernard Chen Ph.D. University of Central Arkansas
ES 244: Digital Logic Design Chapter 1 Chapter 1: Introduction Uchechukwu Ofoegbu Temple University.
Digital Design: Principles and Practices Chapter 2 Number Systems and Codes.
Data Representation – Binary Numbers
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
ECE 3110: Introduction to Digital Systems Review #1 (Chapter 1,2)
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
Number Systems Spring Semester 2013Programming and Data Structure1.
Chapter 2 Number Systems + Codes. Overview Objective: To use positional number systems To convert decimals to binary integers To convert binary integers.
Yuh-Jzer JoungDigital Systems1 Number Systems decimal number : 7397=7× × × ×10 0 a 4 a 3 a 2 a 1 a 0. a -1 a -2 = a 4 ×10 4 +a 3 ×10.
Number Systems. Why binary numbers? Digital systems process information in binary form. That is using 0s and 1s (LOW and HIGH, 0v and 5v). Digital designer.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
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.
مدار منطقي مظفر بگ محمدي Course Structure & Grading Homework: 25% Midterm: 30% Final:50% There is 5% extra! ( =105!) Textbook:
Lecture 4 Last Lecture –Positional Numbering Systems –Converting Between Bases Today’s Topics –Signed Integer Representation Signed magnitude One’s complement.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
Computer Number Systems. d n-1 d n-2 d n d 2-m d 1-m d -m Conventional Radix Number r is the radixd i is a digit d i Є {0, 1, ….., r – 1 } -m ≤
1 DLD Lecture 18 Recap. 2 Recap °Number System/Inter-conversion, Complements °Boolean Algebra °More Logic Functions: NAND, NOR, XOR °Minimization with.
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
Topic 1 – Number Systems. What is a Number System? A number system consists of an ordered set of symbols (digits) with relations defined for addition,
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
Number Systems Binary to Decimal Octal to Decimal Hexadecimal to Decimal Binary to Octal Binary to Hexadecimal Two’s Complement.
AEEE2031 Data Representation and Numbering Systems.
Digital Design Basics Analog vs Digital Why we need digital? Reproducibility, economy, programmability… Digital Devices Gates, FFs Combinational, sequential.
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design Slide 1 of 14.
Chapter 1: Binary Systems
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.
CPEN Digital Logic Design Binary Systems Spring 2004 C. Gerousis © Digital Design 3 rd Ed., Mano Prentice Hall.
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
Number Representation and Arithmetic Circuits
CSC 331: DIGITAL LOGIC DESIGN COURSE LECTURER: E. Y. BAAGYERE. CONTACT: LECTURE TIME: 15:40 – 17:45 hrs. VENUE: SP-LAB.
ECE 2110: Introduction to Digital Systems
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
ECE DIGITAL LOGIC LECTURE 4: BINARY CODES Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/26/2016.
ECE 3110: Introduction to Digital Systems Number Systems: signed numbers.
Lecture 1.2 (Chapter 1) Prepared by Dr. Lamiaa Elshenawy
ECE 3110: Introduction to Digital Systems Signed Number Conversions and operations.
Computer Math CPS120 Introduction to Computer Science Lecture 7.
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.
1 Digital Logic Design (41-135) Chapter 5 Number Representation & Arithmetic Circuits Younglok Kim Dept. of Electrical Engineering Sogang University Spring.
Lecture 4: Digital Systems & Binary Numbers (4)
Chapter 1 Introduction Digital Systems Digital systems: computation, data processing, control, communication, measurement - Reliable, Integration.
Addition and Subtraction
Number Systems and Codes (parte 1)
Number Representation
Wakerly Section 2.4 and further
MMNSS COLLEGE,KOTTIYAM DEPARTMENT OF PHYSICS
2’s Complement form 1’s complement form 2’s complement form
ECE 331 – Digital System Design
Presentation transcript:

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 Dept. Informática

2. Number Systems - Positional Number Systems -  We use daily a positional number system.  A number is represented by a string of decimal digits, where each digit position has an associated weight. – 5365 = 5* * *10 + 5*1 – = 1* *10 + 2*1 + 3* *0.01  A number D of the form d 1 d 0. d -1 d -2 d -3 has the value: D = d 1 * d 0 * d -1 * d -2 * d -3 *10 -3  10 is called the base or the radix.  Generally, the base can be any integer r >= 2 and a digit position i has weight r i.

2. Number Systems - Binary Numbers -  Digital circuits have signals that are normally in one of two conditions (0 or 1, LOW or HIGH, charged or discharged).  These signals represent binary digits (bits), that can have 2 possible values (0 or 1).  The binary base (r=2) is used to represent numbers in digital systems.  Examples of binary numbers and their decimal equivalents: – = 1*16 + 1*8 + 0*4 + 1*2 + 0*1 = – = 1*32 + 0*16 + 0*8 + 1*4 + 1*2 + 1*1 = – = 1*2 + 0*1 + 0*0,5 + 1*0,25 + 1*0,125 = 2,  MSB: most significant bit; LSB: least significant bit.

2. Number Systems - Octal and Hexadecimal Numbers -  The octal number system uses base 8 (r=8). It requires 8 digits, so it uses digits 0-7.  The hexadecimal number system uses base 16 (r=16). It requires 16 digits, so it uses digits 0-9 and letters A-F.  These number systems are useful for representing multibit numbers, because their bases are powers of 2.

2. Number Systems

2. Number Systems - Conversions (1) -  Binary - Octal – = = – = =  Binary - Hexadecimal – = = D28 16 – = = 31BA 16  Octal - Binary – = =  Hexadecimal - Binary – 19F 16 = =

2. Number Systems - Conversions (2) -  In general, conversions between two bases cannot be done by simple substitutions. Arithmetic operations are required.  Examples of Base r to Decimal Conversions: – = 1* * * * * * * *2 0 = – 19F 16 = 1* * *16 0 = – = 4* * * *8 0 = – = 3* * * * *8 -2 = 201, – = 1* * * * *5 -2 = 44,08 10

2. Number Systems - Conversions (3) -  Example of Decimal to Binary Conversions ( = ) – 138÷2 = 69 remainder 0 – 69÷2 = 34 remainder 1 – 34÷2 = 17 remainder 0 – 17÷2 = 8 remainder 1 – 8÷2 = 4 remainder 0 – 4÷2 = 2 remainder 0 – 2÷2 = 1 remainder 0 – 1÷2 = 0 remainder 1

2. Number Systems - Conversions (4) -  Example of Decimal to Octal Conversions ( = ) – 2099÷8 = 262 remainder 3 – 262÷8 = 32 remainder 6 – 32÷8 = 4 remainder 0 – 4÷8 = 0 remainder 4  Example of Decimal to Hexadecimal Conversions ( = 19F 16 ) – 415÷16 = 25 remainder 15 (F) – 25÷16 = 1 remainder 9 – 1÷16 = 0 remainder 1

2. Number Systems - Addition of Binary Numbers -  The only difference is that the table are distinct.  Table for addition of two binary digits.  Similar tables can be built for other bases.  Example of a binary addition:  Addition and Subtraction of Non-Decimal Numbers use the same technique that we use for decimal numbers.

2. Number Systems - Representation of Negative Numbers -  There are many ways to represent negative numbers with bits. – Signed-Magnitude Representation – Complement Number Systems – Radix-Complement Representation  Two’s-Complement Representation – Diminished Radix-Complement Representation  One’s-Complement Representation – Excess Representations

2. Number Systems - Signed-Magnitude Representation -  A number consists of a magnitude and a symbol indicating whether the magnitude is positive or negative.  In binary systems, we use an extra bit (usually the MSB) to indicate the sign (0=plus, 1=minus).  Some 8-bit signed-magnitude integers: = = = = = =  For n bits, number  {-2 n n-1 -1}; n=8, number  { }.  There are two representations of zero: “+0” e “-0”.

2. Number Systems - Two’s-Complement Representation -  The radix-complement is called 2’s-complement, for binary numbers. Most computers use it to represent negative numbers.  The MSB of a number serves as the sign bit.  The weight of the MSB is -2 n-1. The other bits have weight +2 i.  For n bits, number  {-2 n n-1 -1}; n=8, number  { }.  Only one representation of zero  an extra negative number.  Some 8-bit integers and their two’s complements: – =  = = – 0 10 =  = = 0 10 – =  = =

2. Number Systems - One’s-Complement Representation -  The diminished radix-complement is called 1’s-complement, for binary numbers.  The MSB of a number serves as the sign bit.  The weight of the MSB is -2 n The other bits have weight +2 i.  For n bits, number  {-2 n n-1 -1}; n=8, number  { }.  Two representations of zero ( and ).  Some 8-bit integers and their one’s complements : – =  = – =  = – =  =

2. Number Systems - Why Two’s-Complement? -  Hard to build a digital circuit that adds signed-magnitude numbers.  In 1’s-complement, there are two zero representations.  A 1’s-complement adder is more complex that a 2’s complement adder.

2. Number Systems - Two’s-Complement Addition and Subtraction (1) -  We can add +n, by counting up (clockwise) n times.  We can subtract +n, by counting down (counterclockwise) n times.  Valid results if the discontinuity between -8 and +7 is not crossed.  We can also subtract +n, by counting up (clockwise) 16-n times.

2. Number Systems - Two’s-Complement Addition and Subtraction (2) -  Overflow occurs when an addition produces a result that exceeds the range of the number system.  Addition of 2 numbers with different signs never produces overflow.  An addition overflows if the signs of the addends are the same and the sign of the sum is different form the addends’ sign.  Examples of overflowed additions:

2. Number Systems - Two’s-Complement Addition and Subtraction (3) -  The same adder circuit can be used to handle both 2’s- complement and unsigned numbers.  However the results must be interpreted differently.  Valid results if the discontinuity between 15 and 0 is not crossed.

2. Number Systems - Binary Codes for Decimal Numbers -  People prefer to deal with decimal numbers.  A decimal number is represented by a string of bits.  A code is a set of bit strings in which different strings represent different numbers (entities).  A particular combination of bits is a code word.

2. Number Systems - Gray Code (1) -  Input sensor indicates a mechanical position.  Problems may arise at certain boundaries.  Boundary between 001 and 010 regions (2 bits change).  A solution is to devise a digital code in which only one bit changes between successive codes.

2. Number Systems - Gray Code (2) -  Gray code solves that problem!  Only one bit changes at each border.  Gray codes are also used in Karnaugh maps, since adjacent cells must differ in just one input variable.