Combinatorial networks- I
1
Combinatorial networks- I Digital Systems M 1 Digital Systems - - PowerPoint PPT Presentation
Combinatorial networks- I Digital Systems M 1 Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..) .... 2 Digital systems Physical systems using quantized values to represent, compute
1
2
Signal: A physical value whose time behaviour represents the information to transmit Analog signal: a signal which can assume all values within its definition interval Digital signal: a signal which can assume only some defined values within its definition interval
3
convenzionally indicated as 1 and 0 (bit – logic not numerical meaning!!!)
L H
“noise”
4
+ Vcc Vu Ii Ii: {Imin,0} Vu: {0, Vcc} Cause Effect
1/4 2/4 3/4 4/4 1/8 2/8 3/8 4/8 5/8 6/8 7/8 8/8
2 bit (00/01/10/11 – 4 levels 3 bit (000/001/010/011/100/101/ 110/111) - 8 levels
Reserve ? (ON/OFF) sensor
1 bit (0/1) – 2 levels
Binary variable (Bit)
A/D D/A
Computer Analog to Digital and Digital to Analog conversion Ex: steam pressure Ex: valve position
7
Real picture Sensor acquired image R ∈ {0,1,2,..,254,255} G ∈ {0,1,2,..,254,255} B ∈ {0,1,2,..,254,255}
Quantized numerical values
8
Numbers and codes
set of symbols each representing a numerical quantity (i.e. 5, 7, 3 etc.) and whose actual value depends on its position 3547 = 3 x 103 + 5 x 102 + 4 x 101 + 7 x 100 N.B. There are NON positional numerical systems: i.e. the roman numbers (XXIII => 2310)
9
symbols whose combinations single out different
positions of a flag), the bar code etc.
and L(ow) or 0 and 1 etc.). A set of n of these symbols can characterise 2n different objects ( i.e. with three bits – 0 and 1 - 8 objects) 000 001 010 011 100 101 110 111
symbols 3n objects can be identified and so on …..
2) we need at least Z binary symbols where Z is the first integer greater than log2(N) => |log2(N)|
and 1, in this case absolutely without any numerical meaning (they are equivalent to low/high, red/green, open/close, α/β etc.). In this context in a supermarket 100101 string could refer to the bread and 110101 string to the milk. 0 and 1 symbols are called bit (that is binary digit)
10
configuration has only one bit equal to 1). In this case with N bit N objects are identified (ex: 010000, 000010 etc.)
symbols 0 and 1 have a numerical meaning. In this context for instance 100101 indicates 1001012 = 1 x 25 + 0 x 24 + 0 x 23 + 1 x 22 + 0 x 21 + 1 x 20 = 32 + 4 + 1 = 3710
11
32768, 65536 must be known by heart !!!!
(somehow confusing…)
0….2n-1 (never forget the zero …). With 16 bit the range is 0 to 6553510 (= 6553610-1)
12
1 1 1 1 0 1 0 0 1 Carry-over 1 1 0 1 0 1 1 + 1 0 7 + 0 1 1 1 0 1 0 = 5 8 =
0 2 2 0 0 0 0 10 10 Borrow 1 1 0 1 0 1 1 - 1 0 7 - 0 1 1 1 0 1 0 = 5 8 =
13
101101 x 1011 45 x 11
101101= 45= 000000== ------- 101101=== 495
111110 101 62:5= 12 with remnant 2 101 1100 0101 101 00010
14
its 2’s complement (negative equivalent) can be obtained by substituting the 1s with 0s and viceversa (bit complement operation) and adding then 1. Same procedure for converting 2’s complement negative numbers into positive numbers
a relative numbers context and those positive (including the zero which is a “particolar” number – is a «not» number) have a “0” as most significant bit .
2’s complement numbers (very simple for sums and subtractions, more complex for moltiplications and divisions – Booth algorithm) 0100101 => 1011010 + 1 = 1011011 +37 => -37 1011011 => 0100100 + 1 = 0100101
15
(automatically implemented in the computers for physical reasons )
1011011+ -37+ 1100+ -4+ 0010010= 18= 1101= -3=
The 2’s complement provide correct results within the definition range (in our case with 7 bit – 6 bit plus sign – the numbers from -6410 that is 1000000 up to +6310 that is 0111111). In general with n bit the range is -2n-1 to +2n-1-1 (because of the zero..). Example 4 bit (3 bit + sign ) range from 1000 -> -8 to 0111 -> +7
1011011 + -37 + 1010010 = -46 =
|-83| > 63!! By summing two negative numbers we have obtained a positive number !!! “Overflow” error in the computers Careful !!
16
1 0 1 0 1 Carry-over 4 1 2 + 1 0 7 + 2 1 3 = 5 8 =
5 5 0 10 10 Borrow 4 1 2 - 1 0 7 - 2 1 3 = 5 8 =
11305 = 1 x 125 + 1 x 25 +3 x 5 + 0= 16510 Base 10 Base 5 Base 10 Base 5 1445 = 1 x 25 + 4 x 5 + 4 = 4910
18
00101001011110100101100101010
notation by grouping by four the string Binary Hexadecimal (HEX)
0000 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7 1000 8 1001 9 1010 A 1011 B 1100 C 1101 D 1110 E 1111 F
19
The string: 00101001011110100101100101010 can be also rewritten as (grouping by four the bits ) 0 0101 0010 1111 0100 1011 0010 1010 and therefore in hexadecimal notation the string is: 052F4B2A. If the hexadecimal notation represents a number arithmetical operations are possible 1000 carry (when 1610 is reached) A57B + B342 =
20
Here non western characters (arabs, polish, cyrillic, hindi etc.) are missing. Unicode is a 16 bit code (65536 combinations) which allows to represent all alfanumeric symbols
21
010 011 110
Very usefult for representing the position
an engine shaft (conductor disk with brushes). There are no «discontinuities» . For the conversion between the binary and Gray codes see later. White => 0 Black => 1
Bin
000 001 011 010 110 111 101 100
Gray
000 001 010 011 100 101 110 111 000 or 011 Transient
22
single error: the most common is the parity (or disparity) bit which is added to the code so that the total number of 1’s is always even (or odd). For instance (even parity) 1001011 0000000 1111110
errors- Trasmitted 1001011 (even parity) Received 1001111 Single error (green bit ) !! 1011001 Double error NOT detected!
the most likely) parity is a simple and very effective method.
23
A “distance” in a code is the number of bits which separate two allowed configurations. For instance in a 5 bit code the two values 01011 e 01111 have a distance one while the two values, 01011 e 01101 have distance two etc. Codes with distance 3 allow not only the detection but also the correction of single errors
Correct values (distance 3 – 3 bit – only 2 correct values)
If 001 is received the only «near» correct configuration is 000 and therefore if we assume a single error it can be corrected. The same applies for 101 (supposed transmitted code 111) but in case of double error the correct configuration was 000. In this case therefore we can correct single errors and detect double errors. Let see what happens with distance 4 000 111 If the only two allowed configurations are 0000 and 1111 we can detect single, double and triple errors. If 1110 is received we can assume that the correct configuration is 1111 (correction) but if 0110 is received we can detect the error but we are unable to correct it (same distance from 0000 and 1111). CRC codes (Cyclic Redundant Codes see later)
?
24
straightforward (positional codes).
successive divisions by 2 considering the remnants Remnant 75| 2 1 37| 2 1 18| 2 0 9| 2 1 10010112 => 7510 4| 2 0 2| 2 0 1| 2 1 Base 2 Remnant 165| 5 0 33| 5 3 11305 => 16510 6| 5 1 1| 0 1 Base 5
25
decimal 1 7 3 9 BCD 0001 0111 0011 1001
00010111 (17) ; 00111001 (39)
number (1739) would consist of 4 bytes 000000001 00000111 00000011 00001001 1 7 3 9
29
α β γ δ ε ζ ι With 7 bit => 27 = 128 combinations (16 only are meaningful) N.B. α,β,χ,δ,ε,ζ,ι are 7 functions of the binary bits xyzw . For instance how can we determine the segment γ = fγ(x,y,z,w) ? How can we sinthesize fγ ? NB 6 (six) and b (b) are differently represented having 6 (six) the segment «α» ON What is the relation between the number to be displayed and the luminous segments ? (1 on – 0 off) Number Hex Bin (xyzw) α β γ δ ε ζ ι
00 0 0000 1 1 1 0 1 1 1 01 1 0001 0 0 1 0 0 1 0 02 2 0010 1 0 1 1 1 0 1 03 3 0011 1 0 1 1 0 1 1 . . . . . . . . . . . . . . . . . . . . 09 9 1001 1 1 1 1 0 1 1 10 A 1010 1 1 1 1 1 1 0 . . . . . . . . . . . . . . . . . . . . 14 E 1110 1 1 0 1 1 0 1 15 F 1111 1 1 0 1 1 0 0
α γ δ ζ ι α β δ ε ι
30
Conv
Keyboard
Conv Arithmetical Logical Network
Electronic Hydraulic Mechanic …………
Display Design?
31
synthesizing the combinatorial networks that is networks whose outputs depend on the inputs
depend on the time too that is on the past history of the network (which will be analysed later)..
2**2**n
I f0 f1 f2 f3 0 1 0 1 1 0 1 1 0 Not considering the identity function (f2 – which electrically is a wire), and the constants (f0 and f1) we have only one important function (f3) which is called negate, inversion or NOT and which is represented by the following symbol: In the expressions (see later) the inversion is normally indicated with a line over the variable which is difficult to print so we use the exclamation point before the variable or an asterisc after the variable. Example f2 = !I or f2 = I*
32
There are 16 different functions I1 I0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15
0 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Not considering the constants and the identities there are the following characteristical two variable functions f14 function OR Symbol (+) f8 function AND Symbol (.) f1 function NOR Symbol f7 function NAND Symbol f6 function EXOR Symbol (⊕) f9 function EQUIV Symbol .
N.B. these symbols correspond to a physical implementation where there is always a delay between the variations of the inputs and the variation of the
technology
The EXOR operator (exclusive or OR) is also named as “module 2 adder ” since its output binary value can be interpreted as the sum of the inputs interpreted as numerical binary values
The combinatorial functions are represented by truth tables. Important functions in red x y z x y z x y z x y z x y z x y z
Mechanical implementation
33
X y Z
Voltage OR
X y Z
Voltage AND
X Z
Voltage NOT Switch closed => 1 Switch open => 0
34
elementary circuits previously described and viceversa ? Truth table Logical scheme synthesys Analisys Combinatorial Algebra
is an algebra (BOOle algebra) which can be used to represent the physical behaviour of the circuits (but for the unavoidable physical delays). An algebra consists of symbols, operations and postulates Symbols: [0,1] Operations: logical sum (+), logical product (.), complement (!) Postulates : 0+0=0 0+1=1 1+0=1 1+1=1 0.0=0 0.1=0 1.0=0 1.1=1 !0=1 !1=0 NB: operations on SYMBOLS , NOT on numbers/bit !!!!
The point is the symbol
(always omitted)
35
set of literals (inputs) and a literal (output). It can be represented by a truth table
where X, Y and Z are binary variables
inputs all possible values. For instance for a n-tuple of 3 variables there are 8 possible combinations. An example of function F is
XYZ F 000 0 001 0 010 1 011 0 100 1 101 0 110 1 111 0
same truth table
reflexive, simmetrical and transitive are valid
36
the AND,OR and NOT operators. An evaluation example F=(((X+Y). !Z). !0)
X Y Z F XYZ F 000 0 001 0 010 1 011 0 100 1 101 0 110 1 111 0
X Y Z F XYZ F 000 0 001 0 010 1 011 0 100 1 101 0 110 1 111 0
The same truth table: equivalent !! Less complex circuit
F=((X+Y). !Z)
and viceversa
37
X+Y=Y+X X.Y=Y.X X+Y+Z=(X+Y)+Z X.Y.Z=(X.Y).Z X.(Y+Z)= (XY)+ (X.Z) X+(Y+Z)=(X+Y)+(X+Z) X+X=X X.X=X (idempotence - both) X+0=X X.0=0 X+1=1 X.1=X X+(X.Y)=X X.(X+Y)=X !(!X)=X X+!X=1 X.!X=0 A.X+A.!X=A (A+X).(A+!X)=A !(X.Y) = !X+!Y !(X+Y)=!X.!Y (De Morgan laws – very important !!) X.Y+Y.Z+ !X.Z= X.Y+!XZ (X+Y).(Y+Z).(!X+Z)=(X+Y).(!X+Z) X+!XY = X + Y (regularly forgotten ….) NB: in the combinatorial algebra we use the same priority rules of the mathematical algebra Prior(!) > Prior(.) > Prior(+) The parenthesis can be used to alter this order. The logical product point is always omitted
38
0 with 1 and the and
F=(((X+Y). !Z). !0) => Fdual= (((X.Y)+!Z)+!1)
equivalent if (((X+Y). !Z). !0) is equivalent to =((X+Y). !Z) (verify !!) then (((X.Y)+!Z)+!1) is equivalent to ((X.Y)+!Z) (verify by means of the truth table)
39
XYZ F 000 0 001 1 010 1 011 0 100 1 101 0 110 1 111 1
F X Z Y
!X!YZ !XY!Z X!Y!Z XY!Z XYZ
depend only from the inputs and NOT from the time, that is its previous history
lines where the function value is 1 must be selected and logical products with all the variables (1 if true, 0 if complemented) called minterms must be formed. !X!YZ !XY!Z X!Y!Z XY!Z XYZ All minterms must be logically summed F= !X!YZ + !XY!Z + X!Y!Z + XY!Z + XYZ Each minterm is 1 for a single combination of the
function Canonical expression as sum-of-products (SP) Two levels expression (the NOT is not considered).
XYZ F 000 0 X + Y + Z 001 1 010 1 011 0 X +!Y +!Z 100 1 101 0 !X + Y +!Z 110 1 111 1
lines where the function is 0 must be selected and logical sums with all the variables (0 if true, 1 if complemented) must be formed. All logical sums (maxterms) must be logically anded. F= (X+Y+Z)(X+!Y+!Z)(!X+Y+!Z) Each maxterm is 0 for a single input combination. Each sum «covers a «0» of the function Canonical expression as product-of-sums (PS) Two levels expression (the NOT is not considered).
40
Important !!!!!! Any combinatorial logical network can be ALWAYS synthesized as a two levels circuit (SP or PS)! A property very often forgotten !!! X Z F (PS) Y
X+Y+Z X+!Y+!Z !X+Y+!Z
The two canonical synthesys (SP and PS) lead in general to circuits of different complexity
41
XYZ F 000 1 001 1 010 1 011 0 100 0 101 1 110 1 111 0
Fsp= !X!Y!Z + !X!YZ + !XY!Z + X!YZ + XY!Z FPS= (X+!Y+!Z)(!X+Y+Z)(!X+!Y+!Z)
42
This is important for the synthesys. The analisys (evaluation) of a circuit provides always (obviously) a completely specified truth table.
sum of minterms (product of maxterms) if we remember that X.1=X, X+!X=1, X+X=X and X.X=X
a+b!c= a(b+!b)(c+!c) + (a+!a)b!c= abc+ab!c+a!bc+a!b!c+ab!c+!ab!c= abc+ab!c+a!bc+a!b!c+!ab!c
XYZ F 000 0 001 1 010 1 011 ? 100 1 101 0 110 ? 111 1 F= !X!YZ + !XY!Z + X!Y!Z + XYZ= !X!YZ + !XY!Z + X!Y!Z + XYZ + !XYZ + XY!Z =
Idempotence
some input combinations never occur (don’t cares). i.e.: mechanical constraints of two keys
= !XZ(!Y+Y) + !XY(!Z+Z) + X!Z(!Y+Y) + X!Z(!Y+Y)= = !XZ + !XY + XY + X!Z = !XZ + Y + X!Z
(the don’t cares can be used - thanks for instance to the idempotence- to simplify the expression of a function)
43
Exercise
Analyse this circuit, write the corresponding function and derive its SP canonical form AB B+C+D !(B+C+D) !(D+E) !((AB)(B+C+D)) !(B+C+D)+!(D+E) Z=!(!((AB)(B+C+D)) + (!(B+C+D)+!(D+E)) )= !(!(AB + ABC + ABD) + !((B+C+D)(D+E))) Z= !(!(AB) +!( BD+BE+CD+CE+D+DE)) Z= ABD + ABCE + ABE = ABD + ABE = ABD(C+!C)(E+!E) + ABE (C+!C)(D+!D)= = ABCDE + AB!CDE + ABCD!E + AB!CD!E + ABCDE + AB!CDE + AB!CDE + AB!C!DE = De Morgan = AB (D+CE+BE) Absorption
1
= ABCDE + AB!CDE + ABCD!E + AB!CDE + AB!C!DE canonical
Can we derive the canonical expression?
De Morgan Absorption Absorption
g0 = !b2!b1b0 + !b2b1!b0 + b2!b1b0 + b2b1!b0 = = ( !b2!b1b0 + b2!b1b0) + (!b2b1!b0 + b2b1!b0) = = !b1b0 + b1!b0 = b0 ⊕ b1
000 001 011 010 110 111 101 100
Gray
000 001 010 011 => 100 101 110 111
Bin
g2g1g0 b2b1b0
g1 = !b2b1!b0 + !b2b1b0 + b2!b1!b0 + b2!b1b0 = = (!b2b1!b0 + !b2b1b0) + (b2!b1!b0 + b2!b1b0) = = !b2b1 + b2!b1 = b2 ⊕ b1 g2 = g2 gn = bn ⊕ bn+1 (N.B. bn+1 for the MSB is obviously 0. In fact g2 = b2 )
gn = bn ⊕ bn+1 Let’s ex-or sum bn+1 to both members of the expression bn+1 ⊕ gn = (bn+1 ⊕ bn+1) ⊕ bn = (0) ⊕ bn = bn and therefore bn = bn+1 ⊕ gn [with n bit bn+1 = 0] In our case b2 = g2 , b1 = b2 ⊕ g1 and b0 = b1 ⊕ g0
Canonical synthesys of function fe of the 7 segments (0-F)
46
Binary DCBA 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 truth table in red where
fe=1
0 1 2 3 4 5 6 7 8 9 A B C D E F (Hex values) f b g e c d a
fe = !D!C!BA + !D!CBA + !DC!B!A + !DC!BA + !DCBA + D!C!BA + D!CBA + DC!B!A + DC!BA + DCBA (SP) 1 3 4 5 7 9 11 12 13 15 fe = (D+C+B+A) (D+C+!B+A) (D+!C+!B+A) (!D+C+B+A) (!D+!C+!B+A) (!D+!C+!B+A) (PS) 0 2 6 8 10 14 Integrated circuit 7446 which doesn’t implement the letters A->F
Red => on Blu => off 11 gates (10x4 inputs AND 1x10 inputs OR)
7 gates (6x4 inputs OR 1x6 inputs AND)
N.B. A segment is lighted if the circuit output has low voltage.This synthesys is made as if the output should be high (for analogy with the previous synthesys). The obtained value must be obvously then inverted