Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile...

44
Combinatorial networks- I 1 Digital Systems M

Transcript of Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile...

Page 1: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Combinatorial networks- I

1

Digital Systems M

Page 2: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Digital Systems

Some examples

• Computer

• Cameras

• Mobile phones

• Automobiles (injection, ABS..)

• ....

2

Page 3: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Physical systems using quantized values to represent, compute and transfer informations

Digital systems

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

Page 4: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Analog and digital signals

• Analog signal

• Digital signal

• Binary signal. H and L values are convenzionally indicated as 1 and 0 (bit – logic not numerical meaning!!!)

L

H

“noise”

4

Page 5: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

+ Vcc

Vu

Ii

Ii: {Imin,0}

Vu: {0, Vcc}Cause Effect

Switch• Digital systems consist of switches

• ON/OFF devices

• Example

Page 6: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

An example: car petrol measurement

1/4

2/4

3/4

4/4

1/82/83/84/85/86/87/88/8

2 bit (00/01/10/11 – 4 levels3 bit

(000/001/010/011/100/101/110/111) - 8 levels

Reserve ?

(ON/OFF) sensor

1 bit (0/1) – 2 levels

Binary variable (Bit)

Page 7: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Conversions

A/D D/A

Computer

Analog to Digital and Digital to Analog conversion

Ex: steam pressure Ex: valve position

7

Page 8: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Information coding

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

Page 9: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Numbers and codes• A positional numerical system (i.e. that used in the computers) is a

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)

• A code is a set of symbols whose combinations single out different objects. For instance the Morse code (point and dash, the colours and their positions of a flag), the bar code etc.

• A binary code is a code which uses only two symbols (i.e. a and b or H(igh) 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

• A ternary code uses three symbols (i.e. a and b and g ). With n of these symbols 3n objects can be identified and so on …..

• Nothing to do with numbers !!!• Using a binary code in order to code N objecs (where N is not a

power of 2) we need at least Z binary symbols where Z is the first integer greater than log2(N) => |log2(N)|

9

Page 10: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Binary codes• Very often (almost always) the two symbols used for a binary code are 0

and 1, in this case absolutely without any numerical meaning (they are equivalent to low/high, red/green, open/close, a/ b 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)

• There are redundant codes (for instance the code 1 out of N where each configuration has only one bit equal to 1). In this case with N bit N objects are identified (ex: 010000, 000010 etc.)

• There is also a positional binary numerical system where the same 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

• Within the binary numerical system it is possible to execute all arithmetical operations

10

Page 11: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Binary numbers

11

• The power of 2: 1,2,4,8,16,32,64,128,256,512,1024, 2048,4096,8192, 16384, 32768, 65536 must be known by heart !!!!

• In case of binary numerical values 0 e 1 too the word bit is used (somehow confusing…)

• With n bit we can represent 2n numbers that is we cover the range

0….2n-1

(never forget the zero …). With 16 bit the range is 0 to 6553510 (= 6553610-1)

• Alfanumerical codes: i.e. ASCII code 7 bit (see later)

Page 12: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Elementary operations with binary numbers

12

1 1 1 1 0 1 0 0 1 Carry 1 1 0 1 0 1 1 + 1 0 7 + 0 1 1 1 0 1 0 = 5 8 =---------------- -----1 0 1 0 0 1 0 1 1 6 5

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 =---------------- -------- 0 1 1 0 0 0 1 4 9

Page 13: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

13

101101 x 1011 45 x 11------------- ------- 101101 45 101101= 45= 000000== ------- 101101=== 495------------- 111101111

111110 101 62:5= 12 with remnant 2101 11000101 101 00010

Elementary operations with binary numbers

Page 14: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

14

Negative binary numbers• Many different coding systems: 2’ complement is almost always used

• Given a binary positive number its 2’s complement (negative equivalent) can be obtained by substituting the 1s with 0s and viceversa (bit complement operation) and summing then 1. Same procedure for converting 2’s complement negative numbers into positive numbers

• The 2’s complement negative numbers have a “1” as most significant bit in 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 .

• The elementary operations with 2’s complement numbers produce 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 -37 => +37

Page 15: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Negative binary numbers

15

• In case of a carry beyond the MSB the carry must be discarded (automatically implemented in the computers for physical reasons )

1011011+ -37+ 1100+ -4+ 0010010= 18= 1101= -3=------- --- ---- --1101101 => 0010010 + 1= 0010011 -19 11001 -7

1011011 + -37 + 1010010 = -46 = ------- ---10101101 ERROR – OVERFLOW -83

|-83| > 63!!

By summing two negative numbers we have obtained a positive number !!! “Overflow” error in the computers

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

Careful !!

Page 16: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

16

• The zero remains unchanged (0000 => 1111+1 => 0000 discarding the last bit)

• Non integer number arithmetic is extremely complex (floating point numers)

• With N bit numbers (that is N-1 data bit plus sign) the numbers range is 2N-1 --- 2N-1 -1.

Ex. With 8 bit (7 + 1 bit) -> 2N-1 = 27 = 12810 -> -2N-1 = -128 and 2N-1 -1 = 127

Negative binary numbers

Page 17: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Base 5 arithmetic

1 0 1 0 1 Carry 4 1 2 + 1 0 7 + 2 1 3 = 5 8 =---------------- ----- 1 1 3 0 1 6 5

5 5 0 10 10 Borrow 4 1 2 - 1 0 7 - 2 1 3 = 5 8 =---------------- -------- 1 4 4 4 9

11305 = 1 x 125 + 1 x 25 +3 x 5 + 0= 16510

Base 10Base 5

Base 10Base 5

1445 = 1 x 25 + 4 x 5 + 4 = 4910

Page 18: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Hexadecimal codes and numbers

18

• Very often the binary strings are too long for being represented. For instance:

00101001011110100101100101010

• This string is too long to be remembered. It is used therefore a Hexadecimal notation by grouping by four the string

Binary Hexadecimal (HEX) 0000 0 0001 1

0010 20011 30100 40101 50110 60111 71000 81001 91010 A1011 B1100 C1101 D1110 E1111 F

Page 19: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Hexadecimal strings

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 =

---------- 158BD

Page 20: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

20

ASCII code

Here non western characters (arabs, polish, cyrillic etc.) are missing. Unicode is a 16 bit code (65536 combinations) which allows to represent all alfanumeric symbols

Page 21: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

21

Gray code

000001011 010 110 111 101 100

Gray000001010 011 100 101 110 111

Bin

• Adjacent configurations differ by a single bit

010

011

110

Very usefult for representing the position of 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

000 o 011Transient

Page 22: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

22

Parity• There are codes which allow to identify in a transmission or in one datum a

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

• Obviously a parity bit protects against single errors and not double or multiple errors-

Trasmitted 1001011 (even parity)

Received 1001111 Single error (green bit ) !!1011001 Double error NOT

detected!

• If it is accepted that a transmission is not too noisy (that is a single bit error is the most likely) parity is a simple and very effective method.

Page 23: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

23

Error correcting codes

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

?

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)

000111

Page 24: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Code conversion

24

• The conversion of a binary numerical code into a decimal one is straightforward (positional codes).

• The conversion from decimal to binary can be achieved through 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

Page 25: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

25

Binary Coded Decimals

• Decimal numbers code where each digit is made of its binary equivalent

• “Packed” notation : each digit (decimal number) consists of 4 bit

decimal 1 7 3 9 BCD 0001 0111 0011 1001

• In the “packed” notation two decimal digits are stored in a “byte” (8 bit )

• In a computer the same number would consist of two bytes

00010111 (17) ; 00111001 (39)

• “Unpacked”notation: one byte per each decimal digit. The previous number (1739) would consist of 4 bytes

000000001 00000111 00000011 00001001 1 7 3 9

Page 26: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

26

Binary codes and BCD conversions

To convert a binary code into BCD code it is sufficient to divide by 1010 that is 000010102 and (unpacked case) store the result in the MSB and the remainder in the LSB, For the packed case the result must be stored in the MSnibble (4 bit) and the remainder in the LSnibble . For instance

001101012 => 5310

00110101 : 1010 = 00000101 00000011 (unpacked 510 with remainder 310)

To convert BCD into binary, the reverse operation must be carried out. To convert an unpacked BCD it is sufficient to multply the MSB by 1010 (that is 10102) and add the sum with the LSB

00001001 00000010 (92 in BCD)

00001001 x 1010 = 01011010 (9010) which summed with 0000010 gives

01011100 that is (9210)

For BCD packed case the MSnibble must be multiplied by 10 and add the sum must be with the LSnibble

Page 27: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

7 segments matrix (example)

29

ab gd

e zi

What is the relation between the number to be displayed and the luminous segments ? (1 on – 0 off)

Number Hex Bin (xyzw) a b g d e z i 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

N.B. , , , , , ,a b c d e z i are 7 functions of the binary bits xyzw . For instance how can we determine the segment g = fg(x,y,z,w) ? How can we sinthesize fg ?

NB 6 (six) and b (b) are differently represented having 6 (six) the segment «a» ON

With 7 bit => 27 = 128 combinations(16 only are meaningful)

Page 28: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

How can we design a circuit (of any technology) able to implement arithmetical operations on binary numbers

30

ConvKeyboardArithmetical

LogicalNetworkElectronicHydraulicMechanic…………

Conv Display

Design?

Page 29: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Combinatorial networks

31

• The previous 7 segments table is an example of a truth table which is the basic structure for synthesizing the combinatorial networks that is networks whose outputs depend on the inputs

only and NOT on the time. These networks differ from the sequential networks whose outputs depend on the time too that is on the past history of the network (which will be analysed later)..

• Given n binary input variables, the number of different functions which can be implemented is •

2**2**n

• For instance with one input we can implement four combinatorial functions only

I f0 f1 f2 f3 0 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*

Page 30: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Two variables functions

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 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 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 output which depends on 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

xy z

xy z

xy z

xy z

xy z

xy z

Page 31: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Mechanical implementation

33

X

yZ

Voltage

OR

X yZVoltage

AND

X

ZVoltageNOT

Switch closed => 1Switch open => 0

Page 32: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Combinatorial Algebra

34

• How can we transform a truth table into a logical network which uses the elementary circuits previously described and viceversa ?

Truthtable

Logicalscheme

synthesys

Analisys

Combinatorial Algebra

• The combinatorial algebra is used to describe the functions of binary variables. It is an 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 (!)

Postulaties : 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 symbolof the logical product

(always omitted)

Page 33: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

35

• Constant: symbols 1 and 0• Variables (binary): a literal which can assume the symbols 1 and 0 (very often

«values» is used) • Function: f(x1, x2, …. xn) of n binary variables: a correspondence between a set of

literals (inputs) and a literal (output). It can be represented by a truth table• Expression: a combination of literals and operations. i.e.: (((X+Y). !Z). !0) where X, Y

and Z are binary variables • Evaluation: the computation of the binary value of an expression using the

operations and the postulates of the algebra and giving to the n-tuple of the 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

• Equivalent expressions: two expressions whose evaluations produce the same truth table

• Properties: reflexive, simmetrical and transitive are valid

Combinatorial Algebra

Page 34: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Combinatorial algebra and logical operatorsAnalisys

36

• The postulates of the combinatorial algebra correspond to the behaviour of the AND,OR and NOT operators. An evaluation example

F=(((X+Y). !Z). !0)

XY

Z

0

F

• It can be derived that an expression corresponds to a logical scheme and viceversa

• Let’s evaluate this scheme

XYZ F 000 0 001 0 010 1 011 0

100 1

101 0 110 1 111 0

XY

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)

Page 35: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Some properties of the combinatorial algebra (verified through the evaluation)

37

X+Y=Y+X X.Y=Y.X X+Y+Z=(X+Y)+Z X.Y.Z=(X.Y).ZX.(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=XX+(X.Y)=X X.(X+Y)=X!(!X)=X X+!X=1 X.!X=0A.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

Page 36: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Dual Expressions

38

• A dual expression is obtained by replacing 0 with 1 and the and operator with or, and viceversa (the inversion remains unchanged)

• Easily verified (Fdual)dual=F

• If two expressions are equivalent are equivalent also the dual expressions

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)

F=(((X+Y). !Z). !0) => Fdual= (((X.Y)+!Z)+!1)

Page 37: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Combinatorial algebra and logic operatorssynthesys

39

XYZ F000 0001 1 !X!YZ 010 1 !XY!Z011 0100 1 X!Y!Z101 0110 1 XY!Z111 1 XYZ

F

X

Z

Y

!X!YZ

!XY!Z

X!Y!Z

XY!Z

XYZ

• How can we derive a circuit from the truth table?

• Combinatorial circuits: circuits where the outputs depend only from the inputs and NOT from the time, that is its previous history

• From the truth table. The lines where the function value is 1 must be selected and logical products with all the variables (1 if true, 0 if complemented) must be formed. All logical products (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 inputs. Their logical sum «covers» all the 1’s of the function

Canonical expression as sum-of-products (SP) Two levels expression (the NOT is not considered).

Page 38: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Combinatorial algebra and logic operatorssynthesys

40

XYZ F000 0 X + Y + Z001 1 010 1 011 0 X +!Y +!Z100 1 101 0 !X + Y +!Z110 1 111 1

• As an alternative the 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 functionCanonical expression as product-of-sums (PS) Two levels expression (the NOT is not considered).

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

Page 39: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

41

An exampleXYZ F000 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)

Page 40: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Espansion

42

XYZ F000 0001 1 010 1 011 ?100 1 101 0110 ? 111 1

This is important for the synthesys. The analisys (evaluation) of a circuit provides always (obviously) a completely specified truth table.

• A SP (PS) expression (non canonical) can be «expanded» so as to become a 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

• Very often a combinatorial function is not completely specified, that is some input combinations never occur (don’t cares). i.e.: mechanical constraints of two keys

F= !X!YZ + !XY!Z + X!Y!Z + XYZ= !X!YZ + !XY!Z + X!Y!Z + XYZ + !XYZ + XY!Z = = !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)

Idempotence

Page 41: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

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

De Morgan= AB (D+CE+BE)

Absorption

1

0

0

= ABCDE + AB!CDE + ABCD!E + AB!CDE + AB!C!DE

Page 42: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Transcoding:Binary to Gray and viceversa

• Observing the gray code we have

g0 = !b2!b1b0 + !b2b1!b0 + b2!b1b0 + b2b1!b0 = = ( !b2!b1b0 + b2!b1b0) + (!b2b1!b0 + b2b1!b0) = = !b1b0 + b1!b0 = b0 Å b1 000

001011 010 110 111 101 100

Gray

000001010 011 =>100 101 110 111

Bing2g1g0b2b1b0

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 )

• Gray to binary. A truth table can be used (try as exercise) or we can use an algebric algorithm

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

Page 43: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

Canonical synthesys of function fe of the 7 segments (0-F)

46

BinaryDCBA0000000100100011010001010110011110001001101010111100110111101111

truth table in red where fe=1

0 1 2 3 4 5 6 7 8 9 A B C D E F (HEX)

f bg

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!CB!A + !DCB!A + D!C!B!A + D!CB!A + DCB!A ) 0 2 6 8 10 14

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 => onBlu => off

Selecting 0’and inverting(less complex)

11 gates(10x4 inputs AND1x10 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

Page 44: Combinatorial networks- I 1 Digital Systems M. Digital Systems Some examples Computer Cameras Mobile phones Automobiles (injection, ABS..).... 2.

FPGA Design using Xilinx

Install the Xilinx development system (freeware – the file on the site is valid for both Windows – any - and Linux OS) with the «webpack» option

47

Bring for the next lecture your laptop with installed Xilinx