Chapter 1 : Introduction to Binary Systems 1.1. Introduction to Digital Systems 1.2. Binary Numbers 1.3. Number Base Conversion 1.4. Octal and Hexadecimal Numbers 1.5. Complements 1.6. Signed Binary Numbers 1.7. Arithmetic Operations in Bases 1.8. Logic Gates Chapter 1 – page: 1 EE208: Logic Design 1434- 1435 Dr. Ridha Jemal By Dr. Ridha Jemal Electrical Engineering Department College of Engineering King Saud University 1434-1435
28
Embed
Chapter 1 : Introduction to Binary Systems 1.1. Introduction to Digital Systems 1.2. Binary Numbers 1.3. Number Base Conversion 1.4. Octal and Hexadecimal.
Chapter 1 – page: 3 Discrete elements of information are represented in digital system by physical quantities called signals (Electrical Signals like voltage or current) The electronic device called transistor predominates in the circuitry that implements these signals. The signals use just two discrete values and therefore said to be binary. Therefore, a digital system designer must establish some correspondence between the binary digits processed by digital circuits and real-life numbers, events, and conditions. In Electrical Wire: 0 refers to the state “No current in the wire” 1 refers to the state “There is a current in the wire” Discrete elements of information are represented with a group of bits called binary Codes. For example: Decimal digits 0 to 9 are represented in digital system with code of 4 bits. Introduction to Digital Systems EE208: Logic Design Dr. Ridha Jemal
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Chapter 1 : Introduction to Binary Systems
1.1. Introduction to Digital Systems1.2. Binary Numbers1.3. Number Base Conversion1.4. Octal and Hexadecimal Numbers1.5. Complements1.6. Signed Binary Numbers1.7. Arithmetic Operations in Bases1.8. Logic Gates
Chapter 1 – page: 1EE208: Logic Design 1434-1435
Dr. Ridha Jemal
By Dr. Ridha JemalElectrical Engineering Department
College of EngineeringKing Saud University
1434-1435
Introduction to Digital Systems
Chapter 1 – page: 2
• Digital systems are built from circuits that process binary digits 0s and 1s and are used in:
o Communication;oTraffic control and Space guidance;o Medical treatment;o Weather monitoring;o Digital telephone, Television and Camerao Digital Computer and Internet
The purpose of this chapter is to show you how familiar numeric quantities can be represented and manipulated in a digital system, and how nonnumeric data, events, and conditions also can be represented
• One characteristic of Digital Systems is their ability to manipulate discrete element of information like : o 10 decimal digits from 0..9 ; o 26 letters of the alphabet from a.. Zo etc…
EE208: Logic Design 1434-1435
Dr. Ridha Jemal
Chapter 1 – page: 3
• Discrete elements of information are represented in digital system by physical quantities called signals (Electrical Signals like voltage or current) The electronic device called transistor predominates in the circuitry that implements these signals. The signals use just two discrete values and therefore said to be binary.
• Therefore, a digital system designer must establish some correspondence between the binary digits processed by digital circuits and real-life numbers, events, and conditions.
•In Electrical Wire: 0 refers to the state “No current in the wire”1 refers to the state “There is a
current in the wire”•Discrete elements of information are represented with a group of bits called binary Codes.For example: Decimal digits 0 to 9 are represented in digital system with code of 4 bits.
Introduction to Digital Systems
EE208: Logic Design 1434-1435
Dr. Ridha Jemal
Chapter 1 – page: 4
• The Digital System is a system that manipulates discrete elements of information that is represented internally in binary form.
The general purpose of digital compute is the best known example of digital system. The major parts of a computer are:
o Central Processor Unit: It performs arithmetic and logic operations and other data processing.o Memory Unit: It stores programs as well as input, output and intermediate data.o Input/Output Unit: The program and data prepared by a user are transferred into memory by means of an input device such as keyboard. An output device as printer, receives the results of the computation to be printed.
Introduction to Digital Systems
EE208: Logic Design 1434-1435
Dr. Ridha Jemal
Chapter 1 – page: 5
To understand the operation of each digital module it is necessary to have a basic knowledge of digital circuits and their logic function
The digital computer manipulates :oNumerical values;oLogic Values;oSet of symboloMisc objects: voice, images, etc…
CPU
Memory
IO
A digital System is an interaction of digital modules
Introduction to Digital Systems
EE208: Logic Design 1434-1435
Dr. Ridha Jemal
Chapter 1 – page: 6
Binary Numbers
EE208: Logic Design 1434-1435
Dr. Ridha Jemal
A decimal number 7251 represents a quantity equal to :7 thousands + 2 hundreds + 5 tens + 1 unit
To be more exact this number should be written as:7 x 103+ 2 x 102 + 5 x 101 + 1 x 100
• In general a number with decimal point is represented by a series of coefficients as follows :
a4 a3 a2 a1 a0 • a-1 a-2 a-3
• The aj coefficients are any of the 10 digits (0, 1, 2, …, 9), and the subscript value j gives the place value and, hence, the power of 10 by which the coefficient must be multiplied. This can be expressed as:
• The General form can be expressed as: anx10n + an-1x10n-1 + • • • + a0x100 + a-1x10-1 + • • • + a-mx10-m
n = (digit number before the point )-1m = digit number after the point
Chapter 1 – page: 7EE208: Logic Design 1434-1435
Dr. Ridha Jemal
The decimal number system is said to be of base or radix 10 because it uses 10 digits and the coefficient are multiplied by power of 10.• The binary system is a different number system. The coefficients of the binary
number have only two possible values : 0 or 1. Each coefficient aj is multiplied by 2j
• For example, the decimal equivalent of the binary number 11010.11 is ……….. as shown from the multiplication of the coefficient by powers of 2
• For example, a number expressed in a base-r system has coefficients multiplied by powers of r
an x rn + an-1 x rn-1 + • • • + a2 x r2 + a1 x r1 + a0 x r0 + a-1 x r-1 + • • • + a-m x r-m
Binary Numbers
Chapter 1 – page: 8EE208: Logic Design 1434-1435
Dr. Ridha Jemal
Binary Numbers
There are may bases:oBinary System : r = 2 It manipulates 2 digits or bits 0, 1oBase-5 System: r = 5 It manipulates 5 digits : 0, 1, 2, 3, 4oOctal System : r = 8 It manipulates 8 digits : 0, 1, 2, 3, 4, 5, 6, 7oHexadecimal System : r = 16 It manipulates 16 digits : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Examples:o (4021.2)5 = o (127.4)8 = o (B65F)16 = o (110101)2 =
511.4 10
87.5 10
46687 10
53 10
Chapter 1 – page: 9
Number Base Conversion
EE208: Logic Design 1434-1435
Dr. Ridha Jemal
The conversion of a number in base r to decimal is done by expanding the number in a power series and adding the terms as shown previously:In fact, the general form of a number D is :
an …. a2 a1 a0 • a-1 a-2 …a-mAnd its value expressed in the base r is:
where r is the radix of the number and there are n digits to the left of the radix point and m to the right. For example if r=10, the value of the number can be found by converting each digit of the number to its radix-10 equivalent and expanding the formula using radix-10 arithmetic. Some examples are given below:
an x rn + an-1 x rn-1 + • • • + a2 x r2 + a1 x r1 + a0 x r0 + a-1 x r-1 + • • • + a-m x r-m
Chapter 1 – page: 10EE208: Logic Design 1434-1435
Dr. Ridha Jemal
Number Base ConversionWe now present a general procedure for the reverse operation of converting a decimal number to a number of base r
Consider what happens if we divide the formula by r we will get a quotient Q and a reminder di. The quotient has the same form as the original formula .Therefore, successive divisions by r will yield successive digits of D from right to left, until all the digits of D have been derived.
The sequence of reminders are listed in the reverse order of the division processDecimal Integer to Binary Conversion
Binary to Octal/Hexadecimal ConversionThe conversion is easily accomplished by partitioning the binary number into group of three digits for the octal conversion and four digits for the hexadecimal conversion
• The conversion from and to binary, octal and Hexadecimal plays an important role in digital computers. Since 23=8 and 24=16 each octal digit corresponds to three binary digits and each hexadecimal digit correspond to four binary digits.
Octal/Hexadecimal to Binary ConversionConversion from octal or hexadecimal to binary is done by reversing the preceding procedure . Each octal digit is converted to its three-digit binary equivalent. Similarly, each hexadecimal digit is converted to its four-digit binary equivalent.
Examples : o (673.124)8 = (110 111 011. 001 010 100)2 o (306.D)16 = (0011 0000 0110 . 1101)2
• Complements are used in digital computer for simplifying the subtraction operation and for logical manipulation. There are two types of complements for each base-r system:
• Given a number N in base r having n digits, the (r-1)’s complement of N is defined as (rn – 1) –N
o For r=10, r-1=9, so the 9’s complement of N is (10n -1) – NThe 9’s complement of 546700 is 999999 – 546700 = 453299The 9’s complement of 012398 is 999999 – 012398 = 987601
o For r=2, r-1=1, so the 1’s complement of N is (2n -1) – No N=4 ; 24= 100002 and 24 – 1=1111. The 1’s complement is obtained by subtracting
each digit from 1. We have one of the following cases :1 -0 or 1-1.
The (r-1)s complement
Chapter 1 – page: 15
Complements
EE208: Logic Design 1434-1435
Dr. Ridha Jemal
• The r’s complement = the (r-1)’s complement + 1 [(rn – 1) –N]+1
o For r=10, The 10’s complement of 012398 is 987602The 10’s complement of 246700 is 753300
o For r=2,
Given a binary umber 10100101The 1’s complement of 10100101 is 01011010The 2’s complement of 10100101 is 01011010+1 = 01011011
The radix complement (r’s complement)
The 1’s complement is obtained by changing 1’s to 0’s and 0’s to 1’sThe 1’s complement of 1011000 is 0100111
Chapter 1 – page: 16
Signed Binary Numbers
EE208: Logic Design 1434-1435
Dr. Ridha Jemal
Negative Number
• The sign is represented by a bit placed in the leftmost position of the number. The convention is to make the sign bit 0 for positive 1 for negative.
• Positive integers can be represented by unsigned numbers. However, to represent negative integers, we need a notation for negative values
0 1010010 as unsigned number is equal to :
1 1010010 as unsigned number is equal to :
1 1010010 as signed number is equal to :
Chapter 1 – page: 17
Signed Binary Numbers
EE208: Logic Design 1434-1435
Dr. Ridha Jemal
Number line extends in both directions:
Ways to represent numbers less than zero:
Signed MagnitudeUse MSB as a flag: 0=+ve, 1=-ve ("sign bit") All other bits hold the magnitude eg. using 4 bits
0110 = 61010 = -2
One’s Complement• Given a number N in base 2 having n digits, the 1’s complement of N is
defined as (2n – 1) –N The 1’s complement is obtained by changing 1’s to 0’s and 0’s to 1’s
The 1’s complement of 1011011 is 0100100
Chapter 1 – page: 18
Signed Binary Numbers
EE208: Logic Design 1434-1435
Dr. Ridha Jemal
Two’s ComplementTo negate number: Invert all bits and add 1 ; eg. -2 using 8 bits* 0000 0010 inverted is 1111 1101* Add 1: 1111 1110 (-2)Another way: Start writing down the number from left.
Write the number exactly as it appears until the first one.Write down the first one and invert all digits to its left
Examples : Find the 2’s complement using 8 bits1. +8 = 00001000
1000 write number to first one 111 invert the remaining bits
• If the signs are different, we subtract the smaller magnitude from the larger and we give the result the sign of the larger magnitude. This process requires a comparison and subtraction. So we will use only the addition in the signed complement system without need to use the comparison and the subtraction.Subtraction = Addition of the 2’s complement of the negative number
Chapter 1 – page: 20EE208: Logic Design 1434-1435
Dr. Ridha Jemal
Arithmetic Operations in bases (Add, Sub)
• Example 2 +17 010001 010001 -8 101000 111000 2’s complement of 001000The sign bit is not complemented -----------------------------------------------------+9 001001
• If the result is negative, we will take its 2’s complement to get the final result
• Example 3:+ 24 0011000 0011000- 35 1100011 1011101 2’s complement of
11011011 It’s a negative number, we take its 2’s complement which is : 00100101 equal to - 37
Arithmetic Operations in bases (Add, Sub)
Chapter 1 – page: 22
Binary Code – Character Sets
EE208: Logic Design 1434-1435
Dr. Ridha Jemal
ASCII - American Standard Code for Information Interchange a.k.a ISO 646-1973 (international)BS 4730: 1974 (British Standard)7-bit code (128 different characters)Numerals, punctuation and lettersAmerican alphabet...... no symbols for ö, å, ñ etc.Still VERY widely used
EBCDIC - Extended Binary-Coded-Decimal Interchange Code Proprietary to IBM 8-bit code Not compatible with ASCII
ISO Latin1 - 8-bit code Extension to ASCII (ASCII is compatible) Has characters for European languages
Future - include ALL characters from ALL languages (!) Unicode (16 bits)
ISO 10646 (32 bits)
Chapter 1 – page: 23
Binary Codes
EE208: Logic Design 1434-1435
Dr. Ridha Jemal
• Digital Systems represent and manipulate not only binary numbers but also many other discrete elements of information which can be represented by a binary code.
• An n-bit binary code is a group of n bits that assume up to 2n distinct combinations of 1’s and 0’s.Examples:o A set of four elements can be coded with two bits: 00, 01, 10 and 11o A set of 16 elements requires a 4-bit code
• A number with k decimal digits will require 4k bits in BCD
• (396)10 = (0011 1001 0110)BCD
Chapter 1 – page: 24
Binary Codes
EE208: Logic Design 1434-1435
Dr. Ridha Jemal
• Consider the addition of two decimal digits in BCD, together with a possible carry from previous less significant pair of bits:If the result is greater or equal 1010, the result is an invalid BCD digit; The addition of 6 = (0110)2 to the binary sum converts it to the correct digit and also produces a carry as required.
• Binary Logic consists on Binary variables and Logical operationso Variables : A, B, C, …. Z, a, b, c, …1, 2, 3 expressed in the binary systemo Logical Operations : 3 fundamental operations A ND, OR, INV
A B C0 0 00 1 01 0 01 1 1
AND : Result TRUE if and only if both input operands are true
C= A•B
Its graphic Symbol is:
AB
C
Chapter 1 – page: 28
Binary Logic
EE208: Logic Design 1434-1435
Dr. Ridha Jemal
A B C0 0 00 1 11 0 11 1 1
OR : Result TRUE if operands are trueC= A+BIts graphic Symbol is: