Download presentation
Presentation is loading. Please wait.
1
Digital Logic and Computer Organization
Fatma A. El-Licy ISSR_CS504 Digital Logic and Computer Organization Lecture One
2
Fatma A. El-Licy ISSR_CS504
Outline Introduction Number System Truth tables Design process for combinational systems Fatma A. El-Licy ISSR_CS504 May 31, 2018
3
Fatma A. El-Licy ISSR_CS504
Introduction Digital Logic and Computer Organization is the science of utilizing logic design in organizing digital systems, including computer systems. A Digital System is a one in which all signals are represented by discrete values. Computers, calculators and most electronic systems contains large amount of digital logic. Digital systems usually operate with two-valued signals (0 & 1). Fatma A. El-Licy ISSR_CS504 May 31, 2018
4
Fatma A. El-Licy ISSR_CS504
Digital System . n Inputs A B W X m outputs Fatma A. El-Licy ISSR_CS504 May 31, 2018
5
Digital Systems are Binary
Inputs and outputs of a digital system represent real quantities, binary (two-valued), or otherwise encoded multi-valued. Multi-valued inputs (decimal, character,…,etc.) must be represented by a set of binary digits (bits), which we call coding the inputs into binary. Fatma A. El-Licy ISSR_CS504 May 31, 2018
6
Fatma A. El-Licy ISSR_CS504
Example A System with three inputs A, B and C and one output Z, such that: Z =1 iff two of the inputs are 1. Fatma A. El-Licy ISSR_CS504 May 31, 2018
7
Typical solution Design
B C Z 1 0/1 Fatma A. El-Licy ISSR_CS504 May 31, 2018
8
Typical solution Design
B C Z 1 1/0 Fatma A. El-Licy ISSR_CS504 May 31, 2018
9
Fatma A. El-Licy ISSR_CS504
Examples A system with eight inputs representing two 4-bit binary numbers and one 5-bit output, representing the sum. A system with one input A and a clock, and one output Z, which is 1 iff the input was one at the last three consecutive clock times. A traffic controller, in the simplest case, there are just two streets. The light is green on each street for a fixed period of time. It then goes to yellow for another fixed period and finally it goes o red. There are no inputs to this system other than the clock. There are six output, one for each color in each direction (or three for each street). Fatma A. El-Licy ISSR_CS504 May 31, 2018
10
Fatma A. El-Licy ISSR_CS504
Fill in the Spaces are Combinational examples, the output depends only on the present values. are Sequential (needs memory), the output depends on values/states at earlier time. Fatma A. El-Licy ISSR_CS504 May 31, 2018
11
Natural Language vs Logic
Natural Language: Is not very precise!!! See example 1 We need a more precise description for logic systems, and that is what we will develop for combinational systems. Fatma A. El-Licy ISSR_CS504 May 31, 2018
12
Fatma A. El-Licy ISSR_CS504
Number Systems Integers are normally written using positional number system, where, each digit represents the coefficient in a power series N = dn* Rn + dn-1 * Rn-1 +…+ d0 * R0 (1) Where n is number of digits, R is the radix/base and di are the coefficients such that di R Fatma A. El-Licy ISSR_CS504 May 31, 2018
13
Fatma A. El-Licy ISSR_CS504
Examples The decimal number 2473)10 = 2* * * * 100 = = 2473)10 The Binary Number )2 = 125+ 0 24 +1 23 +122 +12+1 = = 47)10 Fatma A. El-Licy ISSR_CS504 May 31, 2018
14
Fatma A. El-Licy ISSR_CS504
An n-bit number can represent the positive integers from 0 to 2n –1. A 4-bit numbers have the range A 8-bit numbers have the range Let us try to use the power series to convert decimal to binary 745) 10 = 111 (1010) = ?!!! Fatma A. El-Licy ISSR_CS504 May 31, 2018
15
Decimal to Binary Conversion
Anther method to compute the binary equivalent of a decimal number Divide the decimal number by the radix (2 in this case) Keep the remainder, Repeat this process until the result of the division is zero The sequence of digits obtained (the remainders) arranged from right to left is the number in the radix (binary) system. Fatma A. El-Licy ISSR_CS504 May 31, 2018
16
Fatma A. El-Licy ISSR_CS504
Example 1 Convert decimal to decimal: )10 )10 Fatma A. El-Licy ISSR_CS504 May 31, 2018
17
Fatma A. El-Licy ISSR_CS504
Example 2 Convert decimal to binary: 9)10 = ??) ) ) ) )2 0 9)10 = 1001)2 Fatma A. El-Licy ISSR_CS504 May 31, 2018
18
Fatma A. El-Licy ISSR_CS504
Example 3 Convert decimal to binary: 41)10 = ???)2 )2 )2 )2 )2 )2 )2 00 41)10 = )2 Fatma A. El-Licy ISSR_CS504 May 31, 2018
19
Fatma A. El-Licy ISSR_CS504
Example 4 Convert decimal to binary: )10 = ???)2 )2 000 Fatma A. El-Licy ISSR_CS504 May 31, 2018
20
Fatma A. El-Licy ISSR_CS504
Example 4 Convert decimal to binary: )10 = ???)2 )2 1 Fatma A. El-Licy ISSR_CS504 May 31, 2018
21
Fatma A. El-Licy ISSR_CS504
Exercise Convert the following decimal into Binary numbers: a. 1000 b. 512 c. 217 d. 177 e. 105 Fatma A. El-Licy ISSR_CS504 May 31, 2018
22
Conversion from Binary to Decimal
Use formula (1), with the radix equals to 2. Example (Binary to Decimal): 1001)2= ???)10 1001)2= 1 20 = 1 1 = = 9)10 Convert the following Binary numbers to Decimal: a b c d Fatma A. El-Licy ISSR_CS504 May 31, 2018
23
Conversion from Binary to Decimal
Use formula (1), with the radix equals to 2. Example (Binary to Decimal): 1001)2= ?)10 )2= 1 20 = 1 1 = = 9)10 Fatma A. El-Licy ISSR_CS504 May 31, 2018
24
Fatma A. El-Licy ISSR_CS504
Octal and Hexadecimal Octal (r=8) and Hex (r=16) are a shorthand notations for binary numbers that are commonly used in computer documentations. In Octal, binary digits are grouped in threes. Example: a 9-bit number N Fatma A. El-Licy ISSR_CS504 May 31, 2018
25
Octal to Binary Conversion
A 9-bit number N N = (b b b6 26)+ (b b b3 23 )+ (b2 22+ b b0 ) = 26 (b b7 2 + b6)+ 23(b b4 2 + b3)+ (b2 22+ b b0 ) = 82o2 + 8 o1 + o0 where oi is an octal digits such that 0 oi 8 Fatma A. El-Licy ISSR_CS504 May 31, 2018
26
Fatma A. El-Licy ISSR_CS504
Examples )2 = = )8 = 1352)8 1352)8 = 1 = = 746)10 746)10 = ???)8 either, first convert decimal to binary then group up the binary to octal numbers, or (simpler) convert to octal by repetitive division by 8. Fatma A. El-Licy ISSR_CS504 May 31, 2018
27
Fatma A. El-Licy ISSR_CS504
Example ) ) ) )8 746)10= 1352)8 = )2 Fatma A. El-Licy ISSR_CS504 May 31, 2018
28
Fatma A. El-Licy ISSR_CS504
Hexadecimal Numbers Hexadecimal (R=16) groups bits by 4’s. Hex is the most common representation, since most computer word size are multiple of 4. Each digit is in the range 0-15 (0..9, A, B, C, D, E, F) Examples: )2= )2 = 2EA)16 2EA)16 = 2 E 16 + A = = 746)10 Fatma A. El-Licy ISSR_CS504 May 31, 2018
29
Fatma A. El-Licy ISSR_CS504
Binary Addition Fatma A. El-Licy ISSR_CS504 May 31, 2018
30
Fatma A. El-Licy ISSR_CS504
One-bit Adder Cin a b Cout S a b Cin Cout S Fatma A. El-Licy ISSR_CS504 May 31, 2018
31
Fatma A. El-Licy ISSR_CS504
FULL ADDER A device that does this 1-bit computation is referred to as a Full Adder. Fatma A. El-Licy ISSR_CS504 May 31, 2018
32
Fatma A. El-Licy ISSR_CS504
FULL ADDER a4 b4 a3 b3 a2 b2 a1 b1 Full Adder S4 c4 c3 S3 c2 S2 c1 S1 Fatma A. El-Licy ISSR_CS504 May 31, 2018
33
Full Adder a4 b4 a3 b3 a2 b2 a1 b1 S4 c4 c3 S3 c2 S2 c1 S1
If ‘1’, it Means Subtraction as we get the 2’s Complement a4 b4 a3 b3 a2 b2 a1 b1 Full Adder S4 c4 c3 S3 c2 S2 c1 S1 Fatma A. El-Licy ISSR_CS504 May 31, 2018
34
Fatma A. El-Licy ISSR_CS504
Signed Numbers Singed magnitude: -5 = 1101, 5= 0101 3+5 = = = add design an Adder Subtract design a subtracter which is bigger? design a comparator Fatma A. El-Licy ISSR_CS504 May 31, 2018
35
Fatma A. El-Licy ISSR_CS504
Add/Subtract Numbers Better find a simpler method to represent signed numbers, and better yet, to perform all these computations using one design!!! Signed numbers are stored in tow’s complement Positive numbers have the leading bit zero. A Negative number, -a, is stored as the binary equivalent of 2n - a (n = word size) Fatma A. El-Licy ISSR_CS504 May 31, 2018
36
Negative Numbers and two’s Complement
A Negative number, -a, is stored as the binary equivalent of 2n - a (n = word size) Let n= 5 (word size = 5) Let a= 6)10 = 110)2 a = - 110)2 = 11010)2’s omplement Apply the rule: 2n - a = 25 – 110 100000 11010 Fatma A. El-Licy ISSR_CS504 May 31, 2018
37
Fatma A. El-Licy ISSR_CS504
RADIX COMPLEMENT 5: : : -5: : : 0000 Fatma A. El-Licy ISSR_CS504 May 31, 2018
38
Fatma A. El-Licy ISSR_CS504
Carry Out Vs Overflow The Carry out of the most significant bit is ignored in two’s complement addition Overflow occurs when the sum is out of range, i.e., -2n-1 > sum> 2n-1 –1 Fatma A. El-Licy ISSR_CS504 May 31, 2018
39
Fatma A. El-Licy ISSR_CS504
Code Systems BCD: Binary Coded Decimal EBCDIC: Extended Binary Coded Decimal Interchangable Code Unicode: Unified Code Gray Code Hamming Code Fatma A. El-Licy ISSR_CS504 May 31, 2018
40
Fatma A. El-Licy ISSR_CS504
BCD Decimal Digit 8421 Code 5421 2421 Excess 3 2 of 5 0000 0011 11000 1 0001 0100 10100 2 0010 0101 10010 3 0110 10001 4 0111 01100 5 1000 1011 01010 6 1001 1100 01001 7 1010 1101 00110 8 1110 00101 9 1111 00011 Fatma A. El-Licy ISSR_CS504 May 31, 2018
41
Fatma A. El-Licy ISSR_CS504
Gray Code Number Gray Code 0000 8 1100 1 0001 9 1101 2 0011 10 1111 3 0010 11 1110 4 0110 12 1010 5 0111 13 1011 6 0101 14 1001 7 0100 15 1000 Fatma A. El-Licy ISSR_CS504 May 31, 2018
42
Fatma A. El-Licy ISSR_CS504
Hamming Code It is a single error-correction code. Check bits are added to the information bits, so that if, at most, one error occurs during transmission or storage, the original value can be restored. The value of the check bit is chosen so that the total number of ones in the bits selected (row) is even. Check bits are the bits that are power of 2, starting from 1 (1, 2, 4, 8) The pattern of checking is as follows: Fatma A. El-Licy ISSR_CS504 May 31, 2018
43
Fatma A. El-Licy ISSR_CS504
D D D D C C D C D D D a1 a2 a3 a4 a5 a6 a7 Bit 1 check x Bit 2 Bit 4 Hamming Code Fatma A. El-Licy ISSR_CS504 May 31, 2018
44
Fatma A. El-Licy ISSR_CS504
a1= a3 a5 a7 a2= a3 a6 a7 a4 = a5 a6 a7 a1 a a3 a4 a5 a6 a7 Example: Data Hamming Code a1 a2 a3 0100 1011 1111 C C C Fatma A. El-Licy ISSR_CS504 May 31, 2018
45
Fatma A. El-Licy ISSR_CS504
a1= a3 a5 a7 a2= a3 a6 a7 a4 = a5 a6 a7 a1 a2 a3 a4 a5 a6 a7 Example: Data Hamming Code a1 a2 a3 1011 1111 C C C Fatma A. El-Licy ISSR_CS504 May 31, 2018
46
Fatma A. El-Licy ISSR_CS504
a1= a3 a5 a7 a2= a3 a6 a7 a4 = a5 a6 a7 a1 a2 a3 a4 a5 a6 a7 Example: Data Hamming Code a1 a2 a3 1111 Fatma A. El-Licy ISSR_CS504 May 31, 2018
47
Fatma A. El-Licy ISSR_CS504
a1= a3 a5 a7 a2= a3 a6 a7 a4 = a5 a6 a7 a1 a2 a3 a4 a5 a6 a7 Example: Data Hamming Code a1 a2 a3 C C C Fatma A. El-Licy ISSR_CS504 May 31, 2018
48
Fatma A. El-Licy ISSR_CS504
when a word is received, the same bits are checked: e1= a1 a3 a5 a7 = 0 iff no error e2= a2 a3 a6 a7 = 0 iff no error e4= a4 a5 a6 a7 = 0 iff no error If one error occurs, the check produce the bit number, calculated as follows: 4*e4 + 2*e2 +e1 With n check bits (n 2) there can be 2n – n-1 bits of info. Fatma A. El-Licy ISSR_CS504 May 31, 2018
49
Fatma A. El-Licy ISSR_CS504
Examples Received: e1= 0; e2 = 1; e4= 0 4*0 + 2 *1 + 0= 2; Bit 2 in error The correct word is The data is 1011 Received: e1= 1; e2 = 0; e4= 1; 4*1 + 2* = 5 Bit 5 is in error The correct word is The data is 0001 Fatma A. El-Licy ISSR_CS504 May 31, 2018
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.