SE311: Design of Digital Systems

Similar documents
Lecture (02) Operations on numbering systems

Lecture 2: Number Systems

Digital Systems and Binary Numbers

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

Korea University of Technology and Education

Hybrid Electronics Laboratory

Lecture (03) Binary Codes Registers and Logic Gates

Number System. Introduction. Decimal Numbers

CS 121 Digital Logic Design. Chapter 1. Teacher Assistant. Hadeel Al-Ateeq

Digital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes

Chapter 1. Digital Systems and Binary Numbers

Digital Systems and Binary Numbers

Computer Organization

Binary Codes. Dr. Mudathir A. Fagiri

MACHINE LEVEL REPRESENTATION OF DATA

Digital Fundamentals

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

Number Systems Base r

DIGITAL SYSTEM DESIGN

Logic Circuits I ECE 1411 Thursday 4:45pm-7:20pm. Nathan Pihlstrom.

Basic Definition INTEGER DATA. Unsigned Binary and Binary-Coded Decimal. BCD: Binary-Coded Decimal

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Electronic Data and Instructions

Computer Sc. & IT. Digital Logic. Computer Sciencee & Information Technology. 20 Rank under AIR 100. Postal Correspondence

Digital Systems and Binary Numbers

Binary Systems and Codes

Data Representation and Binary Arithmetic. Lecture 2

Ms Sandhya Rani Dash UNIT 2: NUMBER SYSTEM AND CODES. 1.1 Introduction

Microcomputers. Outline. Number Systems and Digital Logic Review

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation

Numbering systems. Dr Abu Arqoub

Chapter 1 Review of Number Systems

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


Moodle WILLINGDON COLLEGE SANGLI. ELECTRONICS (B. Sc.-I) Introduction to Number System

Review of Number Systems

Digital Fundamentals

a- As a special case, if there is only one symbol, no bits are required to specify it.

Chapter 1 Emad Felemban

CHW 261: Logic Design

Advanced Computer Architecture-CS501

MYcsvtu Notes DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes

CHAPTER 2 (b) : AND CODES

CHAPTER TWO. Data Representation ( M.MORRIS MANO COMPUTER SYSTEM ARCHITECTURE THIRD EDITION ) IN THIS CHAPTER

Chapter 2 Number System

Chapter 3: Number Systems and Codes. Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc.

Digital Systems COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals

LOGIC CIRCUITS. Kirti P_Didital Design 1

DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes. Error Detection Codes

Module -10. Encoder. Table of Contents

Binary. Hexadecimal BINARY CODED DECIMAL

Fundamentals of Programming (C)

LOGIC DESIGN. Dr. Mahmoud Abo_elfetouh

COMP Overview of Tutorial #2

Chapter 3: part 3 Binary Subtraction

Positional Number System

World Inside a Computer is Binary

Number Systems. Dr. Tarek A. Tutunji Philadelphia University, Jordan

Chapter 10 Binary Arithmetics

Logic and Computer Design Fundamentals. Chapter 1 Digital Computers and Information

Binary Addition. Add the binary numbers and and show the equivalent decimal addition.

Fundamentals of Programming

SISTEMI EMBEDDED. Basic Concepts about Computers. Federico Baronti Last version:

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

Number Systems & Encoding

UNIT 7A Data Representation: Numbers and Text. Digital Data

Chapter 2 Data Representations

Groups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...

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

Thus needs to be a consistent method of representing negative numbers in binary computer arithmetic operations.

Data Representations & Arithmetic Operations

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.

Integers. N = sum (b i * 2 i ) where b i = 0 or 1. This is called unsigned binary representation. i = 31. i = 0

Digital Fundamentals

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

Homework 1 graded and returned in class today. Solutions posted online. Request regrades by next class period. Question 10 treated as extra credit

CS101 Lecture 04: Binary Arithmetic

Software and Hardware

EE 109 Unit 2. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

Introduction to Numbering Systems

EE 109 Unit 3. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

CS & IT Conversions. Magnitude 10,000 1,

Numeric Encodings Prof. James L. Frankel Harvard University

Chap 1. Digital Computers and Information

M1 Computers and Data

COMP2121: Microprocessors and Interfacing. Number Systems

Unit 3. Analog vs. Digital. Analog vs. Digital ANALOG VS. DIGITAL. Binary Representation

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

Number codes nibble byte word double word

EE 109 Unit 2. Binary Representation Systems

Lecture 1: Digital Systems and Number Systems

Chapter 2. Data Representation in Computer Systems

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

EE292: Fundamentals of ECE

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

CO Computer Architecture and Programming Languages CAPL. Lecture 9

DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM

Chapter 4. Combinational Logic

Electronics Engineering ECE / E & T

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

Transcription:

SE311: Design of Digital Systems Lecture 3: Complements and Binary arithmetic Dr. Samir Al-Amer (Term 041) SE311_Lec3 (c) 2004 AL-AMER ١

Outlines Complements Signed Numbers Representations Arithmetic Binary Codes Binary Storage Binary logic SE311_Lec3 (c) 2004 AL-AMER ٢

Complements Complements are used to represent negative numbers They make subtraction easier Subtraction is replaced by addition of a number to the complement of the second A - B = A+ (- B) X = The complement of (complement of X) X= - (-X) Two types of complement (r-1) s complement (Diminished radix complement) r s complement (Radix complement) Complements of numbers with fractions: remove the radix point, obtain the complement and return the radix point to its position. SE311_Lec3 (c) 2004 AL-AMER ٣

Complements (r-1) s complement (Diminished radix complement) BINARY: 1 s complement DECIMAL: 9 s complement Complement( X ) = ( r 1' s Complement( X ) = (2 n 1) n X 1) X r s complement (Radix complement) BINARY : 2 s complement DECIMAL: 10 s complement Complement( X ) = 2' s Complement( X ) = 2 r n X n X n : the number of digits used in the representation r : the base r s complement of X =1+ (r-1) s complement of X 2 s complement of X = 1+ 1 s complement of X SE311_Lec3 (c) 2004 AL-AMER ٤

Complement 1 s complement n digits are used in the representation To obtain the 1 s complement: Replace 0 by 1 and 1 by 0 2 s complement n digits are used in the representation To obtain the 2 s complement: Add one to the 1 s complement Example: 8 digits are used (n=8) X = 0 0 0 0 1 0 0 1 9 1 s Complement (X) = 1 1 1 1 0 1 1 0-9 in 1 s complement 2 s Complement (X) = 1 1 1 1 0 1 1 1-9 in 2 s complement SE311_Lec3 (c) 2004 AL-AMER ٥

Subtraction with Complement M-N=M+ 2 s complement (N) Discard the carry MSB indicates the sign 1 : Negative M<N 0 : Positive M>N Negative numbers are represented in 2 s complement Example: (n=8) M= 0 0 0 0 1 1 0 0 N = 0 0 0 0 1 0 0 1 2 s Complement (N) = 1 1 1 1 0 1 1 1 M-N = 0 0 0 0 1 1 0 0 + 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 1 1 Carry (positive) answer SE311_Lec3 (c) 2004 AL-AMER ٦

Subtraction with Complement Example: (n=8) M= 0 0 0 0 1 1 0 0 N = 0 0 0 1 1 0 0 1 2 s Complement (N) = 1 1 1 0 0 1 1 1 M-N = 0 0 0 0 1 1 0 0 12 + 1 1 1 0 0 1 1 1-25 1 1 1 1 0 0 1 1-13 No Carry (negative) answer SE311_Lec3 (c) 2004 AL-AMER ٧

Binary Codes SE311_Lec3 (c) 2004 AL-AMER ٨

Binary Codes A binary code is a rule used to assign a binary number for each discrete element. With n-bit code we can represent up to 2 n discrete elements Important Binary Codes BCD (Binary Coded Decimal) ASCII (American Standard code for information interchange) Gray code Excess 3 code SE311_Lec3 (c) 2004 AL-AMER ٩

Binary Coded Decimal Each decimal digit is represented by four-digit binary code. Decimal BCD Decimal BCD 0 0000 5 0101 1 0001 6 0110 2 0010 7 0111 3 0011 8 1000 4 0100 9 1001 ( 125 )D ( 0001 0010 0101 )BCD one needs 8-bits to represent the binary equivalent of 125 and 12-bits to represent the BCD equivalent. SE311_Lec3 (c) 2004 AL-AMER ١٠

Gray Code Useful in applications like analog to digital conversion. The code of a number differ from the code of the next number in exactly one bit Decimal Gray code Decimal Gray code 0 0000 5 0111 1 0001 6 0101 2 0011 7 0100 3 0010 8 1100 4 0110 9 1101 SE311_Lec3 (c) 2004 AL-AMER ١١

ASCII Code American Standard Code for Information Interchange Used in communicating information between a computer and its peripherals or other computers. Each letter, digit or character is represented by 7-bit code Character ASCII Character ASCII A 100 0001 0 011 0000 a 110 0001 1 011 0001 ESC 0011010 BS 000 1000 ASCII code (128 discrete elements: 94 printable characters and 34 control characters) SE311_Lec3 (c) 2004 AL-AMER ١٢

Binary Storage and Registers Binary Cell a device that has two possible states. can be used to store a single bit Registers: a group of binary cells n-bit registers: can store n-bit binary numbers Question: How many different possible states can n-bit registers have? SE311_Lec3 (c) 2004 AL-AMER ١٣

Binary Logic SE311_Lec3 (c) 2004 AL-AMER ١٤

Binary Logic Binary Logic involves binary variables and Logic operations Binary variables Can take one of two possible values ( 0 or 1). Designated by letters A, B,C, x, y, z Logic Operations Three basic operations AND, OR, NOT. SE311_Lec3 (c) 2004 AL-AMER ١٥

OR x OR y x x+y y The number of possible combinations of n binary inputs is 2 n x 0 0 1 1 Truth Table y x+y 0 0 1 1 0 1 1 1 SE311_Lec3 (c) 2004 AL-AMER ١٦

AND x AND y x xy y Truth Table x y xy 0 0 0 0 1 0 1 0 0 1 1 1 SE311_Lec3 (c) 2004 AL-AMER ١٧

NOT NOT x x x Truth Table X 0 1 X 1 0 SE311_Lec3 (c) 2004 AL-AMER ١٨

Summary Complements r s complement 2 s complement (Binary) (r-1) s complement 1 s complement (Binary) Signed Numbers Representations Arithmetic Binary Codes (BCD, Gray, ASCII ) Binary Storage (Binary cell, register) Binary logic (binary variables, logic operations) SE311_Lec3 (c) 2004 AL-AMER ١٩

Learning Objectives Be able to calculate the 2's complement of a given n-bit binary number. Be able to explain the differences between signed-magnitude, signed-1's complement and signed-2's complement representations of negative binary numbers. Be able to perform subtraction problems in base 2 using the 2's complement method. Be able to determine the minimum number of bits needed to represent a given set of items. Be able to name and compare binary codes. Be able to explain the purpose and special feature of Gray codes. Be able to translate a message from ASCII code into standard English characters. (assuming that an ASCII code table is available) Know the definition of a binary cell. Know the definition of a register. Know the AND, OR and NOT truth tables. Know the logic gate and operator symbols for the AND, OR and NOT. SE311_Lec3 (c) 2004 AL-AMER ٢٠