Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dr. Nermin Hamza. Agenda Signed Numbers Properties of Switching Algebra.

Similar presentations

Presentation on theme: "Dr. Nermin Hamza. Agenda Signed Numbers Properties of Switching Algebra."— Presentation transcript:

1 Dr. Nermin Hamza

2 Agenda Signed Numbers Properties of Switching Algebra

3 Signed Numbers + 9 or -9 In binary system : the left most bit in the most significant bit of the number 0 for – 1 for + Example : let 9 = 1001 So and

4 Code Systems Binary codes Binary coded decimal (BCD) Gray Code ASCII Code Error Detecting Code

5 BCD BCD: Binary Coded Decimal The one digits takes from 0 to 9 in decimal In BCD, a digit is usually represented by four bits which, in general, represent the decimal digits 0 through 9. Other bit combinations are sometimes used for a sign or for other indications (e.g., error or overflow).

6 The 8421 BCD Code BCD stands for Binary-Coded Decimal. A BCD number is a four-bit binary group that represents one of the ten decimal digits 0 through 9. Example: Decimal number BCD coded number

7 BCD Decimal  BCD

8 Example : (185) 10  (??) BCD Solution : ( ) BCD BCD

9 Convert the BCD coded number into decimal. Solve Decimal Number BCD Coded Number

10 Convert the decimal number 350 to its BCD equivalent. Decimal Number BCD Coded Number Solve

11 BCD Addition BCD is a numerical code and can be used in arithmetic operations. Here is how to add two BCD numbers: Add the two BCD numbers, using the rules for basic binary addition. If a 4-bit sum is equal to or less than 9, it is a valid BCD number. If a 4-bit sum > 9, or if a carry out of the 4-bit group is generated it is an invalid result. Add 6 (0110) to a 4-bit sum in order to skip the six the invalid states and return the code to If a carry results when 6 is added, simply add the carry to the next 4-bit group.

12 BCD BCD addition

13 BCD What happen if more than 9 ? Because 4 bits up to 15 which is = 6  0110 add 6 and create the second bit significant The solution is 12 which means :

14 Ahmad Almulhem, KFUPM 2010 BCD Addition

15 BCD Example : add 8+9 The solution is :

16 BCD Example : ( )+( )

17 BCD Solve: The solution :

18 The Excess-3 Code Add 3 to each digit of decimal and convert to 4-bit binary form A BCD code (not 8421 BCD) Decimal Binary +3 Excess Decimal Sample Problem: Excess

19 The Gray Code The Gray code’s most important characteristic is that only one digit changes as you increment or decrement the count. The Gray code is commonly associated with input/output devices such as an optical encoder of a shaft’s angular position. The Gray code is NOT a BCD code. Decimal Gray code

20 The Gray Code The Gray code is unweighted and is not an arithmetic code. There are no specific weights assigned to the bit positions. Important: the Gray code exhibits only a single bit change from one code word to the next in sequence. This property is important in many applications, such as shaft position encoders.

21 The Gray Code DecimalBinary Gray Code DecimalBinary

22 The Gray Code Binary-to-Gray code conversion The MSB in the Gray code is the same as corresponding MSB in the binary number. Going from left to right, add each adjacent pair of binary code bits to get the next Gray code bit. Discard carries. ex: convert to Gray code binary Gray

23 The Gray Code Gray-to-Binary Conversion The MSB in the binary code is the same as the corresponding bit in the Gray code. Add each binary code bit generated to the Gray code bit in the next adjacent position. Discard carries. ex: convert the Gray code word to binary Gray Binary

24 The ASCII Code ASCII is an acronym for American Standard Code for Information Interchange Represents numbers, letters, punctuation marks and control characters Standard ASCII is a 7-bit code (127 characters) Extended ASCII (IBM ASCII), an 8-bit code, is also very popular Extended ASCII adds graphics and math symbols to code (total of 256 symbols)

25 ASCII Features 7-bit code 8 th bit is unused (or used for a parity bit) 2 7 = 128 codes Two general types of codes: 95 are “Graphic” codes (displayable on a console) 33 are “Control” codes (control features of the console or communications channel)

26 ASCII Chart


28 Most significant bit Least significant bit

29 e.g., ‘a’ =

30 95 Graphic codes

31 33 Control codes

32 Alphabetic codes

33 Numeric codes

34 Punctuation, etc.

35 “Hello, world” Example ======================== Binary Hexadecimal C 6F 2C C 64 Decimal Hello, worldHello, world ======================== ========================

36 Error-detection To detect errors in data : an eight bit is sometimes added to the ASCII character to indicate its parity. ASCII A:

37 Error Detecting Code In data communication, errors may happen One code change into another code How to detect errors? Add an extra bit called a parity bit such that Number of 1’s is even (even parity) or odd (odd parity)

38 Error Detecting Code ASCII A = ASCII T =

39 Properties of Switching Algebra Why do we need Algebra: To Describe the relationships between inputs and outputs To Simplify the expressions of complex network (of gates) To Minimize the logic (number of Gates) needed for implementation To enable us to satisfy the constraints of the problem.

40 Definition for Switching Algebra OR: a + b is 1 Iff either or both a, b are 1 AND: a.b is 1 Iff both a,b are 1 NOT: a’ is 1 Iff a is 0

41 Definition for Switching Algebra AND / Product XYX.Y OR / Summation XYX+Y NOT XX’

42 Definition for Switching Algebra Commutative : a+ b = b+ a ab = ba (P1) Associative: a +(b+c) = (a+b) + c a(bc) = (ab)c (P2)

43 Basic Properties: Identity: a+1= 1a. 1 = a(P3) Null: a + 0 = aa.0 =0(P4) Complement: a + a’ =1 a.a’= 0(P5) Idempotency: a + a = aa.a=a (P6) Involution: (a’)’ = a (P7) Distributive: a(b+c)= ab + ac a + bc=(a+b)(a+c)(P8)

44 Basic Properties: Adjacency: ab + ab’ = a (a+b)(a+b’) = a (P9) Demorgan : (a+b )’= a’. b’ (ab)’= a’+ b’(P10)

45 Boolean Functions F= x+yz XYZY.ZX+Y.Z

46 Boolean Functions Solve : f= A+B’C ABCB’B’CA+B’C

47 Boolean Functions NOTAND OR

48 Boolean Functions F= X+Y’Z X Y Z F

49 Boolean Functions Solve : f= XY’+X’Z X Y Z F

50 Boolean Functions The function simplification: F= x’y’z+x’y’z+xy’ =x’z(y’+y)+xy’ =x’z + xy’

51 Boolean Functions Simplify the following function: (x+y)( x+y’) =x.x+x.y’+x.y+y.y’ =x + x.y’+x.y+ 0 =x(1+y’+y) =x

52 Boolean Functions Simplify the following function: ABCD+A’BD+ABC’D = ABD(C+C’)+A’BD =ABD+A’BD =BD(A+A’) =BD

53 Boolean Functions Solve: Simplify and represent to truth table and get the gate implementation: X(X’ +Y) The solution : = XX’+XY = 0+XY =XY XYXY X Y F

54 Boolean Functions Solve (simplify, draw gates and write the truth table): For: 1- xy+x’z+yz 2- (x+y)(x’+z)(y+z) 3-(A+B+C)’

55 Boolean Functions (A+B+C)’ LET X’= B+C (A+X)’ = A’X’  demorgan’s law So A’(B+C)’ = A’B’C’


Download ppt "Dr. Nermin Hamza. Agenda Signed Numbers Properties of Switching Algebra."

Similar presentations

Ads by Google