320 likes | 574 Views
Computer Programming Skills Revision Prepared by: Ghader Kurdi. Chapter 1 Number Systems. Contents. Number Systems Conversion Among Bases Binary Addition and Multiplication. Number Systems. Conversion Among Bases. Conversion Among Bases.
E N D
Computer Programming Skills Revision Prepared by: Ghader Kurdi
Contents • Number Systems • Conversion Among Bases • Binary Addition and Multiplication
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.
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. Binary Binary Octal Octal
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. Binary Binary hexadecimal hexadecimal
Binary Addition and Multiplication Binary addition To add 3 or more numbers: • Add the first two numbers. • Then, add the third number to the result and so on. Examples
Binary Addition and Multiplication Binary Multiplication To multiply 3 or more numbers: • Multiply the first two numbers. • Then, multiply the result by the third number and so on. Example
Digital Logic Design • Logic gates • Logic Functions • Derivation of logical expressions • sum-of-products (SOP) form • product-of-sums (POS) form • Logical Equivalence • Truth table method • Algebraic manipulation method • Logical Expression Simplification • Boolean Algebra • Karnaugh Map Method
Logic gates • Logic gates • AND • OR • NOT • NAND • NOR • XOR • Precedence (NOT > AND > OR) • You must know: • The function and truth table of each gate • The graphical representation of each gate • The logical representation of each gate
Logic Functions • Logical functions can be expressed in several ways: • Truth table • Logical expressions • Graphical form • You must know how to: • Use a graphical representation to derive a logical expression. • 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 truth table. • Use a truth tables to derive a logical expression (SOP & POS)
Derivation of logical expressions • 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 • Example • 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
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 expressionrepresented 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
Derivation of logical expressions from a Truth Table (example) • 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. POS SOP
Converting SOP and POS Expressions to Truth Table Format • Recall the fact: • An SOP expression corresponds to 1 output. • Constructing a truth table: • 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 SOPexpression a 1 and place 0 for all the remaining binary values. • Recall the fact: • A POS expression correspondsto 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 POSexpression a 0 and place 1 for all the remaining binary values.
Converting SOP Expressions to Truth Table Format (example) • Develop a truth table for the standard SOP expression
Converting POS Expressions to Truth Table Format (example) • Develop a truth table for the standard SOP expression
Implementation of SOP & POS • Implementation of an SOP • Implementation of a POS A A B B A A X B B A A B B
Logical Equivalence • Truth table method • Derive the logical expression • Derive truth tables for each expression. • 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.
Logical Expression Simplification Boolean Algebra • Need boolean identities (Laws) • 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.
Simplification using K-Map • The process of simplification (minimization): • Mapping the expression into k-map • Grouping the 1s • Determining the minimum SOP expression from the map
Grouping the 1s (rules) • A group must contain either 1,2,4, or 8 cells (depending on number of variables in the expression) • Each cell in a group must be adjacent to one or more cells in that same group. • Always include the largest possible number of 1s in a group in accordance with rule 1. • Each 1 on the map must be included in at least one group. • The 1s already in a group can be included in another group as long as the overlapping groups include non common 1s.
Simplification using K-Map(full example) The expression: 000 001 110 100 1 1 Practice: 1 1
Simplification using K-Map(full example) 1 1 0 0 1 0 1 1
اسأل الله لكم التوفيق والسداد أ. غدير كردي