Ift211 Part2
Ift211 Part2
Faculty of Computing
Federal University of Lafia
CENTRE FOR CONTINUING EDUCATION AND PROFESSIONAL
DEVELOPMENT (CCEPD)
Sign-Magnitude form
In sign-magnitude form, the MSB is used for representing sign of the
number and the remaining bits represent the magnitude of the
number. So, just include sign bit at the left most side of unsigned binary
number. This representation is similar to the signed decimal numbers
representation.
Example
Consider the negative decimal number -108. The magnitude of this
number is 108. We know the unsigned binary representation of 108 is
1101100. It is having 7 bits. All these bits represent the magnitude.
Since the given number is negative, consider the sign bit as one, which is
placed on left most side of magnitude.
(−108)10 = (11101100)2
Example
Consider the negative decimal number -108. The magnitude of this
number is 108. We know the signed binary representation of 108 is 01101100.
It is having 8 bits. The MSB of this number is zero, which indicates
positive number. Complement of zero is one and vice-versa. So, replace
zeros by ones and ones by zeros in order to get the negative number.
(−108)10 = (10010011)2
Example
Consider the negative decimal number -108.
= 10010011 + 1
= 10010100
Therefore, the 2’s complement of (108)10 is (10010100)2.
(+7)10 = (00111)2
(+4)10 = (00100)2
The resultant sum contains 5 bits. So, there is no carry out from sign
bit. The sign bit ‘0’ indicates that the resultant sum is positive. So, the
magnitude of sum is 11 in decimal number system. Therefore, addition
of two positive numbers will give another positive number.
Example 2
Let us perform the addition of two decimal numbers -7 and -4 using 2’s
complement method.
The 2’s complement representation of -7 and -4 with 5 bits each are shown
below.
(−7)10 = (11001)2
(−4)10 = (11100)2
The resultant sum contains 6 bits. In this case, carry is obtained from sign
bit. So, we can remove it
Resultant sum after removing carry is (−7)10 + (−4)10 = (10101)2.
The sign bit ‘1’ indicates that the resultant sum is negative. So, by
taking 2’s complement of it we will get the magnitude of resultant sum
as -11 in decimal number system. Therefore, addition of two negative
numbers will give another negative number.
(+7)10 = (00111)2
(+4)10 = (11100)2
(+4)10 = (00100)2
(-7)10 = (11001)2
Binary Codes
Code is a system of rules to convert information- such as a letter, word,
sound, image, or gesture- into another form or representation,
sometimes shortened or secret, for use it to security reasons.
There are many types of codes: -
To illustrate the BCD code, take a decimal number such as 874. Each
digit is changed to its binary equivalent as follows:
BINARY LOGIC
This binary logic system is one of a class of mathematical systems
generally called Boolean algebras (after the English mathematician
George Boole, who in 1854 published a book introducing the
mathematical theory of logic).
• Binary logic deals with binary variables (i.e. can have two values, “0”
and “1”) Binary variables can undergo three basic logical operators
AND, OR and NOT:
– AND is denoted by a dot (·)
– OR is denoted by a plus (+).
– NOT is denoted by an overbar (¯), a single quote mark (') after
the variable.
❖ BASIC GATES
1) AND Gate: -
The AND operation is represented by a dot (.) or by the absence of an
operator.
E.g. A.B=F AB=F are all read as A AND B=F. the logical operation AND
is interpreted to mean that F=1 if A=1 and B=1 otherwise F=0
2) OR Gate: -
2) NOR Gate: -
The NOR-gate is an OR-gate with an inverter on the output. This
operation is
Boolean algebra is set of rules, used to simplify the given logic expression
without changing its functionality.
Boolean Postulates
Consider the binary numbers 0 and 1, Boolean variable (x) and its
complement
(x’). Either the Boolean variable or complement of it is known as literal.
The four possible logical OR and logical AND operations among these
literals and binary numbers are shown below.
These are the simple Boolean postulates. We can verify these postulates
easily, by substituting the Boolean variable with ‘0’ or ‘1’.
Note− The complement of complement of any Boolean variable is equal
to the variable itself. i.e., (x’)’=x.
Commutative Law
If any logical operation of two Boolean variables give the same result
irrespective of the order of those two variables, then that logical operation
is said to be Commutative. The logical OR & logical AND operations of
two Boolean variables x & y are shown below
x+y=y+x
x.y=y.x
Associative Law
If a logical operation of any two Boolean variables is performed first and
then the same operation is performed with the remaining variable gives
the same result, then that logical operation is said to be Associative. The
logical OR & logical AND operations of three Boolean variables x, y & z
are shown below.
x + (y + z) = (x + y) + z
x . (y . z) = (x . y). z
Distributive Law
If any logical operation can be distributed to all the terms present in the
Boolean function, then that logical operation is said to be Distributive.
The distribution of logical OR & logical AND operations of three Boolean
variables x, y & z are shown below.
x .(y + z)
=x.y+
x.zx+
(y.z) =
(x+y).(x+
z)
These are the Basic laws of Boolean algebra. We can verify these laws
easily, by substituting the Boolean variables with ‘0’ or ‘1’.
Duality Theorem
This theorem states that the dual of the Boolean function is obtained by
interchanging the logical AND operator with logical OR operator and
zeros with ones. For every Boolean function, there will be a
corresponding Dual function.
Let us make the Boolean equations (relations) that we discussed in the
section of Boolean postulates and basic laws into two groups. The
following table shows these two groups.
DeMorgan’s Theorem
This theorem is useful in finding the complement of Boolean
function. It states that the complement of logical OR of at least two
Boolean variables is equal to the logical AND of each complemented
variable.
DeMorgan’s theorem with 2 Boolean variables x and y can be represented
as
(x + y)’ = x’. y’
The dual of the above Boolean function is
(x . y)’ = x’ + y’
Therefore, the complement of logical AND of two Boolean variables is
equal to the logical OR of each complemented variable. Similarly, we can
apply DeMorgan’s theorem for more than 2 Boolean variables also.
Examples: - Find the complement and dual of the following functions.
Boolean Function
Boolean algebra is an algebra that deals with binary variables and logic
operations.
A Boolean function described by an algebraic expression consists of
binary variables, the constants 0 and 1, and the logic operation symbols.
For a given value of the binary variables, the function can be
equal to either 1 or 0. F(vars) = expression