Lecture 1
Dr. Nabil M. Eldakhly
      Faculty of Computers and Information –
              Department of CS-
                            CS-SAMS
                       &
       The French University in Egypt (UFE)
Text Book
Digital Systems &
 Binary Numbers
                     Outline
1.   Digital Systems
2.   Binary Numbers
3.   Number-base Conversions
4.   Octal and Hexadecimal Numbers
5.   Complements
6.   Signed Binary Numbers
7.   Binary Codes
8.   Binary Storage and Registers
9.   Binary Logic
                     Outline
1.   Digital Systems
2.   Binary Numbers
3.   Number-base Conversions
4.   Octal and Hexadecimal Numbers
5.   Complements
6.   Signed Binary Numbers
7.   Binary Codes
8.   Binary Storage and Registers
9.   Binary Logic
               Digital Systems & Binary Numbers
                                   Introduction
     The Information Age (also known as the Computer Age, Digital Age,
     Internet Age, and Information Era) is an idea that the current age will
     be characterized by the ability of individuals to transfer information
     freely and to have instant access to knowledge that would have been
     difficult or impossible to find previously.
رة    و ر ا و ت( ھو، و ر ا ر ت،  وا ر ا ر،و ر       را     م  ً ر ا و ت )ا روف أ
ن      ول ا "وري ( ا ر * ا$  وا،* ر$ ز &درة ا' راد ( &ل ا و ت  وف     $ " دھ أن ا ر ا
                                             . &ً , ور0  ل ا$    أن ن ن ا ب أو ا, -.
     The idea is linked to the concept of a "Digital Age" or "Digital
     Revolution," and carries the ramifications of a shift from traditional
     industry that the Industrial Revolution brought through
     industrialization, to an economy based around the manipulation of
     information.
, 4      *ا & د*ا    ول ن ا$  ل دا ت ا$  و،"* ورة ا ر0 وم "ا ر ا ر " أو "ا," و ر ط ا " رة
     6                          .و ت     ب5 م ( ا9 د         إ ( ا،7 ل ا56 * ن     ورة ا0 ا
            Digital Systems & Binary Numbers
                         Introduction (Cont.)
Digital Age and Information Age
Digital Computers
    – General purposes
    – Many scientific, industrial and commercial applications
Digital Systems
    – Telephone switching exchanges
    – Digital camera
    – Electronic calculators, Personal Digital Assistants (PDAs)
    – Digital TV
Discrete Information-processing Systems
    – Manipulate discrete elements of information
    – For example, {1, 2, 3, …} and {A, B, C, …}…
7
             Digital Systems & Binary Numbers
      Introduction (Cont.)- Analog & Digital Signal
Analog System
– The physical quantities or signals may vary continuously over a specified
    range.
Digital system
– The physical quantities or signals can assume only discrete values.
– Greater accuracy
8
                Digital Systems & Binary Numbers
                         Binary Digital Signal
An information variable represented by physical quantity.
For digital systems, the variable takes on discrete values.
    – Two level, or binary values are the most prevalent values.
Binary values are represented abstractly by:
    – Digits:            0 and 1
    – Words (symbols): False (F) and True (T)
    – Words (symbols): Low (L) and High (H)
    – words:             On and Off
Binary values are represented by values or ranges of values of
physical quantities.
9
             Digital Systems & Binary Numbers
        Number Systems- 1. Decimal Number System
 Base (also called radix) = 10
     – 10 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
 Digit Position
                                                     2     1    0      -1    -2
     – Integer & fraction
                                                    5 1 2              7 4
 Digit Weight
                                                    102   101   100    10-1 10-2
                           Position
     – Weight = (Base)                              100   10    1      0.1 0.01
 Magnitude
     – Sum of “Digit x Weight”
                                             5 *100 +1*10 + 2*1 + 7*0.1 + 4*0.01
 Formal Notation
                                                          (512.74)10
10
             Digital Systems & Binary Numbers
          Number Systems- 2. Octal Number System
 Base = 8
                                               2    1    0       -1    -2
     – 8 digits { 0, 1, 2, 3, 4, 5, 6, 7 }
                                               5 1 2             7 4
 Weights
                                               82   81   80      8-1   8-2
                           Position
     – Weight = (Base)                         64   8    1       1/8 1/64
 Magnitude                                   5 *64 +1*8 + 2*1+ 7/8+ 4/64
     – Sum of “Digit x Weight”                      =(330.9375)10
 Formal Notation                                     (512.74)8
11
             Digital Systems & Binary Numbers
          Number Systems- 3. Binary Number System
 Base = 2
     – 2 digits { 0, 1 }, called binary digits or “bits”
                                                      2    1     0         -1    -2
 Weights
                          Position                    1 0 1                0 1
     – Weight = (Base)
                                                      22   21     20       2-1   2-2
 Magnitude                                            4    2      1        1/2 1/4
                                                 1 *4 + 0*2 + 1*1 + 0*1/2+ 1*1/4
     – Sum of “Bit x Weight”
                                                               =(5.25)10
 Formal Notation
                                                                (101.01)2
 Groups of bits              4 bits = Nibble   1011
                            8 bits = Byte      11000101
12
               Digital Systems & Binary Numbers
       Number Systems- 4. Hexadecimal Number System
 Base = 16
     – 16 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }
                                                      2     1    0        -1     -2
 Weights
     – Weight = (Base)
                           Position                   1 E 5               7 A
                                                      162 161     160     16-1   16-2
 Magnitude
                                                      256 16          1   1/16 1/256
     – Sum of “Digit x Weight”
 Formal Notation                        1 *256+14 *16 + 5 *1+ 7 /16 +10 /256
                                                     =(485.4765625)10
                                                          (1E5.7A)16
13
     Digital Systems & Binary Numbers
                 The Power of 2
     n      2n               n       2n
     0     20=1              8    28=256
     1     21=2              9    29=512
     2     22=4             10    210=1024   Kilo
     3     23=8             11    211=2048
     4     24=16            12    212=4096
     5     25=32            20    220=1M     Mega
     6     26=64            30    230=1G     Giga
     7    27=128            40    240=1T     Tera
14
     Digital Systems & Binary Numbers
                Decimal Addition
            1      1               Carry
                   5    5
           +       5    5
            1      1    0
                             = Ten ≥ Base
                                   Subtract a Base
15
         Digital Systems & Binary Numbers
                     Binary Addition
 Column Addition
                   1 1 1 1 1 1
                     1 1 1 1 0 1       = 61
               +       1 0 1 1 1       = 23
                   1 0 1 0 1 0 0       = 84
                                       ≥ (2)10
16
         Digital Systems & Binary Numbers
                       Binary Subtraction
 Borrow a “Base” when needed
                       1x25                 2x22                  = (10)2
                0x26   2x25   2x24   0x23   0x22   2 x21
                1x26   0x25   0x24   1x23   1x22   0x21    1x20
                1 0 0 1 1 0 1                                     = 77
            −                 1x24   0x23   1x22   1x21    1x20
                              1 0 1 1 1                           = 23
                0 1 1 0 1 1 0                                     = 54
17
         Digital Systems & Binary Numbers
                Binary Subtraction (Cont.)
 Borrow a “Base” when needed
                  1     2                    = (10)2
                0 2 2 0 0 2
                1 0 0 1 1 0 1                = 77
            −           1 0 1 1 1            = 23
                0 1 1 0 1 1 0                = 54
18
              Digital Systems & Binary Numbers
                       Binary Multiplication
 Bit by bit
                                 1 0 1 1 1
                   x                 1 0 1 0
                                 0 0 0 0 0
                             1 0 1 1 1
                          0 0 0 0 0
                 + 1 0 1 1 1
                    1 1 1 0 0 1 1 0
19
                     Outline
1.   Digital Systems
2.   Binary Numbers
3.   Number-base Conversions
4.   Octal and Hexadecimal Numbers
5.   Complements
6.   Signed Binary Numbers
7.   Binary Codes
8.   Binary Storage and Registers
9.   Binary Logic
      Digital Systems & Binary Numbers
             Number Base Conversions
                  Evaluate
                 Magnitude
                                       Octal
                                      (Base 8)
                   Evaluate
                  Magnitude
      Decimal                   Binary
     (Base 10)                 (Base 2)
                                    Hexadecimal
                                     (Base 16)
                    Evaluate
                   Magnitude
21
                       Digital Systems & Binary Numbers
                      Decimal (Integer) To Binary Conversion
       Divide the number by the ‘Base’ (=2)
       Take the remainder (either 0 or 1) as a coefficient
       Take the quotient and repeat the division
         Example: (13)10
                                        Quotient   Remainder     Coefficient
                              13/ 2 =      6          1            a0 = 1
                              6 /2=        3          0            a1 = 0
                              3 /2=        1          1            a2 = 1
                              1 /2=        0          1            a3 = 1
                                Answer:        (13)10 = (a3 a2 a1 a0)2 = (1101)2
Most Significant Bit (MSB)                           MSB         LSB
Least Significant Bit (LSB)
      22
            Digital Systems & Binary Numbers
           Decimal (Fraction) To Binary Conversion
Multiply the number by the ‘Base’ (=2)
Take the integer (either 0 or 1) as a coefficient
Take the resultant fraction and repeat the division
  Example: (0.625)10
                              Integer       Fraction   Coefficient
               0.625 * 2 =       1      .     25       a-1 = 1
               0.25 * 2 =        0      .     5        a-2 = 0
               0.5   *2=         1      .     0        a-3 = 1
               Answer:      (0.625)10 = (0.a-1 a-2 a-3)2 = (0.101)2
                                            MSB        LSB
23
         Digital Systems & Binary Numbers
              Decimal To Octal Conversion
 Example: (175)10
                        Quotient     Remainder         Coefficient
            175 / 8 =       21              7            a0 = 7
            21 / 8 =        2               5            a1 = 5
            2 /8=           0               2            a2 = 2
                    Answer:        (175)10 = (a2 a1 a0)8 = (257)8
 Example: (0.3125)10
                              Integer       Fraction   Coefficient
            0.3125 * 8 =        2       .     5          a-1 = 2
            0.5    *8=          4       .     0          a-2 = 4
           Answer:       (0.3125)10 = (0.a-1 a-2)8 = (0.24)8
24
                     Outline
1.   Digital Systems
2.   Binary Numbers
3.   Number-base Conversions
4.   Octal and Hexadecimal Numbers
5.   Complements
6.   Signed Binary Numbers
7.   Binary Codes
8.   Binary Storage and Registers
9.   Binary Logic
           Digital Systems & Binary Numbers
                Binary To Octal Conversion
                                                 Octal Binary
8 = 23
Each group of 3 bits represents an octal digit    0     000
                                                  1     001
                   Assume Zeros                   2     010
Example:
                                                  3     011
             ( 1 0 1 1 0 . 0 1 )2
                                                  4     100
                                                  5     101
                                                  6     110
             ( 2       6    . 2 )8
                                                  7     111
Works both ways (Binary to Octal & Octal to Binary)
26
           Digital Systems & Binary Numbers
            Binary To Hexadecimal Conversion
                                             Hex      Binary
16 = 24                                           0   0000
Each group of 4 bits represents a                 1   0001
                                                  2   0010
hexadecimal digit                                 3   0011
                                                  4   0100
                                                  5   0101
                  Assume Zeros
Example:                                          6   0110
                                                  7   0111
             ( 1 0 1 1 0 . 0 1 )2                 8   1000
                                                  9   1001
                                                  A   1010
                                                  B   1011
                                                  C   1100
             (1     6     . 4 )16                 D
                                                  E
                                                      1101
                                                      1110
                                                  F   1111
Works both ways (Binary to Hex & Hex to Binary)
27
           Digital Systems & Binary Numbers
             Octal To Hexadecimal Conversion
 Convert to Binary as an intermediate step
Example:
                 ( 2      6    .   2 )8
Assume Zeros                                 Assume Zeros
                ( 0 1 0 1 1 0 . 0 1 0 )2
                 (1      6     .   4 )16
     Works both ways (Octal to Hex & Hex to Octal)
28
         Digital Systems & Binary Numbers
     Decimal, Binary, Octal, & Hexadecimal Numbers
            Decimal   Binary   Octal   Hex
              00      0000      00     0
              01      0001      01     1
              02      0010      02     2
              03      0011      03     3
              04      0100      04     4
              05      0101      05     5
              06      0110      06     6
              07      0111      07     7
              08      1000      10     8
              09      1001      11     9
              10      1010      12     A
              11      1011      13     B
              12      1100      14     C
              13      1101      15     D
              14      1110      16     E
              15      1111      17     F
29