Tuesday, February 7, 2012

Basic structure of a transistor.


A transistor has three regions

The emitter : This is heavily doped. Its function is to emit electrons or holes into the transistor.

The base: It is in between the collector and emitter. It is lightly doped. It passes most of the charge carriers from the emitter to the collector.

The collector: It collects the charge carriers from the emitter. It doping is less than emitter but higher than that of base.




Friday, February 3, 2012

2's complement arithmetic


Addition of two positive number: The addition of positive number follows the same rules that of the binary addition.

The magnitude of the sum should be in range(ie it should not go out of range of the system). If the sum goes out of range the sign bit will become 1.

Eg
+8   0,1000
+10 0,1010
---------
1,0010 (This answer is incorrect because in here we consider a 4bit operands)

2's complement subtraction: It is the addition of minuend to the 2's complement of the subtrahend. The sign bits of the two numbers are considered as a part of the number and is used in the addition.

Eg +5 0,0101
      -3 1,1101 (2's complement of 3)
         ---------
   +2 10,0010          (the one is ignored) 

The over flow produced in the addition is ignored. The bit in the sign bits position will be the correct sign bit after addition. If the result is negative it will be in 2's complement form.

Eg -5 1,1011
    +3 0,0011
       --------
    -2 1,1110

Addition of two negative numbers in 2's complement form: Here also the over flow bit is discarded. The sign bit is correct if the result is in the allowed range(for 4 bit operand the range is <=15). The sign bit will become 1 indicating error if the answer goes out of range.

Eg -5 1,1011
     -3 1,1101
        ---------
    -8 11,1000


Eg -8 1,1000
     -9 1,0111
      ----------
       10,1111 (not correct as the result goes out of range)


Ones complement arithmetic


consider the arithmetic x-y and x+y. For computing these two equations in the normal way we need two different circuits because they do different two operations. The use of ones complement comes here as x-y can be also represented as x+ 1's complement of y. This eliminates the use of two different circuits for addition and subtraction.

In our examples below we use 4 bit numbers and assumes that the um should be less than or equal to 15. If it exceeds 15 we will get an incorrect answer. 

+3=
0,
0
0
1
1
+7=
0,
0
1
1
1
+10
0,
1
0
1
0


+8=
0,
1
0
0
0
+9=
0,
1
0
0
1

1,
0
0
0
1
Not correct as the sum exceeds 15

Addition rules

  1. If an over flow is produced beyond the sign bit while adding two signed numbers, then the over flow bit is removed and added to the result. The examples below explains it.


    2. If a positive number is added to a negative number and does not result in a over flow , then the result is negative and is in ones complement form. An example is given below.

    -5 1, 1 0 1 0
    +3 0, 0 0 1 1
    -2 1, 1 1 0 1   

    3. If two negative numbers are added there will be a over flow. This over flow bit is added to the result. The sign will be that of the final answer. The magnitude of the sum should be less than 15 in this case as we use only 4 bit operands. Some examples are shown below.