0% found this document useful (0 votes)
29 views

Week 1

This document provides an introduction to digital logic design and binary number systems. It discusses how digital circuits work and how they can be designed. It defines key terms like digital, binary, and complement notation. The document explains how different number systems like binary, octal, hexadecimal, and decimal work. It covers converting between number bases and performing arithmetic operations in different bases. It also describes how complement notation is used to simplify subtraction in digital circuits.

Uploaded by

Saba Mushtaq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Week 1

This document provides an introduction to digital logic design and binary number systems. It discusses how digital circuits work and how they can be designed. It defines key terms like digital, binary, and complement notation. The document explains how different number systems like binary, octal, hexadecimal, and decimal work. It covers converting between number bases and performing arithmetic operations in different bases. It also describes how complement notation is used to simplify subtraction in digital circuits.

Uploaded by

Saba Mushtaq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 64

Digital Logic Design

1
TEXT
Digital Logic and Computer Design,
By M. Morris Mano, Prentice-Hall Inc.

2
Ground Rules
Cellular phones ‘OFF’ during class
No side talking during class

3
Week 1
Introduction
Number Systems
Conversions
Complements
Arithmetic Addition
Arithmetic Subtraction
Binary Codes
Binary Logic and Truth Tables

4
What is it about…
We will understand how digital circuits
work and how we can design them
DIGIT: from Latin ‘digitus’ = finger. ‘Any of
the Arabic numerals from 0-9’. ‘One of the
elements that combine to form numbers in
a system other then the decimal one’.

5
Why is it named ‘digital’?
Early computers were used mainly to
perform numeric computations
They used discrete elements of
information: digits
DIGITAL SYSTEMS: manipulate discrete
elements of information (finite sets)
E.g. the 10 decimal digits, the 26 letters of
the alphabet

6
Why Digital Circuits?
Digital devices are programmable – by
simply changing the program the same
hardware can be used for different
applications
Advances in digital integrated circuits
technology – accuracy, reliability
Digital systems are interconnections of
digital modules

7
Digital Systems
Digital Systems represent systems that
understand, represent and manipulate discrete
elements.
 A discrete element is any set that has a finite
number of elements, for example 10 decimal digits,
26 letters of the alphabet, etc.
Discrete elements are represented by signals,
such as electrical signals (voltages and currents)
The signals in most electronic digital systems
use two discrete values, termed binary.

8
Binary Digits
A binary digit, called
a bit, is represented
by one of two values:
0 or 1.
 Discrete elements can
be represented by
groups of bits called
binary codes. For
example the decimal
digits 0 to 9 are
represented:

9
Decimal Numbers
A decimal number such as 5723
represents a quantity equal to:
 5 thousands
 7 hundreds
 2 tens
 3 ones
Or, it can be written as: 5 X 103 + 7 X102 +
2 X 101 + 3 X 100

10
Decimal Numbers
In 5723, The 5, 7, 2, and 3 represent
coefficients.
The decimal number system is said to be
of base or radix 10 because it uses the 10
digits (0..9) and the coefficients are
multiplied by powers of 10.
 5 X 103 + 7 X102 + 2 X 101 + 3 X 100

11
Binary Numbers
The binary system contains only two
values in the allowed coefficients (0 and
1).
The binary system uses powers of 2 as
the multipliers for the coefficients.
For example, we can represent the binary
number 10111.01 as:
 1 X 24 + 0 X 2 3 + 1 X 2 2 + 1 X 21 + 1 X 2 0 + 0
X 2-1 + 1 X 2-2 = 23.25

12
Numbers in Base-r
In general, a number in base-r has
coefficients multiplied by powers of r.
 an . rn + an-1 . rn-1+ …. + a1 . r1+ a0 . r 0 + a-1 . r -1
+ a-2 . r-2 + … + a-m . r -m
Coefficients aj range from 0 to r - 1

13
Octal Numbers
The octal number system is a base-8
system that contains the coefficient values
of 0 to 7.
The octal system uses powers of 8 as the
multipliers for the coefficients.
For example, we can represent the octal
number 72032 as:
 7 X 84 + 2 X 8 3 + 0 X 8 2 + 3 X 81 + 2 X 80 =
(29722)10

14
Hexadecimal Numbers
The hexadecimal number system is a base-16
system that contains the coefficient values of 0
to 9 and A to F.
The letters A through F represent the coefficient
values of 10, 11, 12, 13, 14, and 15,
respectively.
The hexadecimal system uses powers of 16 as
the multipliers for the coefficients.
For example, we can represent the hexadecimal
number C34D as:

12 X 163 + 3 X 162 + 4 X 161 + 13 X 160 = (49997)10

15
Differing Bases
In order to represent numbers of different
bases, we surround a number in
parenthesis and then place a subscript
with the base of the number.
 A decimal number (9233)10
 A binary number (11011)2
 A base 5 number (3024)5

16
Base – r Arithmetic
Arithmetic operations with numbers in base r
follow the same rules as for decimal numbers.
When a base other than 10 is used, one must
remember to use only the r-allowable digits.

17
Arithmetic Rules
The sum of two digits are calculated as
expected but the digits of the sum can only
be from the r-allowable coefficients.
Any carry in a sum is passed to the next
significant digits to be summed.
In subtraction the rules are the same but a
borrow adds r (where r is the base) to the
minuend digit.

18
r – Decimal Conversion
Conversion of a number in base r to
decimal is done by expanding the number
in a power series and adding all the terms.
For example, (C34D)16 is converted to
decimal:
 12 X 163 + 3 X 162 + 4 X 161 + 13 X 160 =
(49997)10

19
Decimal – r Conversion of Integers
The conversion of a decimal integer into a
number in base-r is done by dividing the
number and all successive quotients by r
and accumulating the remainders.

20
Decimal – r Conversion Example
Converting decimal 35 to Binary

Result : (35)10 = (100011)2 21


Decimal - r Conversion of Fractions
When converting fractions, we must use
multiplication rather than division.
Integers are accumulated instead of
remainders.

22
Fraction Conversion Example
Converting Decimal
0.875 to binary

Result : (0.875)10 = (0.111)2


23
Decimal – r Conversion
Decimal numbers with both integer and
fractional parts are converted by
converting the integer and fractional parts
separately.
Example : converting decimal 35.875 to
binary.
 (35)10 = (100011)2
 (0.875)10 = (0.111)2
 So, (35.875)10 = (100011.111)2

24
Complements
Complements are used to simplify
subtraction operations.
There are two types:
 The radix complement, called the r’s
complement.
 The diminished radix complement, called
the (r-1)’s complement.

25
Diminished Radix Complement
(DRC)
Given a number N in base r having n digits, the
(r-1)’s complement of N is defined as:
 (rn – 1) – N
Decimal numbers are in base-10. (r-1) = (10-1) =
9.
The 9’s complement would be defined as:
 (10n – 1) – N
So, to determine the 9’s complement of 52:
 (102 – 1) – 52 = 47
Another example is to determine the 9’s
complement of 3124:
 (104 – 1) – 3124 = 6875
26
DRC for Binary Numbers
For binary numbers r = 2 and (r-1) = 1. So, the
1’s complement would be defined as:
 (2n – 1) – N
To determine the 1’s complement of 1000101:
 (27 – 1) – 1000101 = 0111010
To determine the 1’s complement of
11110111101:
 (211 – 1) - 11110111101 = 00001000010
Note that 1’s complement can be done by
switching all 0’s to 1’s and 1’s to 0’s.

27
Radix Complement
The r’s complement of an n-digit number N in
base-r is defined as:
 rn – N - for N ¹ 0
 0 - for N = 0
10’s complement of 3229 is:
 104 – 3229 = 6771
2’s complement of 101101 is:
 26 – 101101 = 010011
Note that to determine 2’s complement, leave the
least significant 0’s and the first 1 unchanged and
then switch the remaining 1’s to 0’ and 0’s to 1’s.
28
Notes on Complements
A couple of notes on complements to keep
in mind:
 If you are trying to determine the complement
of a value that contains a radix point:
Remove the radix point.
Determine the complement.
Replace the radix point in the same relative
position.
 The complement of a complement will restore
the original number.
29
Subtraction with Complements
In digital computers the use of borrows to complete
subtraction is inefficient. Complements are used to
overcome this inefficiency.
The subtraction of two n-digit unsigned numbers M– N
in base r can be done as follows:
 Add the minuend, M, to the r’s complement of the
subtrahend, N:
M + (rn – N) = M – N + rn
 If M≥ N, the sum will produce an end carry, rn, which can be
discarded; what is left is the result of M – N.
 If M < N, the sum does not produce an end carry and is
equal to rn – (N – M), which is the r’s complement of (N – M).
 To obtain the answer in a familiar form, take the r’s
30
complement of the sum and place a negative sign in front.
10’s Complement Subtraction
Using 10’s complement, subtract 62513 –
2140

Note that the extra 9 in the 10’s complement of


N is to fill the space holder 0.
31
10’s Complement Subtraction
Using 10’s complement, subtract 2140 - 62513

32
2’s Complement Subtraction
Using 2’s complement, subtract 1001001
-1000110

33
2’s Complement Subtraction\
Using 2’s complement, subtract 1000110
-1001001

34
Using 1’s Complement
You can also use the 1’s complement for
performing subtraction.
Remember that 1’s complement is 1 less
than 2’s complement. This means we must
compensate by adding 1 when an end
carry occurs.
Removing an end-carry and adding one is
called an end-around carry.

35
1’s Complement Subtraction
Using 1’s complement, subtract 1001001
-1000110

36
1’s Complement Subtraction
Using 1’s complement, subtract 1000110
-1001001

37
Signed Binary Numbers
It is necessary to have a way to represent
negative integers in computers. There are
two methods to do this:
 The signed magnitude convention uses the
left-most bit to represent the sign (0 for
positive and 1 for negative).
 The signed complement system negates a
number by taking its complement.

38
Number Representations
The following is the representation for +11:
 00001011
The following are different methods for
representing -11:
 Signed magnitude: 10001011
 Signed-1’s-complement: 11110100
 Signed-2’s-complement: 11110101

39
Signed Binary Numbers

40
Arithmetic Addition
The addition of two signed binary numbers
with negative numbers represented in
signed-2’s complement form is obtained
from addition of the two numbers,
including their sign bits.
A carry out of the sign-bit position is
discarded.
If the sum is negative, it will be in 2’s
complement form.

41
Example Arithmetic

42
Arithmetic Subtraction
Subtraction can be performed by simply
converting the equation into an addition
formula.
 Take the 2’s complement of the subtrahend
and add it to the minuend.
 A carry out of the sign bit position is
discarded.

43
Binary Codes
All symbols in a computer must be
represented by a binary code (binary
representation).
An n-bit binary code is a group of n bits
that can represent up to 2n distinct
combinations of 1’s and 0’s.
 Each distinct combination represents a single
symbol in the computer.

44
BCD Code
The most common
representation for binary
digits is the binary coded
decimal (BCD) form which
is a binary assignment of
the decimal numbers.
A number with k distinct
decimal digits will require
4k bits in BCD. Each digit
of a decimal value is
converted to its respective
binary representation.
45
Multi Digit BCD
Each decimal digit is represented by 4 bit BCD

46
BCD Addition
BCD only represents each of the decimal digitals 0
through 9 as a single 4-bit binary value.
When adding two BCD values, if the sum is equal
to or less than 1001 (9), the corresponding BCD
value is correct.
However, when the binary sum is greater or equal
to 1010 (10), the result is an invalid BCD value.
 To overcome the invalid BCD value add 0110 (6) to the
result to obtain the BCD representation and carry 1 to
the next digit

47
BCD Addition Examples

48
Multi Digit BCD Addition

49
ASCII Character Code
The American Standard Code for
Information Interchange (ASCII) uses
seven bits to code128 characters,
representing the alphabet, decimal
numbers, and various other symbols.
 The ASCII chart on the next slide allows you
to specify the characters in decimal
representation by concatenating the column
headings to the row headings.

50
ASCII Table

51
Binary Storage
Binary storage represents the storage
mechanisms for binary data stored in a
computer.
 A binary cell is a device that possesses two stable
states and it can store a single state value (0 or 1).
 A register is a group of binary cells. N cells allows the
register to store 2n possible states. The type of
information (BCD, ASCII, etc.) stored in a register has
to be agreed upon by the users of the register.

52
Register Transfer
A register transfer operation involves the
transfer of binary information from one set
of binary registers into other set of binary
registers.
May be directly from one register to
another, or may pass through data
processing circuits to perform an
operation.

53
Binary Information Processing
The actual processing of binary information
in a computer is completed by digital logic
circuits which have been implemented to
serve a specific purpose (e.g. addition).
 The registers are accessed (read and write)
when they are needed to complete an
operation.
 For example we need two register sets to store
two values to be added and a register set to
store the result of the sum.
Furthermore, we need three registers in both the
memory unit and in the processor.
54
Binary Logic
Binary logic consists of binary variables
and logical operations.
 The variables are designated by letters of the
alphabet (A, B, C, x, y, z, etc.).
 There are three basic logical operations: AND
OR NOT

55
Logical Operations
AND is represented by a dot or the absence of an
operator.
 x·y = z or xy = z
 Read as “x and y is equal to z”
 Means that z=1 if and only if x=1 and y=1
OR is represented by a plus sign.
 x+y = z
 Read as “x or y is equal to z”
 Means that z=1 if x=1 or y=1 or both x=1 and y=1
NOT is represented by a prime or an overbar.
 x’=z
 Read as not x is equal to z
 Means that if x=1 then z=0 and if x=1 then z=1
56
Truth Tables
Since each binary variable consists of value
of 0 or 1, each combination of values for the
variables involved in a binary operation has a
specific result value.
A truth table is a method of visualizing all
possible combinations of the input values
and the respective output values that occur
due to the operation on the specified
combination.
57
AND Truth Table

58
OR Truth Table

59
NOT Truth Table

60
Logic Gates
Logic gates are electronic circuits that
operate on one or more input signals to
produce an output signal.
 The state (high-low, on-off) of electricity on a
line represents each of the two states for
binary representation (1 or 0).

61
Logic Gate Notation

62
Binary Multiplication
For multiplication process three registers
A, B and C are used. Following
procedure is used for multiplication:
Store multiplicant in register C and multiplier
in register B. A is initially zero
 Test low order bit of C. if it is one add
contents of register A and B, storing result in
A
 Shift contents of register A and C one
position to the right

63
Binary Division
For division process three registers R, D
and Q are used. Following procedure is
used for division:
Put divisor in D, dividend in R and Q is initially
zero
 Shift left contents of R and Q and put 1 as
least significant bit
 Subtract contents of D from R and put answer
in R
 If subtraction is not possible, change least
significant bit of Q to zero.
64

You might also like