combinatorial networks i
play

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. Combinatorial networks- I Digital Systems M 1

  2. Digital Systems Some examples • Computer • Cameras • Mobile phones • Automobiles (injection, ABS..) • .... 2

  3. Digital systems Physical systems using quantized values to represent, compute and transfer informations 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

  4. Analog and digital signals “noise” • Analog signal • Digital signal (quantized) H • Binary signal. H and L values are convenzionally indicated as 1 and 0 L (bit – logic not numerical meaning !!! ) 4

  5. Switch • Digital systems consist of switches • ON/OFF devices • Example + Vcc I i : {I min ,0} I i Cause V u Effect V u : {0, Vcc}

  6. An example: car petrol measurement (ON/OFF) sensor Binary variable (Bit) 8/8 4/4 7/8 6/8 3/4 5/8 4/8 2/4 3/8 2/8 1/4 Reserve ? 1/8 3 bit 2 bit (00/01/10/11 – 4 levels 1 bit (0/1) – 2 levels (000/001/010/011/100/101/ 110/111) - 8 levels

  7. Conversions A/D D/A Ex: valve position Ex: steam pressure Computer Analog to Digital and Digital to Analog conversion 7

  8. Information coding Real picture Sensor acquired image Quantized numerical values R ∈ {0,1,2,..,254,255} G ∈ {0,1,2,..,254,255} B ∈ {0,1,2,..,254,255} 8

  9. 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 10 3 + 5 x 10 2 + 4 x 10 1 + 7 x 10 0 N.B. There are NON positional numerical systems: i.e. the roman numbers (XXIII => 23 10 ) • 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. α and β or H(igh) and L(ow) or 0 and 1 etc.). A set of n of these symbols can characterise 2 n 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. α and β and γ ). With n of these symbols 3 n objects can be identified and so on ….. • Nothing to do with numbers !!! • Using a binary code in order to code N objects (where N is not a power of 2) we need at least Z binary symbols where Z is the first integer greater 9 than log 2 (N) => |log 2 (N)|

  10. 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, α / β 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 100101 2 = 1 x 2 5 + 0 x 2 4 + 0 x 2 3 + 1 x 2 2 + 0 x 2 1 + 1 x 2 0 = 32 + 4 + 1 = 37 10 • Within the binary numerical system it is possible to execute all arithmetical operations 10

  11. Binary numbers • 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 2 n numbers that is we cover the range 0….2 n -1 ( never forget the zero …). With 16 bit the range is 0 to 65535 10 (= 65536 10 -1) • Alfanumerical codes: i.e. ASCII code 7 bit (see later) 11

  12. Elementary operations with binary numbers 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 = ---------------- ----- 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 12

  13. Elementary operations with binary numbers 101101 x 1011 45 x 11 ------------- ------- 101101 45 101101= 45= 000000== ------- 101101=== 495 ------------- 111101111 111110 101 62:5= 12 with remnant 2 101 1100 0101 101 00010 13

  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 adding 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 14

  15. Negative binary numbers 1011011+ -37+ 1100+ -4+ 0010010= 18= 1101= -3= ------- --- ---- -- 1101101 => 0010010 + 1= 0010011 -19 11001 -7 • In case of a carry beyond the MSB the carry must be discarded (automatically implemented in the computers for physical reasons ) 1011011 + -37 + Careful !! 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 -64 10 that is 1000000 up to +63 10 that is 0111111). In general with n bit the range is -2 n-1 to +2 n-1 -1 (because of the zero..). Example 4 bit (3 bit + sign ) range from 1000 -> -8 to 0111 -> +7 15

  16. Negative binary numbers • With N bit numbers (that is N-1 data bit plus sign) the numbers range is -2 N-1 --- 2 N-1 -1. Ex. With 8 bit (7 + 1 bit) -> 2 N-1 = 2 7 = 128 10 -> -2 N-1 = -128 and 2 N-1 -1 = 127 • The zero remains unchanged (0000 => 1111+1 => 0000 discarding the last bit) • Non integer number arithmetic is extremely complex (floating point numers) 16

  17. Base 5 arithmetic Base 10 Base 5 1 0 1 0 1 Carry-over 4 1 2 + 1 0 7 + 2 1 3 = 5 8 = ---------------- ----- 1 1 3 0 1 6 5 1130 5 = 1 x 125 + 1 x 25 +3 x 5 + 0= 165 10 Base 5 Base 10 5 5 0 10 10 Borrow 4 1 2 - 1 0 7 - 2 1 3 = 5 8 = ---------------- -------- 1 4 4 4 9 144 5 = 1 x 25 + 4 x 5 + 4 = 49 10

  18. Hexadecimal codes and numbers • 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 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 18

  19. Hexadecimal strings 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 16 10 is reached) A57B + B342 = ---------- 158BD 19

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

  21. Gray code • Adjacent configurations differ by a single bit 011 Gray Bin 010 000 000 Transient 001 001 000 or 011 011 010 010 011 110 100 111 101 101 110 110 100 111 White => 0 Black => 1 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. 21

  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. 22

Recommend


More recommend