Wednesday, September 1, 2010

Number System, Boolean Operation and Logic Circuits

DECIMAL NUMBER SYSTEM:-
The decimal (base ten or occasionally denary) numeral system has ten as its base. It is the most widely used numeral system, perhaps because humans have ten digits over both hands.
Decimal notation is the writing of numbers in the base 10 numeral system, which uses various symbols (called digits) for no more than ten distinct values (0, 1, 2, 3, 4, 5, 6, 7, 8 and 9) to represent any numbers, no matter how large or how small. These digits are often used with a decimal separator which indicates the start of a fractional part, and with one of the sign symbols + (positive) or − (negative) in front of the numerals to indicate sign. There are only two truly positional decimal systems in ancient civilization, the Chinese counting rods system and Hindu-Arabic numeric system both required no more than ten symbols. Other numeric systems require more or fewer symbols.
The decimal system is a positional numeral system; it has positions for units, tens, hundreds, etc. The position of each digit conveys the multiplier (a power of ten) to be used with that digit—each position has a value ten times that of the position to its right.
Ten is the number which is the count of fingers and thumbs on both hands (or toes on the feet). In many languages the word digit or its translation is also the anatomical term referring to fingers and toes. In English, decimal means tenth, decimate means reduce by a tenth and denary means the unit of ten. The symbols for the digits in common use around the globe today are called Arabic numerals by Europeans and Indian numerals by Arabs, the two groups' terms both referring to the culture from which they learned the system. However, the symbols used in different areas are not identical; for instance, Western Arabic numerals (from which the European numerals are derived) differ from the forms used by other Arab cultures.
In decimal systems each decimal place is a base of 10. For example:


BINARY NUMBER SYSTEM
The binary numeral system, or base-2 number system, is a numeral system that represents numeric values using two symbols, usually 0 and 1. More specifically, the usual base-2 system is a positional notation with a radix of 2. Owing to its straightforward implementation in digital electronic circuitry using logic gates, the binary system is used internally by all modern computers.

A binary number can be represented by any sequence of bits (binary digits), which in turn may be represented by any mechanism capable of being in two mutually exclusive states.
In keeping with customary representation of numerals using Arabic numerals, binary numbers are commonly written using the symbols 0 and 1. When written, binary numerals are often subscripted, prefixed or suffixed in order to indicate their base, or radix. The following notations are equivalent:
1001012 (a subscript indicating base-2 (binary notation)
When spoken, binary numerals are usually read digit-by-digit, in order to distinguish them from decimal numbers. For example, the binary numeral 100 is pronounced one zero zero, rather than one hundred, to make its binary nature explicit, and for purposes of correctness. Since the binary numeral 100 is equal to the decimal value four, it would be confusing, and numerically incorrect, to refer to the numeral as one hundred.
7410 = 10010102
OCTAL NUMBER SYSTEM
The octal numeral system, or oct for short, is the base-8 number system, and uses the digits 0 to 7. Numerals can be made from binary numerals by grouping consecutive digits into groups of three (starting from the right).

For example, the binary representation for decimal 74 is 1001010, which groups into 001 001 010 — so the octal representation is 112.

In octal numerals each place is a power with base 8. For example:


By performing the calculation above in the familiar decimal system we see why 112 in octal is equal to 64+8+2 = 74 in decimal.

HEXADECIMAL NUMBER SYSTEM
Hexadecimal (also base-16, hexa, or hex) is a numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F (or a through f) to represent values ten to fifteen.

Its primary use is as a human friendly representation of binary coded values, so it is often used in digital electronics and computer engineering. Since each hexadecimal digit represents four binary digits (bits)—also called a nibble—it is a compact and easily translated shorthand to express values in base two.
7410=4Ahex
NUMBER SYSTEM CONVERSION

Binary – Decimal Conversion



Decimal – Binary Conversion
To convert a decimal number to binary, first subtract the largest possible power of two, and keep subtracting the next largest possible power from the remainder, marking 1s in each column where this is possible and 0s where it is not.
Example 1 - (Convert Decimal 44 to Binary)


Example 2 - (Convert Decimal 15 to Binary)


BINARY ADDITION
Binary addition is performed in a similar way to decimal addition. We apply these rules
1) 0+0=0
2) 1+0=1
3) 0+1=1
4) 1+1=10 (with a carry of 1)
When 1+1 is performed, 1+1=0 and carry 1.

Example 1: Add (110)2 and (010)2
Binary Decimal
110 6
+010 + 2
1000 8

Example 2: Add (0101)2 and (1001)2
Binary Decimal
0101 5
+1001 + 9
1110 14

BINARY SUBTRACTION
Binary subtraction is performed in a similar way to decimal subtraction. We apply these rules
1) 1-1=0
2) 1-0=1
3) 0-1=1 (with a borrow of 1)
4) 0-0=0
Example 1: Subtract (0101)2 and (1001)2
Binary Decimal
1001 9
-0101 - 5
0100 4

Example 2: Subtract (0111)2 from (1001)2
Binary Decimal
1001 9
-0111 - 7
0010 2

BOOLEAN OPERATORS AND LOGIC CIRCUITS
We are all familiar with the arithmetic operators – add (+), subtract (-), multiply (*) and divide (/). These operate on numbers, so, for instance, we say:
add two numbers
multiply two numbers
These operators are precisely defined, in that the addition of two numbers, 12 and 16, say, always produces the same answer, 28. In algebra, we are used to expression like:
a+b or ab
We cannot tell what is the value of a+b unless we know what are the values of a and b. But if a=12 and b=16, then we know that a+b=28. Here, a and b are called operands and + is the operands.

Apart from arithmetic operators, we can define logical operators which operate on what are called truth values; a truth value can be TRUE or FALSE.

The common logical operators are:
AND
OR
NOT
Logical Operators are also Boolean Operators. Just as we speak of the arithmetic (or number) constants 10, 15, 3 etc, so too, we can speak of the logical or Boolean constants, True or False. Note, however, that whereas there is an infinite number of an arithmetic constant, there are only two Boolean constants. Above, we saw the algebraic expression:
a + b
where a and b can be any number constants. Similarly, we can have a Boolean expression:
A AND B
where A, B can be either True or False. (As above A and B are called operands.) What we need to specify is what value we give to a Boolean expression based on the value of its operands. For instance, what is the value of:
True AND False?
Or, put another way, what is the value of:
A AND B
When A is true and B is false?
We can define the results of Boolean operations using a truth table. A truth table lists all possible combinations of the operands, and, for each combination, gives the value of the expression. For example, consider the expression;
A AND B
There are two operands, A and B. Since each operand can have up to two values, there are four combinations of A and B, thus:

A B
False False
False True
True False
True True
The truth table for A and B is:

A B A AND B
False False False
False True False
True False False
True True True

Note that A AND B is True only when both A and B are True; it is False when at least one of A, B is false.
Similarly, we can define the Boolean operator OR as follows:

A B A OR B
False False False
False True True
True False True
True True True

Note that A OR B is True when one (or both) of A, B is True; it is False only when both A and B are False.
The other common operator is NOT. This is different in that it takes only one operand; it is defined by:

A NOT A
False True
True False




In other words, NOT simply reverses the truth value of its operand.

COMPOUND EXPRESSION

The expressions:
A AND B
A OR B
NOT A
are called simple expressions, since each contains only the operator. We can also have compound expressions, consisting more than one operator. For example,
NOT (A AND B)
We can derive the truth table for this expression in stages. We first do A and B, then we apply NOT (with F representing False and T representing True):

A B A AND B NOT (A AND B)
F F F T
F T F T
T F F T
T T T F
1st step 2nd step

But consider:
A AND (NOT B)
Here we first apply NOT to B, then we apply AND to A and the result of (NOI B). This is illustrated as follows:

A B NOT B A AND (NOT B)
F F T F
F T F F
T F T T
T T F F

Note that we need to know the value of A AND (NOT B) for all possible combinations of its operands. There are two operands involved, so our table begins by listing the four possible combination of A and B.

Ex: Derive the truth table for the following Boolean expressions
1. NOT ( A OR B)
2. (NOT A) OR (NOT B)
3. (NOT A ) OR B
4. (NOT A ) AND (NOT B)
5. (NOT A) AND (A OR (NOT B))


TRUTH TABLE FROM DESCRIPTION

In the previous examples, a Boolean expression was given from which the truth table was derived. Sometimes, however, a truth table can be constructed from a description. Consider the following:

Derive a truth table with inputs A, B and C. The output W is True when at least two of the inputs are True and False otherwise.

In this case, we have no Boolean expression to use. However, after we have listed all possible combinations of A, B and C, we need only to count how many True values (N, say) we have on one line; if N is 2 or 3, then W is True; if N is 0 or 1, w is False.

A B C W
F F F F
F F T F
F T F F
F T T T
T F F F
T F T T
T T F T
T T T T

Ex: Derive truth tables for the following: inputs are A, B and C.
a) W is true if an even number of inputs is True, and False otherwise.
b) W is true if exactly one input is True, and False otherwise.
c) W is True if A and C are same, and False otherwise.


LOGIC GATES

We have already seen that every thing a computer can do must be converted into 0s and 1s.All information is represented inside the computer using strings of 0s and 1s. In particular, all arithmetic is done using the binary number system.

In order for a computer to do arithmetic as well as make logical comparisons, logic circuits are required. A logic circuit is made of individual unit called gates. These gates can be compared with the Boolean operators described in the previous section.

The most common gates are AND, OR and NOT. On circuit diagrams, the following symbols can be used to represent these gates; either of the two symbols shown below may be used.

Operator Symbol

AND

OR
NOT

A gate has one or more inputs and one or more outputs. We will use the following:
AND -two inputs and one output;
OR -two inputs and one output;
NOT –one input and one output.
The gates operate exactly the same as the Boolean operators. However, it is usual to speak of the inputs and outputs of the gates being 0 or 1, rather than True or False.

The AND gate

This gate consists of two inputs (A and B, say) and one output (out, say).

The following truth table describes the action of the AND gates:
A B out
0 0 0
0 1 0
1 0 0
1 1 1






Note that the table is exactly the same as for the Boolean Operator AND, with False replaced by 0 and True replaced by 1.

The OR gate

This has the same inputs and outputs as the AND gate.

The following truth table describes the action of the OR gates:
A B out
0 0 0
0 1 1
1 0 1
1 1 1






The truth table is exactly the same as for the Boolean operator OR, with False replaced by 0 and True replaced by 1.

The NOR gate

This has one input, A, and one output, out..

The following truth table describes the action of the NOT gates:

A out
0 1
1 0
The NOT gate is usually referred to as an inverter, since it ‘inverts’ its input (0 to 1, or 1 to 0).


LOGIC CORCUITS

A logic circuit consists of a number of gates joined together to produce a specified output (or outputs) form the given inputs.

For example, consider the following circuit:

It contains three inputs A, B and C. We can think of these as three wires which may or may not conduct a current. If a wire is conducting a current, we say the value of the input is 1; of not, the value is 0.

There are two intermediate outputs, W and X, the (final) output of the circuit is represented by Y. From the diagram we can see that:

W=A AND B
X=NOT C
Y=W OR X

We can therefore construct the truth table which species the behavior of the circuits; that is, what output is produced for a given combination of inputs. For example, what is Y when:
A= 0, B=0 and C=1?

The following truth table gives answer to such questions:

AND NOT OR

A B C W X Y
0
0
0
0
1
1
1
1 0
0
1
1
0
0
1
1 0
1
0
1
0
1
0
1 0
0
0
0
0
0
1
1 1
0
1
0
1
0
1
0 1
0
1
0
1
0
1
1

From the truth table, we see that when A=0, B=0 and C=1, the value of Y is 0.

No comments:

Post a Comment