Class1 DEMP

Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

BITS Pilani

Pilani Campus

DS Rao
DEMP Lecture-1
Start the recording

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Number System

In any number system there is an ordered set of symbols known


as digits with rules defined for performing arithmetic operations
like addition, multiplication etc.,
A collection of there digits makes a number which in general
has two parts
*Integer & Fractional, set apart by a Radix point (.)
(N)b = dn-1 dn-2… di…. d1 d0 . d-1 d-2….. d-f ….d-m

Where: N = a number
B = base or radix of the number system
n = no.of digits in integer portion
m = no.of digits in fractional portion
dn-1 = Most Significant Digit (MSD)
d-m = Least Significant Digit(LSD)
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Number System
The digits in a number are placed side by side and each position in number is
assigned a weight or index of importance by some predesigned rule.
0 ≤ (di or d-f )≤ b-1

N = an-1bn-1+……+a0b0+….+a-mb-m 𝑁 = 𝑛−1
𝑖=−𝑚 𝑎𝑖 𝑏
𝑖

Characteristics of Commonly Used Number Systems

Number Base or Radix Symbols Used Weight Assigned to Position


System (di or d-f ) i -f
Binary 2 0,1 2i 2-f
Octal 8 0,1,2,3,4,5,6,7 8i 8-f
Decimal 10 0-9 10i 10-f
Hexadecimal 16 0-9, 16i 16-f
A,B,C,D,E,F

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
1.13 Do the following conversion problems:
(a) Convert decimal 27.315 to binary.
(b) Calculate the binary equivalent of 2/3 out to eight places.
Then convert from binary to decimal. How close is the result to 2/3?
(c) Convert the binary result in (b)into hexadecimal.
Then convert the result to decimal. Is the answer the same?

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


(a)Convert 27.315 to binary:

Integer Remainder Coefficient


Quotient
27/2 = 13 + ½ a0= 1
13/2 = 6 + ½ a1= 1
6/2 = 3+ 0 a2= 0
3/2 = 1+ ½ a3= 1
1/2 = 0+ ½ a4= 1

2710= 110112
Integer Fraction Coefficient
.315 x 2 = 0 + .630 a-1= 0
.630 x 2 = 1 + .26 a-2 = 1
.26 x 2 = 0 + .52 a-3 = 0
.52 x 2 = 1 + .04 a-4 = 1

.31510 = .01012

27.315 = 11011.01012

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Binary number system

1000 100 10 1
3 1 2 6

3 x 1000 +
1 x 100 +
2 x 10 +
6 x 1 = 3126

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Binary (base-2) Number System
In the decimal (base-10) number system:
Each new column is 10 times the previous
column value.
There are 10 numbers (0 – 9).

In the binary (base-2) number system:


Each new column is ? times the previous column value.
There are ? numbers (? - ?)

In the binary (base-2) number system:


Each new column is 2 times the previous
column value.
There are 2 numbers (0 – 1)
Known as “binary digits” or “bits”

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Binary Numbers and Binary Coding

Flexibility of representation

▪ With in constraints given below, can assign any binary


combination (called a code word) to any data as long
as data is uniquely encoded.

Information Types
▪ Numeric
– Must represent range of data needed
– Very desirable to represent data such that simple
straightforward computation for common arithmetic operations
permitted
– Tight relation to binary numbers
▪ Non-numeric
– Greater flexibility since arithmetic operations not applied.
– Not tied to binary numbers
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Conversion of Binary number to Gray Code:

A Binary number can be converted to its gray code


Step1: The first bit (MSB) of the gray code is the same as the first
bit of the binary number.

Step2: The second bit of the gray code equals the Exclusive-OR
of the first and second bit of the binary number i.e., it will be 1 if
these binary code bits are different and 0 if they are same.

Step3: The third gray code bit equals the Exclusive-OR of the
second and third bits of the binary number and so on.

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Conversion from Gray Code to Binary:

Conversion of a Gray Code into its Binary form involves the


following steps

Step1:The first binary bit (MSB) is the same as that of the first
Gray Code Bit

Step2: If the second gray bit is 0 the second binary bit is the same
as that of the first binary
If the second gray bit is 1 the second binary bit is the
reverse as that of its first binary

Step3: Step2 is repeated for each successive bit

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Gray Code

1 0 1 0

1 1 1 1

1 0 1 0

What special property does the Gray code


have in relation to adjacent decimal digits?
▪ Only one bit position changes with each increment
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Warning: Conversion or Coding?

Do NOT mix up conversion of a decimal number to a


binary number
That with coding of a decimal number with a
BINARY CODE.
1310 = 11012 (This is conversion)

13  0001|0011 (This is coding)

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Boolean algebra: George Boole

 Father of Boolean algebra


 He came up with a type of linguistic algebra, the
three most basic operations of which were (and
still are) AND, OR and NOT. It was these three
functions that formed the basis of his premise,
and were the only operations necessary to
perform comparisons or basic mathematical
functions.
 Boole’s system was based on a binary approach,
processing only two objects - the yes-no, true-
false, on-off, zero-one approach.
 Instead of usual Algebra of numbers , Boolean George Boole (1815 - 1864)
algebra is the algebra of truth values 0 and 1.
 In order to fully understand this, relation
between logic gates (AND,OR & NOT) to be
appreciated

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Axiomatic Definition of Boolean Algebra
We need to define algebra for binary values
▪ Developed by George Boole in 1854
Huntington postulates (1904) for Boolean algebra :
B = {0, 1} and two binary operations, (+) and (.)
▪ Closure with respect to operator (+) and operator (.)
 Closure: a set S is closed with respect to a binary operator if,
for every pair of elements of S, the binary operator specifies a
rule for obtaining a unique element of S.
 For example, natural numbers N={1,2,3,...} is closed w.r.t. the
binary operator + by the rule of arithmetic addition, since, for
any a, b ↋ N, there is a unique c ↋ N such that
a+b = c
 But operator – is not closed for N, because 2-3 = -1 and
2, 3 ↋ N, but (-1)N.

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Axiomatic Definition of Boolean Algebra
We need to define algebra for binary values
▪ Developed by George Boole in 1854
Huntington postulates (1904) for Boolean algebra :
B = {0, 1} and two binary operations, (+) and (.)
▪ Closure with respect to operator (+) and operator (.)
▪ Identity element 0 for operator (+) and 1 for operator (.)
 Identity element: a set S is said to have an identity element with
respect to a binary operation * on S if there exists an element e 𝝐 S
with the property that
 e * x = x * e = x for every x𝝐S
 0+x = x+0 =x for every x𝝐I I = {…, -2, -1, 0, 1, 2, …}.
 1×x = x×1 =x for every x𝝐I I = {…, -2, -1, 0, 1, 2, …}.

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Axiomatic Definition of Boolean Algebra
We need to define algebra for binary values
▪ Developed by George Boole in 1854
Huntington postulates (1904) for Boolean algebra :
B = {0, 1} and two binary operations, (+) and (.)
▪ Closure with respect to operator (+) and operator (.)
▪ Identity element 0 for operator (+) and 1 for operator (.)
▪ Commutativity with respect to (+) and (.)
x+y = y+x, x·y = y·x
▪ Distributivity of (.) over (+), and (+) over (.)
x·(y+z) = (x·y)+(x·z) and x+(y·z) = (x+y)·(x+z)
- Complement for every element x is x’ with x+x’=1, x·x’=0
▪ There are at least two elements x,yB such that x y

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Boolean Algebra

Terminology:
▪Literal: A variable or its complement :
▪Eg x or x’
▪Product term: literals connected by (·)
▪ a.b.c
▪Sum term: literals connected by (+)
▪(a+b+c)

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Postulates of Two-Valued Boolean Algebra
B = {0, 1} and two binary operations, (+) and (.)
The rules of operations: AND、OR and NOT.
AND OR NOT
x y x.y
x y x+y x X’
0 0 0
0 0 0 0 1
0 1 0
0 1 1 1 0
1 0 0
1 0 1
1 1 1
1 1 1

1. Closure (+ and‧)
2. The identity elements
(1) + = 0
(2) · = 1
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Postulates of Two-Valued Boolean Algebra

3. The commutative laws x+y = y+x, x.y = y.x


4. The distributive laws
x·(y+z) = (x·y)+(x·z) and x+(y·z) = (x+y)·(x+z)

x y z y+z x.(y+z) x.y x.z (x.y)+(x.z)


0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0
0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 0
1 0 0 0 0 0 0 0
1 0 1 1 1 0 1 1
1 1 0 1 1 1 0 1
1 1 1 1 1 1 1 1

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Postulates of Two-Valued Boolean Algebra

5. Complement
▪ x+x'=1 → 0+0'=0+1=1; 1+1'=1+0=1
▪ x.x'=0 → 0.0'=0.1=0; 1.1'=1.0=0
6. Has two distinct elements 1 and 0, with 0 ≠ 1

Note
▪ A set of two elements
▪ (+) : OR operation; (·) : AND operation
▪ A complement operator: NOT operation
▪ Binary logic is a two-valued Boolean algebra

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Basic Theorems And Properties Of Boolean Algebra
Duality

 The principle of duality is an important concept. This says that


if an expression is valid in Boolean algebra, the dual of that
expression is also valid.
 To form the dual of an expression, replace all (+) operators with
(·) operators, all (·) operators with (+) operators, all ones with
zeros, and all zeros with ones.
 Following the replacement rules…
a(b + c) = ab + ac
 Form the dual of the expression
a + (bc) = (a + b)(a + c)
 Take care not to alter the location of the parentheses if they are
present.

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Basic Theorems

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Boolean Theorems
Huntington’s postulates define some rules
Post. 1:
closure
Post. 2:
(a) x+0=x, (b) x·1=x
Post. 3:
(a) x+y=y+x, (b) x·y=y·x
Post. 4:
(a) x(y+z) = xy+xz,
(b) x+yz = (x+y)(x+z)
Need more rules to modify Post. 5: (a) x+x’=1, (b) x·x’=0
algebraic expressions
▪ Theorems that are derived from postulates
What is a theorem?
▪ A formula or statement that is derived from postulates (or
other proven theorems)
Basic theorems of Boolean algebra
▪ Theorem 1 (a): x + x = x (b): x · x = x
▪ Looks straightforward, but needs to be proven !
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Proof of x+x=x
We can only use Huntington postulates:
Huntington postulates:
Post. 2: (a) x+0=x, (b) x·1=x
Post. 3: (a) x+y=y+x, (b) x·y=y·x
Post. 4: (a) x(y+z) = xy+xz,
(b) x+yz = (x+y)(x+z)
Post. 5: (a) x+x’=1, (b) x·x’=0
Show that x+x=x. 1(a)
x+x = (x+x)·1 by 2(b)
= (x+x)(x+x’) by 5(a)
= x+xx’ by 4(b)
= x+0 by 5(b)
=x by 2(a)
Q.E.D.
We can now use Theorem 1(a) in future proofs

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Proof of x·x=x
Huntington postulates:
Similar to previous
proof Post. 2: (a) x+0=x, (b) x·1=x
Post. 3: (a) x+y=y+x, (b) x·y=y·x
Post. 4: (a) x(y+z) = xy+xz,
(b) x+yz = (x+y)(x+z)
Post. 5: (a) x+x’=1, (b) x·x’=0
Th. 1: (a) x+x=x

Show that x·x = x.


x·x = xx+0 by 2(a)
= xx+xx’ by 5(b)
= x(x+x’) by 4(a)
= x·1 by 5(a)
=x by 2(b)
Q.E.D.

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Proof of x+1=1

Theorem 2(a): x + 1 = 1 Huntington postulates:


x + 1 = 1.(x + 1) by 2(b)
Post. 2: (a) x+0=x, (b) x·1=x
=(x + x')(x + 1) 5(a)
Post. 3: (a) x+y=y+x, (b) x·y=y·x
= (x + x' )1 4(b) Post. 4: (a) x(y+z) = xy+xz,
= x + x' 2(b) (b) x+yz = (x+y)(x+z)
Post. 5: (a) x+x’=1, (b) x·x’=0
=1 5(a)
Th. 1: (a) x+x=x

Theorem 2(b): x.0 = 0 by duality


Theorem 3: (x')' = x
▪ Postulate 5 defines the complement of x, x + x' = 1 and x x' = 0
▪ The complement of x' is x is also (x')'

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Absorption Property (Covering)
Theorem 6(a): x + xy = x
Huntington postulates:
x + xy = x.1 + xy by 2(b)
= x (1 + y) 4(a)
= x (y + 1) 3(a) Post. 2: (a) x+0=x, (b) x·1=x
Post. 3: (a) x+y=y+x, (b) x·y=y·x
= x.1 Th 2(a)
=x 2(b) Post. 4: (a) x(y+z) = xy+xz,
(b) x+yz = (x+y)(x+z)
Post. 5: (a) x+x’=1, (b) x·x’=0
Th. 2: (a) x+1=1
Theorem 6(b): x (x + y) = x by duality
By means of truth table (another way to proof )

x y xy x+xy
0 0 0 0
0 1 0 0
1 0 0 1
1 1 1 1

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


DeMorgan’s Theorem
The complement of the union of two sets is equal to the
intersection of their complements and the complement of
the intersection of two sets is equal to the union of their
complements. These are called De Morgan's laws.
Theorem 5(a): (x + y)’ = x’y’
Theorem 5(b): (xy)’ = x’ + y’
By means of truth table

x y x’ y’ x+y (x+y)’ x’y’ xy x’+y' (xy)’

0 0 1 1 0 1 1 0 1 1
0 1 1 0 1 0 0 0 1 1
1 0 0 1 1 0 0 0 1 1
1 1 0 0 1 0 0 1 0 0

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Evaluating Logic Circuit Outputs

•Rules for evaluating a Boolean expression:


▪ Perform all inversions of single terms.
▪ Perform all operations within parenthesis.
▪ Perform AND operation before an OR operation
unless parenthesis indicate otherwise.
▪ If an expression has a bar over it, perform
operations inside the expression, and then invert
the result.

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Evaluating Logic Circuit
Outputs
 The first step after listing all input combinations is to
create a column in the truth table for each intermediate
signal (node).

Node u has been filled as the complement of A


BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Evaluating Logic Circuit
Outputs
 The next step is to fill in the values for column v.

v =AB — Node v should be HIGH


when A (node u) is HIGH AND B is HIGH
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Evaluating Logic Circuit
Outputs
 The third step is to predict the values at node w which is
the logical product of BC.

This column is HIGH whenever B is HIGH AND C is HIGH

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Evaluating Logic Circuit
Outputs
 The final step is to logically combine columns v and w to
predict the output x.

Since x = v + w, the x output will be HIGH when v OR w is HIGH

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


HOME WORK

37
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Stop recording and then only end the class

Thanks

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

You might also like