Sunday 21 October 2012

Universal Gate

Universal gate



Universal gate is a gate that can implement to any other Boolean function without use any other gate, like AND, OR, NOT, NAND, NOR. In this section, we will focus on NAND gate and NOR gate.


Why NAND/ NOR gate also are called universal gate?

This is because they can be implemented to others gate/function, so they called universal gate. Example NAND gate can used as NOT gate.


NAND gate

The name NAND is the contraction of NOT-AND.  The graphical symbol of NAND gate consists of AND gate symbol and a burble



The name NAND is the contraction of NOT-AND.(**High output=1,low output=0)
The truth table and symbol of the NAND gate is shown as below.


A
B
X
0
0
1
1
0
1
0
1
1
1
1
0
                     
                 

Implementing NOT using only NAND gate


Implementing AND gate using NAND gate



Implementing OR gate using NAND gate



Implementing NOR gate using only NAND gate






NOR gate
The name NOR is the abbreviation of  NOT-OR.
The grahical symbol for NOR gate consist of OR gate symbol and a burble .
The truth table and graphical symbol of NOR gate is shown below


A
B
X
0
0
1
1
0
1
0
1
1
0
0
0


Below have some example implemented

Implementing NOT gate using only NOR gate




Implementing AND gate using only NOR gate





Implementing OR gate using only NOR gate



Implementing NAND gate using NOR gate





Equivalent way to draw NAND/NOR gate
 A) NAND gate

       B) NOR gate



       Additon:




Kee Hwaai Sziang B031210067



Number System Conversion


Number system conversion

In this section, we will only focus in number system conversion of decimal, binary, octal and hexadecimal.


Decimal to binary

Example :Convert decimal number 33.875 to binary number.

weight
25
24
23
22
21
20
2-1
2-2
2-3
value
32
16
8
4
2
1
0.5
0.25
.0125
binary
1
0
0
0
0
1
1
1
1
                33.875                1.875               0.875               0.375               0.125
               -32.0                   -1.000             -0.500              -0.250              -0.125
                 1.875                  0.875              0.375               0.125                      0


So, 33,87510 = 100001.1112

Decimal to octal

Convert decimal 65.140625 to octal
weight
82
81
80
8-1
8-2
value
64
8
1
0.125
0.015625
hexadecimal
1
0
0
1
1
         65.140625                   1.140625                  0.140625             0.015625
        -64.000000                  -1.000000                -0.125000            -0.015625
           1.140625                   0.140625                  0.015625                    0      

Decimal to Hexadecimal

Convert decimal 272.0625 to hexadecimal
weight
162
161
160
16-1
value
256
16
1
0.0625
hexadecimal
1
1
0
1
           272.0625                     16.0625                       0.0625
          -256.0000                    -16.0000                     -0.0625
             16.0625                       0.0625                           0     

Binary to octal
To convert to octal use 3 digit,
            Example:

                            1110101110.1012 = 001  110  010  110 . 1012 =  1626.58
                                                             1          6      2     6       5


Binary to hexadecimal
To convert to hexadecimal use 4 digit,
            Example:

                            1110101110.1012 = 0011   1001   0110  .  10102 =  396.A16
                                                               3          9          6          10


As the same way to convert from octal, hexadecimal to binary.
Octal to binary
            Example:
                              470.538   =       4          7          0    .   5        3    =100111000.1010112
                                                     100     111     000     101     011


2’s complement

Step to convert to 2’s complement:

           Step 1: change octal, decimal or hexadecimal to binary.
           Step 2:change 0 become 1 and 1 become 0.At this step, number is 1’s complement.

                           Example: 00001100(12)    Ã    11110011
                                           11110001(114)  Ã  00001110
                                           00000010(2)      Ã  11111101

           Step 3: 1’ complement +1. The final value is 2’ complement  

                                           11110011+1=11110100   (-12)
                                           00001110 + 1 = 00001111  (-144)
                                           11111101+1=11111110   (-2)

Example: convert (-27) to 2’s complement

          For using 8-bits, the number 27 is represented by

                                             000110112

           Then convert 1 to 0, 0 to 1,

                                             11100100

          Adding 1 at the final step,

                                       11100101 =  -27


                     

How to differentiate positive / negative number in binary???
Use the most left bit as the sign bit, 0 will represent to positive number,1 will represent to negative number.
            0010 = 2                        1110 = - 2


                                             
Two's complement
Decimal
0111
7
0110
6
0101
5
0100
4
0011
3
0010
2
0001
1
0000
0
1111
−1
1110
−2
1101
−3
1100
−4
1011
−5
1010
−6
1001
−7
1000
−8





Sign bit repetition in 7-bit and 8-bit integers using 2’s complement
Decimal
7-bit notation
8-bit notation
8
0001000
00001000
-8
1111000
11111000
32
0100000
00100000
-32
1100000
11100000





8-bit two's-complement integers
Bits
Unsigned value
2's complement value
00000000
0
0
00000001
1
1
00000010
2
2
01111110
126
126
01111111
127
127
10000000
128
−128
10000001
129
−127
10000010
130
−126
11111110
254
−2
11111111
255
−1


Why 1111(8) does not involve in 4 bit?

Because it is 4-bit number, the most positive 4-bit number is 0111(7), the most negative is 1000(-8).
8 is too large to represent in 4-bit . Therefore, the most positive is 7 (0111).

Kee Hwaai Sziang B031210067