Beruflich Dokumente
Kultur Dokumente
Design
Attendance
It is important to attend the lecture. You have a Quiz during it.
You need to attend at least 75% of the tutorials.
Not attending this % of tutorials will result in being barred from final exam.
Reference
“Digital Design”, Third Edition; 2002; M. Morris Mano; Pearson Education Asia
Course specifications
Go to http://eng.shams.edu.eg
Click on Quality assurance link
Than click Course specifications
Go to Course no. 314
Ain Shams University Faculty of Engineering
Computer and Systems Department Digital Design
Chapter 1
Dr. Mona Fahmy 2008/2009
Chapter 1
Binary System
The Chapter
Chapter will cover:
Binary numbers
Number base conversion
Octal and hexadecimal numbers
Complements
Binary
Overview
Digital design is concerned with the design and implementation of digital circuits. Digital systems exist
on computers, controllers, communications systems, memory, input and output devices. It deals with
the manipulation of discrete information.
Number systems
In a system which its base is b, a positive number N represents the polynomial:
q −1
N = aq - 1 b q -1 + … + a 0 b 0 + … + a -p b -p = ∑a b
i=− p
i
i
Where b is an integer > 1, a’s are integer in the range 0 ≤ ai ≤ b-1. The sequence of digits aq-1 …. a0
constitutes the integral part of N, while the sequence of digits a-1 …. a-p constitutes the fractional part of
it. The least significant digit of N is a-p, while the most significant digit of N is aq-1.
As an example:
(86.4)r = 6* r0 + 8* r1 +4* r -1
3/ 14
Ain Shams University Faculty of Engineering
Computer and Systems Department Digital Design
Chapter 1
Dr. Mona Fahmy 2008/2009
Conversion of bases:
bases:
Conversion bases are to convert any number N which is represented in base b1 to other base b1.
To convert a number in any base to decimal;
Express (N) b as a polynomial in powers of b and evaluating it using base10 arithmetic.
Examples 1:
1. (C3AF)16 = (F* 160 + A* 161 + 3* 16 2 + C* 163 ) = (15 * 160 + 10 * 161 + 3* 16 2 + 12 * 163 )
= (50095)10
2. (1.11010)2 = (1 * 20 + 1* 2 -1 + 1* 2 -2 + 0* 2 -3 + 1* 2 -4 + 0* 2 -5) = (1.8125)10
3. (432.2)8 = 4 x 82 + 3 x 81 + 2 x 80 + 2 x 8-1 = (282.25)10
4. (101)2 = 1 x 22 + 0 x 21 + 1 x 20 = 4 + 1 = (5)10
(N)10 = aq - 1 b q -1 + … + a 1 b1 + a 0 b 0
4/ 14
Ain Shams University Faculty of Engineering
Computer and Systems Department Digital Design
Chapter 1
Dr. Mona Fahmy 2008/2009
To find ai’s, divided this polynomial by b, the reminder is the least significant digit of the equivalent
number in base b. Divide the its quotient by b, the reminder of this step is the next significant digit.
Repeat these steps till the quotient = 0
Examples 2:
Convert (548)10 to base 8. i Qi ri
0 548/8 68 4
1 68/8 8 4
2 8/8 1 0
(548)10 = (1044) 8 3 1/8 0 1
( N )10 = a -1 b -1 + a -2 b -2 + ... + a -p b -p
The most significant digit a-1 obtained by multiplying the polynomial by b. If the product < 1, then the
most significant digit = 0, otherwise, it is = the integer part of the product. The next most significant is
found by multiplying the fractional part of the above product by b and determining its integral part, and
so on.
This process does not necessarily terminate.
Example 3:
Convert (0.3125)10 to base 6.
Example 4:
Convert (432.354)10 to base 4.
(432.354)10 = (12300.11222)4
Since 23 = 8 and 24 = 16, so one octal digit can be expressed by three binary digits and one
hexadecimal digit can be represented by 4 binary digits.
Example 5:
Convert (123.4)8 to base 2.
(123.4)8 = (001010011.100)2
Example 6:
Convert (306.D)16 to base 2.
(306.D)16 = (0011 0000 0110.1101)2
Example 7:
Convert (1010110.0101)2 to base 8 and base 16.
(001 010 110.0101)2 = (126.24)8
Example 9:
Convert (63)10 to base 2, 8 and base 16.
(63)10 = ( 111 111 )2 = (77)8= (3F)16
Example 10:
Convert (41)10 to base 8 and base 2.
(41)10 = (51)8= (101001)2
Example 11:
Convert (78)10 to base 16 and base 2.
(78)10 = (4E)16= (01001110)2
Binary Arithmetic:
Bits Sum Carry Difference Borrow Product
a b a+b a-b a .b
0 0 0 0 0 0 0
0 1 1 0 1 1 0
1 0 1 0 1 0 0
1 1 0 1 0 0 1
6/ 14
Ain Shams University Faculty of Engineering
Computer and Systems Department Digital Design
Chapter 1
Dr. Mona Fahmy 2008/2009
Complements
It is used for simplifying the subtraction operation. There are two types of complements for any base b
system:
1. b’s Complements.
2. (b-1)’s Complements.
b’s complement
For (N)b and N is positive with an integer part of n digits, the b’s compliant of N is defined as:
bn - N for N≠0
0 for N=0
Example 12:
Find 10’s complement of (520)10 , (0.326)10.
10’s complement of (520)10 = 103 - 520 = 480
10’s complement of (0.326)10 = 1 - 0.326 = 0.674
2’s complement of N:
2’s complement of (N) and N consists of n digits = (2n) - N
Example 13:
Find 2’s complement of (1001) 2 = (10000) 2 – (1001) 2 = (0111) 2
(b-1)’s complement
For (N)b and N is positive with an integer part of n digits, and m digits of the fractional part, the (b-1)’s
compliant of N is defined as:
bn – b-m - N
Example 14:
Find 9’s complement of (25.639)10
9’s complement of (25.639)10 = 102 - 10-3 – 25.639 = 99.999 – 25.639 = 74.36
7/ 14
Ain Shams University Faculty of Engineering
Computer and Systems Department Digital Design
Chapter 1
Dr. Mona Fahmy 2008/2009
1’s complement of N:
1’s complement of (N) and N consists of n digits = (2n - 1) - N
Example 15:
Find 1’s complement of (1001) 2 = (10000 - 1) - 1001 = (0110) 2
Example 16:
Using 10’s complement, subtract (72532 – 3250) 10
M = 72532, N= 03250 10’s complement of N = 96750
∴ 7 2 5 3 2
End carry 9 6 7 5 0
===============
1 6 9 2 8 2
Example 17:
Using 10’s complement, subtract (3250 - 72532) 10
M = 03250, N= 72532 10’s complement of N = 27468
∴ 0 3 2 5 0
No carry 2 7 4 6 8
===============
0 3 0 7 1 8 -69282
8/ 14
Ain Shams University Faculty of Engineering
Computer and Systems Department Digital Design
Chapter 1
Dr. Mona Fahmy 2008/2009
Binary Codes
It is the convenient code to work with decimal number system especially when the communication
between man and machine.
Weighted Code:
The main characteristic of the weighted code is that each binary digit is assigned a weight. For each
group of bits corresponding to decimal number, the sum of those bits = the decimal number.
9/ 14
Ain Shams University Faculty of Engineering
Computer and Systems Department Digital Design
Chapter 1
Dr. Mona Fahmy 2008/2009
Cyclic code: It is the code that has at maximum of 1 bit changes per increment.
Reflected Code: It is another type of cyclic code.
10/ 14
Ain Shams University Faculty of Engineering
Computer and Systems Department Digital Design
Chapter 1
Dr. Mona Fahmy 2008/2009
0 0 0 0 0 0 0 0 0 0
1 0 1 0 0 1 0 0 0 1
1 1 0 1 1 0 0 1 1
1 0 0 1 0 0 0 1 0
1 1 0 0 1 1 0
1 1 1 0 1 1 1
1 0 1 0 1 0 1
1 0 0 0 1 0 0
1 1 0 0
1 1 0 1
1 1 1 1
1 1 1 0
1 0 1 0
1 0 1 1
1 0 0 1
1 0 0 0
Gray Code:
It is type of cyclic code. Assume that the gray code is represented by gn gn-1 gn-2 … g1 g0. It is built
based on the binary code that is represented by bn bn-1 bn-2 … b1 b0.
Where gi = bi ⊕ bi+1 0 ≤ i ≤ n-1.
gn = bn
where:
0⊕0=0 1⊕1=0 0⊕1=1 1⊕0=1
b5 b4 b3 b2 b1 b0
1 0 1 1 0 1
⊕ ⊕ ⊕ ⊕ ⊕
1 1 1 0 1 1
g5 g4 g3 g2 g1 g0
11/ 14
Ain Shams University Faculty of Engineering
Computer and Systems Department Digital Design
Chapter 1
Dr. Mona Fahmy 2008/2009
12/ 14
Ain Shams University Faculty of Engineering
Computer and Systems Department Digital Design
Chapter 1
Dr. Mona Fahmy 2008/2009
The parity checks c1, c2, …, ck, indicate the location of error by its value. It also indicates that there is
no error if its value = 0.
13/ 14
Ain Shams University Faculty of Engineering
Computer and Systems Department Digital Design
Chapter 1
Dr. Mona Fahmy 2008/2009
Binary Logic
Binary logic deals with variables with 2 states (1 → yes, 0 → no)
3 Basic operations:
X Y AND OR NOT
X●Y X+Y X′
0 0 0 0 1
0 1 0 1 1
1 0 0 1 0
1 1 1 1 0
14/ 14