Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Programming Skills Revision Prepared by: Ghader Kurdi.

Similar presentations


Presentation on theme: "Computer Programming Skills Revision Prepared by: Ghader Kurdi."— Presentation transcript:

1 Computer Programming Skills Revision Prepared by: Ghader Kurdi

2 Chapter 1 Number Systems

3 Contents Number Systems Number Systems Conversion Among Bases Conversion Among Bases Binary Addition and Multiplication Binary Addition and Multiplication

4 Number Systems SystemBaseSymbols Examples Decimal100, 1, 2, 3, 4, 5, 6, 7, 8, 9 101, 33, 108, 987 Binary20, 1 101, 1110, 10, 1, 0 Octal80, 1, 2, 3, 4, 5, 6, 7 101, 33, 777, 642 Hexa- decimal 160, 1, 2, 3, 4, 5, 6, 7, 8, 9 A, B, C, D, E, F 101, 33, 108, 1AF ABDF, 35FF, 10A

5 Conversion Among Bases Decimal BinaryOctalHexadecimal

6 Conversion Among Bases Divide the number by base and write the remainders. Continue downwards, dividing each new quotient by base and writing the remainders. Stop when the quotient is 0. Decimal BinaryOctalHexadecimal

7 Conversion Among Bases Start at the right Break the binary numeral into groups of three digits Replace each 3-digits binary numeral with it’s 1-digit octal equivalent Replace each octal digit with it’s 3-digits binary equivalent Combine all binary equivalent into a single binary numeral. Octal Binary Octal Binary

8 Conversion Among Bases Start at the right Break the binary numeral into groups of four digits Replace each 4-digits binary numeral with it’s 1-digit hexadecimal equivalent Replace each hexadecimal digit with it’s 4-digits binary equivalent Combine all binary equivalent into a single binary numeral. hexadecimal Binary hexadecimal Binary

9 Conversion Among Bases octal binary hexadecimal

10 Binary Addition and Multiplication Binary addition To add 3 or more numbers: Add the first two numbers. Add the first two numbers. Then, add the third number to the result and so on. Then, add the third number to the result and so on. Examples

11 Binary Addition and Multiplication Binary Multiplication To multiply 3 or more numbers: Multiply the first two numbers. Multiply the first two numbers. Then, multiply the result by the third number and so on. Then, multiply the result by the third number and so on. Example

12 Chapter 2 Digital Logic Design

13 Digital Logic Design Logic gates Logic gates Logic Functions Logic Functions Derivation of logical expressions Derivation of logical expressions sum-of-products (SOP) form sum-of-products (SOP) form product-of-sums (POS) form product-of-sums (POS) form Logical Equivalence Logical Equivalence Truth table method Truth table method Algebraic manipulation method Algebraic manipulation method Logical Expression Simplification Logical Expression Simplification Boolean Algebra Boolean Algebra Karnaugh Map Method Karnaugh Map Method

14 Logic gates Logic gates Logic gates AND OR NOT NAND NAND NOR NOR XOR XOR Precedence (NOT > AND > OR) Precedence (NOT > AND > OR) You must know: You must know: The function and truth table of each gate The function and truth table of each gate The graphical representation of each gate The graphical representation of each gate The logical representation of each gate The logical representation of each gate

15 Logic Functions Logical functions can be expressed in several ways: Logical functions can be expressed in several ways: Truth table Truth table Logical expressions Logical expressions Graphical form Graphical form You must know how to: You must know how to: Use a graphical representation to derive a logical expression. Use a graphical representation to derive a logical expression. Use a graphical representation to derive a truth table. Use a graphical representation to derive a truth table. Use a logical expression to derive a graphical representation. Use a logical expression to derive a graphical representation. Use a logical expression to derive a truth table. Use a logical expression to derive a truth table. Use a truth tables to derive a logical expression (SOP & POS) Use a truth tables to derive a logical expression (SOP & POS)

16 Derivation of logical expressions An SOP expression  when two or more product terms are summed by Boolean addition. An SOP expression  when two or more product terms are summed by Boolean addition. In an SOP form, a single overbar cannot extend over more than one variable In an SOP form, a single overbar cannot extend over more than one variable Example Example But not But not An POS expression  When two or more sum terms are multiplied by Boolean multiplication. In a POS form, a single overbar cannot extend over more than one variable Example But not

17 Derivation of logical expressions To determine the SOP expression represented by a truth table. Instructions: Step 1: List the binary values of the input variables for which the output is 1. Step 2: Convert each binary value to the corresponding product term by replacing: each 1 with the corresponding variable, and each 0 with the corresponding variable complement. Example: 1010  To determine the POS expression represented by a truth table. Instructions: Step 1: List the binary values of the input variables for which the output is 0. Step 2: Convert each binary value to the corresponding product term by replacing: each 1 with the corresponding variable complement, and each 0 with the corresponding variable. Example: 1001 

18 POS SOP Derivation of logical expressions from a Truth Table (example) I/PO/P ABCX 0000 0010 0100 0111 1001 1010 1101 1111 There are four 1s in the output and the corresponding binary value are 011, 100, 110, and 111. There are four 0s in the output and the corresponding binary value are 000, 001, 010, and 101. There are four 0s in the output and the corresponding binary value are 000, 001, 010, and 101.

19 Converting SOP and POS Expressions to Truth Table Format Recall the fact: Recall the fact: An SOP expression corresponds to 1 output. An SOP expression corresponds to 1 output. Constructing a truth table: Constructing a truth table: Step 1: List all possible combinations of binary values of the variables in the expression. Step 1: List all possible combinations of binary values of the variables in the expression. Step 2: Place a 1 in the output column (X) for each binary value that makes the SOP expression a 1 and place 0 for all the remaining binary values. Step 2: Place a 1 in the output column (X) for each binary value that makes the SOP expression a 1 and place 0 for all the remaining binary values. Recall the fact: A POS expression corresponds to 0 output. Constructing a truth table: Step 1: List all possible combinations of binary values of the variables in the expression. Step 2: Place a 0 in the output column (X) for each binary value that makes the POS expression a 0 and place 1 for all the remaining binary values.

20 Converting SOP Expressions to Truth Table Format (example) Develop a truth table for the standard SOP expression Develop a truth table for the standard SOP expressionInputsOutput Product Term ABCX 000 001 010 011 100 101 110 111 InputsOutput ABCX 000 001 010 011 100 101 110 111 InputsOutput ABCX 000 0011 010 011 1001 101 110 1111 InputsOutput ABCX 0000 0011 0100 0110 1001 1010 1100 1111

21 Converting POS Expressions to Truth Table Format (example) Develop a truth table for the standard SOP expression Develop a truth table for the standard SOP expressionInputsOutput Product Term ABCX 000 001 010 011 100 101 110 111 InputsOutput ABCX 000 001 010 011 100 101 110 111 InputsOutput ABCX 0000 001 0100 0110 100 1010 1100 111 InputsOutput ABCX 0000 0011 0100 0110 1001 1010 1100 1111

22 Implementation of SOP & POS Implementation of an SOP Implementation of an SOP Implementation of a POS A B B A A B X A B B A A B

23 Logical Equivalence Truth table method Truth table method Derive the logical expression Derive the logical expression Derive truth tables for each expression. Derive truth tables for each expression. If both expressions yield the same output, they are equivalent. Otherwise, they are not. If both expressions yield the same output, they are equivalent. Otherwise, they are not. Algebraic manipulation method Derive the logical expressions Simplify each expression using boolean laws. If both expressions yield the same simplified expression, they are equivalent. Otherwise, they are not.

24 Logical Expression Simplification Boolean Algebra Need boolean identities (Laws) Need boolean identities (Laws) Start with an expression and apply Boolean laws to derive the simplest (minimum) expression possible. Start with an expression and apply Boolean laws to derive the simplest (minimum) expression possible. Karnaugh Map Method A K-map is a graphical method for simplifying Boolean expressions and, if properly used, will produce the simplest (minimum) expression possible. The size of k-map depends on the number of variables.

25 Simplification using Boolean Algebra

26 Simplification using Boolean Algebra (cont.)

27 Simplification using K-Map The process of simplification (minimization): The process of simplification (minimization): Mapping the expression into k-map Mapping the expression into k-map Grouping the 1s Grouping the 1s Determining the minimum SOP expression from the map Determining the minimum SOP expression from the map

28 Grouping the 1s (rules) 1. A group must contain either 1,2,4, or 8 cells (depending on number of variables in the expression) 2. Each cell in a group must be adjacent to one or more cells in that same group. 3. Always include the largest possible number of 1s in a group in accordance with rule 1. 4. Each 1 on the map must be included in at least one group. 5. The 1s already in a group can be included in another group as long as the overlapping groups include non common 1s.

29 ABC 00011110 0 1 Cell Adjacency

30 CAB 01 00 01 11 10 Simplification using K-Map (full example) The expression: 000 001110100 1 1 1 1 Practice:

31 Simplification using K-Map (full example) CAB 01 00 01 11 10 1 1 0 0 1 0 11

32 اسأل الله لكم التوفيق والسداد أ. غدير كردي


Download ppt "Computer Programming Skills Revision Prepared by: Ghader Kurdi."

Similar presentations


Ads by Google