16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected] 16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected] Logic Gates Ada16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected] In a combinational circuit, the present outputs depend only on present inputs In a sequential circuit, the present outputs may also depend on past outputs and inputs. Sequential circuits usually contain combinational subcircuits. Sequential circuits contain feedback paths from theoutputs to the inputs, while combinational circuits do not.16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected] For convenience, we definethe following notations:T = TRUEF = FALSE__A’ = A = NOT AAB = A.B = A AND BA + B = A OR B.OR ANDA B A+B ABF F F FF T T FT F T FT T T T16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected] Inversion bubbles, NAND & NOR an AND gate with output inversion is called a NAND gate(“Not AND”). Similarly, an OR gate with inverted output is called a NOR gate (“Not OR”).NOR NANDX Y (X+Y)’ (XY)’0 0 1 10 1 0 11 0 0 11 1 0 016.070 — February 13/2003 — Jayakanth Srinivasan, [email protected] In a NOR gate, the output is TRUE iff the inverses of both inputs are TRUE; that is, a NOR gate performs an AND operation on the inverses. So there are two symbols for a NOR gate: In a NAND gate, the output is TRUE iff the inverse of either input is TRUE; that is, a NAND gate does an OR operation on the inverses. So there are two symbols for a NAND gate:16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected] The OR function in logic isinclusive; “X or Y” means “X or Y or both”. The exclusive-OR function, as its name suggests, excludes the “or both” option: “X xor Y” means“X or Y but not both”.X Y X xor Y0 0 00 1 11 0 11 1 0⊕⊕⊕⊕ 16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected] !" X ⊕Y = X’Y + XY’16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected]! !"16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected]## The result of an OR operation is called a sum The result of an AND is called a product. The appearance of a variable or its complement in an expression is called a literal. Any logical function can be written as a sum of productsW = X’YZ + XYZ’ + XY’, Or as a product of its sumsW = (X’+Y’+Z’)(X+Z)(X+Y).16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected] A sum of products (SOP) or product of sums (POS) is a two-level expression because it can be implemented by two layers of gates (excluding initial inverters). 16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected]$ Variables<variable name> : <data type>;<variable name> - the name of the variable.<data type> - the data type for that variable.Radius : Float;Area : Float; Constants<constant name> : constant <data type> := <value>;<constant name> - the name of the constant.<data type> - the data type for that constant.<value> - the value of the constant.Pi : constant Float := 3.1416;16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected] <variable name> := <expression>; <variable name> - the name of the variable. <expression> - some mathematical formula.Area := Pi * Radius ** 2;16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected]% % Operators perform operations on operands! Precedence** (exponentiation), abs (absolute value), not*, /, mod (modulus), rem (remainder)+, - (unary operators)+, -, & (binary operators)=, /=, <, <=, >, >=and, or, xor (exclusive-or)16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected]# <procedure header><local variables and constants>begin<procedure body>end <procedure name>; <procedure header> - contains the procedure name and parameters. <local variables> - variables used in the procedure (but nowhere else). <procedure body> - the code the procedure executes. <procedure name> - the name of the procedure.16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected]"%for <loop control variable> in <lower bound> ..<upper bound> loop <loop body>end loop; <loop control variable> - this is the name of the "variable that controls the loop". The loop control variable is incremented by one each time through the loop. <lower bound> - the initial value given to the loop control variable. <upper bound> - the final value of the loop control variable. The loop body executes one more time when the loop control variable = upper bound, then the loop terminates. <loop body> - the code that's executed each time through the loop.16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected]% procedure Loop_Demo is -- Square_Integer : Integer; begin-- For each of the integers from 1 to 10for Square_Integer in 1 .. 10 loop-- Print the square of that integerPut (Item => Square_Integer**2, Width => 3);New_Line;end loop;end Loop_Demo;16.070 — February 13/2003 — Jayakanth Srinivasan, [email protected]! %procedure Nested_Loop_Demo is begin-- For each of the integers from 1 to 10for I in 1 .. 3 loop-- Print Outer loopPut ("In Outer Loop");New_Line;for J in 1 .. 3 loop-- Print Inner loopPut (" In Inner Loop");New_Line;end loop;end loop;end
View Full Document