Notazione binaria, ottale, esadecimale. Algebra di Boole. Base 10 e base 2 Rappresentazione decimale e binaria Base 10 è cifre da 0 a 9 n Base 2 è cifre 0 e 1 n Sequenza di cifre decimali dk d k-1 … d1 d0 è numero intero dk x 10k + dk-1 x 10 k-1 + … d1 x 10 + d0 § Esempio: 102 in base 10 è 1x100+0x10+2x1 n § In generale: Σ (k=n,n-1,…,0) dk 10k Valore di una rappresentazione binaria • Per un numero binario dk d k-1 … d1 d0 • Stesso procedimento ma su base 2: Σ (k=n,n-1,…,0) dk 2k • Esempio: 01011012 = 1·25 + 1·23 + 1·22 + 1·20 = 32 + 8 + 4 + 1 = 4510 Valore di una rappresentazione binaria Rappresentazione binaria § Valore minimo di una sequenza di n cifre binarie: 000 … 0 (n volte) = 010 § Valore massimo: 1111…111 (n volte) = 2n-1 + 2 n-2 + … + 22 + 21 + 20 = 2n –1 § Esempio con n=3: 111 = 22 + 2 + 1 = 7 = 23 -1 § Da 0 a 8 (su 4 bit): 0 1 2 3 4 5 6 7 8 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000 Kilo, Mega, Giga, Tera, ... n n Byte = 8 bit Kilo, dal greco khiloi (1000 = 103) ¨ n Mega, dal greco mega (grande) ¨ ¨ n ¨ 1.000.000.000 = 109 230 Tera, dal greco tera (mostro) ¨ ¨ n 1.000.000 = 106 220 = 1.048.576 Giga, dal latino gigas (gigante) ¨ n 210 = 1024 = 1K (vicino a 1000) 1012 240 Peta, dal greco pente (5) ¨ ¨ 10005 = 1015 250 Notazione ottale (base 8) n 8 simboli: 0, 1, 2, ..., 7 n Un simbolo per rappresentare ogni gruppo di 3 cifre binarie (ce ne sono 8 diversi) n Es.: 101101010011 (binario) 101 101 010 011 5 n Di ¨ 5 2 3 5523 (ottale) solito lunghezza multipla di 3 Es.: 3 simboli per 8 bit Notazione esadecimale n 16 simboli: 0, 1, 2, ..., 9, A, B, ..., F n Un simbolo per rappresentare ogni gruppo di 4 cifre binarie (ce ne sono 16 diversi) n Es.: 101101010011 n Di solito lunghezza multipla di 4 n Es.: 3 simboli per 12 bit Notazione esadecimale • Es.: 101101010011 diventa B53 this appendix, we suggest how these storage elements and circuits can be implemented /2/09 in digital 4:28 logic, PM specifically Page 20-5 with combinational and sequential circuits.The appendix be- BOOLEAN gins with a brief review of Boolean 20.1 algebra, which is the ALGEBRA mathematical foundation of digital logic. Next, the concept of a gate is introduced. Finally, combinational and The gates, digitalare circuitry in digital computers and other digital systems is designed, and sequential circuits, which are constructed from described. -5 20.1 20-5 its behavior is analyzed, with the use of a mathematical 20.2 discipline known as Boolean / GATES algebra. The name is in honor of an English mathematician George Boole, who proposed the basic principles of this algebra in 1854 in his treatise, An Investigation of BOOLEAN ALGEBRA the Laws of Thought on WhichAlgebraic to Found the Mathematical Theories of Logic and Graphical Symbol Truth Table Name Probabilities. In 1938, Claude Shannon, a research assistant in the Electrical EngiFunction neering Department at M.I.T., suggested that Boolean algebra could be used to 20.2 / GATES The digital circuitry in digital computers and other digital systems is designed, and A B F solve problems in relay-switching circuit design [SHAN38].1 Shannon’s techniques its behavior is analyzed, with the use of a mathematical discipline knownFas!Boolean 0 0 0 A • B A were subsequently used in the analysis and design of electronic digital circuits. algebra. The name is in honor mathematician George Boole, who pro- tool in two AND of an English 0 1 0 F Boolean algebra turns out to be a convenient areas: or Algebraic Manipolazione logica 20-5 di bit ame B Boole posed the basic principles of this algebra in 1854 in(utile his treatise, Anla Investigation of di funzioni Graphical Symbol Truth Table 1 0 0 logiche): n Algebra di per specifica Function ! AB • Mathematical Analysis: It is an economical way of describing the function of digital circuitry. the Laws of Thought on Which to Found the Theories of FLogic and 1 1 1 B Ffunction,Engi¨ 20.2 variabili logiche (binarie) ethe operazioni logiche / GATES • Design: Given in aA desired Boolean algebraAcan Probabilities. In 1938, Claude Shannon, a research assistant Electrical B beFapplied to develop a simplified implementation of that function. 0 0 0 neering Department at M.I.T., suggested that Boolean algebra could be used to F ! A • B può prendere valore 0 (FALSO) o0 10 (VERO) A 0 ¨ una variabile 1 A designA[SHAN38]. Shannon’s solve problems in relay-switching circuit 0 1 Boolean 0 Ftechniques F algebra makes use 0of 1variables and operations. or As with any algebra, ! A " B OR F 1 B subsequently used¨ Algebraic were in the analysis and design of electronic digital circuits. operazioni logiche divariables base: OR, NOT 1 0AND, 0operations this case, the and are logical variables and operations. Thus, 1 0 1 Truth TableB FIn ! AB Function Boolean algebra turns out to be a convenient tool inmay twotake areas: a variable on1the 1 value 1 1 (TRUE) or 0 (FALSE). 1 1 The 1 basic logical operations are AND, OR, and NOT, which are symbolically represented by dot, plus sign, A B | R A B F A B | R A B F • Analysis: It is an economical way of describing the function of digital circuitry. and overbar:2 A | R A F 0 0 0 0 0 0 F ! A • B !A a •ADesign: Given a desired function, Boolean algebra can be applied to Fdevelop Rfunction. = AAAND R = A AND 0 1 R = NOT A ! " BB A#B F0 1 of0that NOT AF F 0 1 1 A AND simplified implementation or or B = B B 1 0 1 0 0 1 1 0 A OR B = A + B F ! A# FAs ! AB with any algebra, Boolean algebra makes use of variables and operations. 20-5 ND OR F 1 1 FOT AND OR F 1 2 FOR re 20.1 F 1 1 1 1 NOTThus, A = A In this case, the variables and operations are logical variables and operations. A B F A B F a variable may take on the value 1 (TRUE) 0 (FALSE). basic logical operaTheor operation ANDThe yields if both of its operands are A true F (binary value 1) if and only 0 0 1 are true. The unary 0 0 0 F ! A true. The operation OR yields true if either or both of its operands tions are AND, OR,n andOperatori NOT, which A arebooleani symbolically represented by dot, plus sign, su due variabili 0 1 consider 1 NAND F 0the 1 ! A " 2B F0 1 1 operation NOT inverts valueFof!itsAB operand. For example, the equation andFAoverbar: or B 1 0 1 1 0 1 0 1 F ! A# Esempio: D = A + (B # C) A AND B = A # B 1 1 0 1 1 1 A0 eB CF=D1.is equal to 0. equal if uguale both B = 0 and C = 1. Otherwise A OR BD=isA + Bto 1 if A is 1Aor DBè a 1 se A è 1 o se B = F Altrimenti D è uguale a 0. 0 0 1 A F NOT 0 0 1 AA = A AF ! A 1 F ! A " B 0 1 0 NOR F The paper is available at this book’s Web site. F2 ! AB 1 Bvalue 0 1of its1operands are F0 (binary The operation AND yields true 1) if and only if both Logical NOT is often indicated by an apostrophe: NOT A = A¿. 1 0 0 B or 1 true 0 if either or both of its operands 1 0 1 The unary true. The OR yields are true. F !operation A# 1 1 0 1 1 0 the equation operation NOT inverts the value of its operand. For example, consider A B F A B F A B DF = A + (B # C) 0 0 0 A 0 0 1 0 0 1 A F XOR F! A !B 0 1 1 D is F equal to 1 if A is 1 or if both B = 0 and C = 1. Otherwise D is equal to 0. 0 1 0 F0 1 1 BF ! A " B ! AB 1 0 1 B 1 0 0 1 0 1 1 1 0 1 1 0 A B F A B F M20_STAL3734_08_SE_C20.QXD 3/2/09 4:28 PM Page 20-3 0 0 0 0 0 1 A F F ! A ! B 0 1 1 F!A"B 0 1 0 B 0 1 1 0the 0 gate (known as the 1gate signals through delay). The significance of this delay is 1 1 0 1 1 0 The paper is available at this book’s 1 Web 1 site. 0 Logical NOT is often indicated by an apostrophe: NOT A = A¿. Figure 20.1 Basic Logic Gates Manipolazione logica di bit discussed in Section 20.3. In some cases, a gate is implemented with two outputs, one A B F 20.1 / BOOLEAN ALGEBRA 20-3 0 0 0 Table introduce Operators we a common term: we say that to assert a signal is to cause F ! A ! B Here 0 20.1 1 1Boolean n Operatori booleani suOperators due ofvariabili (a) Boolean Two Input false Variables(0) state to its logically true signal line to 1make 0 1 a transition from its logically NOT P P Q Q or P NAND Qdelay P NOR Q Pdepending XOR Q 1true 1 0(1) gate (1) (known the gate delay). The significance of thisvoltage isstate, state.as The state isAND either aP OR high low on the Basicoutput Logic Gates being the negation of the other output. ugh the (P) (P # Q) (P ! Q) (P # Q) (P + Q) (P { Q) P Q Section 20.3.type In some cases, a gate is implemented with of electronic circuitry. M20_STAL3734_08_SE_C20.QXD 3/2/09 4:28 PM Page 20-4two outputs, one 0 0 1 0 0 1 1 Typically, not all gate types are used in implementation. Design01 and fabrication g the negation of the other output. 0 1 1 0 1 1 0 simpler ifterm: onesay of gates are used. Thus, to identify we introduce are a common thattypes cause 1 only 0 we 0or two 0to assert 1 a signal 1is to 0it is important 1 1 its logically 1 0 1(0) state 1 0 0 functionally sets of gates.This means that 0any Boolean function can be impleo make a transition fromcomplete he gate delay). The significance this false delay is LOGIC to its logically true 20-4ofCHAPTER 20 / DIGITAL mented using only the gates in the set. The following are functionally complete sets: e atrue state is either with a high oroutputs, low voltage state, depending on the es, gate(1) is implemented two n Algebra booleana: postulati e identità Table 20.2 Basic Identitiesone of Boolean Algebra tronic circuitry. • AND, OR, NOT(b) Boolean Operators Extended to More than Two Inputs (A, B, . . .) r output. Basic Postulates lly, not all gate types are used in implementation. Operation Expression Design and fabrication Output " 1 if # # A B = B is A to cause A + B = B + A Commutative Laws erm: we say that• to assert a signal AND, NOT # C)All= of A # (Bare + C) =used. (A # B)A+ # (A (Athe + B) +B,C)...} A + (B B # C) Á AND set# (A {A,to are 1. Distributive Laws fitsonly one or two types of gates Thus, it is important identify logically false• (0) to its logically true 0 + A = AAny of the set {A, B, ...} are 1.Identity Elements A + B + Á OR 1 # A = A OR,state NOT complete sets of gates.This means that any Boolean function can be impleA# A = 0 A + A = 1 Inverse Elements # a high or low voltage state, depending on A B # the Á NAND Any of the set {A, B, ...} are 0. • NAND Other Identities g only the gates in the set. The following are functionally complete sets: NOR A + B + Á All of the set {A, B, ...} are 0. 0#A = 0 1 + A = 1The set {A, B, ...} contains an odd number of ones. XOR A{B{ Á • NOR sed in implementation. DesignA # and A = A fabrication A + A = A OR, NOT A # (B # C) = (A # B) # C A + (B + C) = (A + B) + C Associative Laws gates are used. Thus, it is important to identify A + B = A # B A#B = A + B DeMorgan’s Theorem NOT means that any Boolean function Several can be implepoints concerning the notation are needed. In the absence of parenOT the ANDsets: operation takes precedence over the OR operation. Also, when no The following are functionally theses, complete are stated without proof, and other identities that can be derived from the basic postuambiguity will occur, the AND operation is represented by simple concatenation inlates.The postulates define the way in which Boolean expressions are interpreted. One D stead of the dot operator. Thus, of the two distributive laws is worth noting because it differs from what we would find in ordinary algebra: A + B # C = A + (B # C) = A + BC A + (B # C) = (A + B) # (A + C)