Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 58

Number System

Number is a collection of digits.

N r  N b  d n 1d n  2 ......d 3 d 2 d1d 0 .d 1d  2 d 3 ......d  m


N- Number
b, r – Base or radix of a number
n – Number of digits
m – Number of digits in integer position

1
To convert the fractional binary number to
decimal, determine the weights if each bit that is
a 1 and then sum the weights to get the decimal
fraction.
Example: 0.1011
Weight: 2-1 2-2 2-3 2-4
Binary Number: 0. 1 0 1 1
= 2-1+2-3+2-4
= 0.5+0.125+0.0625 =
0.6875

2
To convert decimal fraction to binary, sum of
weights method can be used.
Example: 0.625 = 0.5+0.125 = 2-1+2-3
There is a 1 in 2-1 position, a 0 in 2-2 position and
a 1 in 2-3 position.
Thus (0.625)10 = (0.101)2
Repeated multiplication by 2 is another method:

3
Example: 0.625

.625 x 2 = 1.25(MSB)
.25 x 2 = 0.50
(.625)10 = (.101)2
.50 x 2 = 1.00

4
Example: 37.0625
(37)10 = (100101)2
(.0625)10 = (.0001)2

 (37.0625)10 = (100101.0001)2

5
Binary Arithmetic

1) Binary Addition
0+0=0
0+1=1
1+0=1
1 + 1 = 10 ------ 1 is carry

6
2) Binary Subtraction
0-0=0
1-1=0
1-0=1
10 - 1 = 1 0-1 with a borrow of 1

7
3) Binary Multiplication
0X0=0
0X1=0
1X0=0
1X1=1
4) Binary Division
Division is performed as decimal division.

8
1’s and 2’s complement
1’s complement of a binary number is found by
changing all the 1s to 0s and all the 0s to 1s.
Example: 10110010
1’s complement is 01001101
2’s complement is found by adding 1 to the LSB
of 1’s complement of a binary number.
Example: 10110010
1’s complement is 01001101
2’s complement is 01001110
9
Given a number N in base r having n digits,
(r-1)’s complement of N is defined as (r n-1)-N,
where n is the number of bits in a N.
9’s complement of a decimal number 546700 is
999999-546700 = 453299.
And 10’s complement is 4533300 (9’s
complement + 1)

10
Signed Numbers
• The left most bit in a signed binary number is the sign
bit, which tells whether the number is positive or
negative.
• A 0 is for positive and 1 is for negative.
• The magnitude bits are in true (uncomplemented)
binary for both positive and negative numbers.
Example: 00011001

Sign bit Magnitude bits


This is decimal number +25.
11
The decimal number -25 is expressed as 10011001.
The only difference between +25 and -25 is the sign bit
because the magnitude bits are in true binary for both
positive and negative numbers.
1’s complement form
Positive numbers in 1’s complement form are
represented in the same way as positive sign
magnitude numbers.
Negative numbers are the 1’s complement of the
corresponding positive numbers.
Example: -25 is expressed as the 1’s complement of
+25(00011001), which is 11100110. (Or don’t change
the sign bit and invert the magnitude bits)
12
2’s complement form:
Positive numbers are represented the same way as in
the sign magnitude and 1’s complement form.
Negative numbers are the 2’s complements of the
corresponding positive numbers
Thus, -25 in 2’s complement form is expressed as 2’s
complement of +25(00011001), which is 11100111.
(Or don’t change the sign bit and then take the 2’s
complement of the magnitude bits)

13
Arithmetic operations with signed numbers

1) Addition
(a) Both numbers (addend and augend) are positive:
The sum is positive and is in true (uncomplemented)
form.
Example: 00000111 7
+ 00000100 4
00001011 11

14
Overflow condition
When two numbers are added and the number of bits
required to represent the sum exceeds the number of
bits in the two numbers, and overflow results as
indicated by an incorrect sign bit.
An overflow can occur when both the numbers are
positive or both the numbers are negative.
Example: 01111101
+ 00111010
10110111

Sign incorrect
15
(b) Positive number with larger magnitude than negative
number:
The final carry bit is discarded. The sum is positive and
therefore in true binary form.
Example: 00001111 15
+ 11111010 + -6
100001001 9

Discard carry
Note: -6 is expressed as 2’s complement of signed +6.

16
(c) Negative number with magnitude larger than
positive number:
Example: 16-24
00010000 16
+ 11101000 +-24
11111000 -8
The sum is negative and therefore in 2’s complement
form. The final answer in decimal is the 2’s
complement of the answer with a negative sign.

17
(d) Both numbers negative:
The final carry bit is discarded. The sum is negative and
therefore in 2’s complement form.
Example:
11111011 -5
+ 11110111 +-9
111110010 -14

Discard carry

18
• Do the following
– 96-54
– 24-76
– -23-43
– 34+45
Subtraction

Subtraction operation changes the sign of


subtrahend and adds it to the minuend.
The sign of a positive or negative binary number
is changed by taking its 2’s complement.
To subtract two signed numbers, take the 2’s
complement of the subtrahend and add.
Discard any final carry bit.

20
Example:
00001000 – 00000011 i.e. 8-3
Which is 8+(-3) = 5
00001000 -------Minuend
+ 11111101 -------(2’s complement of subtrahend)
1 00000101

Discard carry

21
Boolean Constants and Variables

Boolean 0 and 1 do not represent actual


numbers but instead represent the state, or
logic level.
Logic 0 Logic 1
False True
Off On
Low High
No Yes
Open switch Closed switch

22
Three Basic Logic Operations
• OR
• AND
• NOT

23
Truth Tables
A truth table is a means for describing how a
logic circuit’s output depends on the logic
levels present at the circuit’s inputs.

Inputs Output
A B x
A
0 0 1
? x
0 1 0
B
1 0 1
1 1 0
24
OR Operation

• Boolean expression for the OR operation:


x =A + B
• The above expression is read as “x equals A
OR B”

25
OR gate
An OR gate is a gate that has two or more
inputs and whose output is equal to the OR
combination of the inputs.

26
Timing diagram

27
AND Operation

Boolean expression for the AND operation:


x=A B
The above expression is read as “x equals A
AND B”

28
AND Gate
An AND gate is a gate that has two or more
inputs and whose output is equal to the AND
product of the inputs.

29
Timing Diagram for AND Gate

30
NOT Operation
The NOT operation is an unary operation, taking only one input
variable.
Boolean expression for the NOT operation:
x=A
The above expression is read as “x equals the inverse of A”
Also known as inversion or complementation.
Can also be expressed as: A'

A
31
NOT Circuit
• Also known as inverter.
• Always take a single input
• Application:

32
Examples
Represent the following Boolean expressions
diagrammatically
1. x = A B + C
2. x = (A+B)C
3. x = (A'+B)
4. A'BC(A+D)'

33
x=AB+C

x = (A+B)C

34
x = (A'+B)

35
A'BC(A+D)'

36
Evaluating Logic-Circuit Outputs

• x = ABC(A+D)

• Determine the output x given A=0, B=1,


C=1, D=1.
• Can also determine output level from a
diagram

37
38
Implementing Circuits from Boolean
Expressions
• y = AC+BC’+A’BC
• x = AB+B’C

39
y = AC+BC’+A’BC

40
x = AB+B’C

41
NOR Gate
• Boolean expression for the NOR operation:
x=A+B

42
Timing diagram for NOR gate

43
NAND Gate

Boolean expression for the NAND operation:


x=AB

44
Timing diagram for NAND gate

45
Boolean Theorems (Single-Variable)

• x* 0 =0
• x*1=x
• x*x=x
• x*x’=0
• x+0=x
• x+1=1
• x+x=x
• x+x’=1

46
Boolean Theorems (Multivariable)
• x+y = y+x
• x*y = y*x
• x+(y+z) = (x+y)+z=x+y+z
• x(yz)=(xy)z=xyz
• x(y+z)=xy+xz
• (w+x)(y+z)=wy+xy+wz+xz
• x+xy=x
• x+x’y=x+y
• x’+xy=x’+y

47
DeMorgan’s Theorems

• (x+y)’=x’y’
• (xy)’=x’+y’
• Extension to N variables

48
49
50
Universality of NAND Gates

51
Universality of NOR Gates

52
Available ICs

53
Logic Symbol Interpretation
• When an input or output on a logic circuit
symbol has no bubble on it, that line is said to
be active-HIGH.
• Otherwise the line is said to be active-LOW.

54
55
56
Which Gate Representation to Use?

• If the circuit is being used to cause some


action when output goes to the 1 state, then use
active-HIGH representation.
• If the circuit is being used to cause some
action when output goes to the 0 state, then use
active-LOW representation.

57
58

You might also like