You are on page 1of 34

Digital Design

Maria Mahmood
MS Computer Science
Digital Systems

Introduction
Complex internal instructions with simple GUI
Embedded digital computers

Communication

Business
Transactions
Medical treatment

Traffic control

Weather monitoring
Spacecraft guidance

Internet
Digital Computer
• Cost effective
• Reliable
• Speedy
• Interconnection of digital
modules
• Information processing
Discrete Information
• Restricted to finite number of elements
• Represented by physical quantities called signals
• Signals are binary
• Discrete elements are represented as groups of bits
• Quantization
• Binary systems are most practical because they can be
implemented with electronic components
• Digital circuits process data by means of logic gates using
binary signals
• Combinational vs sequential digital circuits
• HDL (Hardware description language) is used to describe
and simulate functionality of digital circuits and their
logical function in textual form
• Chapter 1: Number systems
• Chapter 2: Boolean algebra
• Chapter 3: K-Map method
• Chapter 4: Combinational circuits
• Chapter 5: Sequential circuits
Lecture 2: Number System
Chapter No. 1 : 1.1, 1.2, 1.3, 1.4, 1.7

8
Digital Computer Systems
• Digital systems consider discrete amounts of data.
• Examples
• 26 letters in the alphabet
• 10 decimal digits
• Larger quantities can be built from discrete values:
• Words made of letters
• Numbers made of decimal digits (e.g. 239875.32)
• Easy to represent binary values electrically
• Voltages and currents.
• Can be implemented using circuits
• Create the building blocks of modern computers
9
Decimal
• Most people today use decimal representation to count. In the
decimal system there are 10 digits:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
• Example 1: Consider the number 1234. It can be represented as
1*10³+ 2*10² + 3*10¹ + 4*10º
• Where:
• 1 is in the thousand’s place
• 2 is in the hundred’s place
• 3 is in the ten’s place
• 4 is in the one’s place.
• Important note: any number in power of zero is 1, even zero in
power of zero is 1.
10
Decimal
• Example 2:
• Consider the number 1234.567. It is represented as

1*10³+ 2*10² + 3*10¹ + 4*10º+ 5*10-1+ 6*10-2+ 7*10-3

• Where:
• 5 is in the 1/10th place
• 6 is in the 1/100th place
• 7 is in the 1/1000th place

11
Binary
• The bit is the smallest piece of information that can be
stored in a computer.
• It can have one of two values 0 or 1. Think of a bit as a
switch that can be either on or off.

• For example:
• Consider the binary number 1101. It can be represented as
1*2³+ 1*2² +0*2¹ + 1*2º
• In decimal:
8 + 4 + 0 + 1 = 13

12
Binary

13
Binary Addition
• Binary addition is very simple.
• This is best shown in an example of adding two binary
numbers…

1 1 1 1 1 carries
1 1 1 1 0 1
+ 1 0 1 1 1
---------------------
1 0 1 0 1 0 0

14
Binary Multiplication
• Binary multiplication is much the same as decimal
multiplication, except that the multiplication operations
are much simpler…

1
0 1 1 1
X 1 0 1 0
-----------------------
1 1 1
0 0 0 0 0
1 0 1 1 1
0 0 0 0 0
1 0 1 1 1
-----------------------
1 1 1 0 0 1 1 0
15
The Growth of Binary Numbers

n 2n n 2n
0 20=1 8 28=256
1 21=2 9 29=512
2 22=4 10 210=1024
3 23=8 11 211=2048
4 24=16 12 212=4096
5 25=32 20 220=1M
6 26=64 30 230=1G

7 27=128 40 240=1T

16
Octal
• It can consist of 0,1,2,3,4,5,6,7.
(35237)8 = 3x84 + 5x83 + 2x82 + 3x81 +7x80
• What about fractions?
(35237.5)8 = 3x84 + 5x83 + 2x82 + 3x81 +7x80 +5x8-1

17
Understanding Hexadecimal Numbers
• Hexadecimal numbers are made of 16 digits:
• (0,1,2,3,4,5,6,7,8,9,A, B, C, D, E, F)
• How many items does a hex number represent?
• (3A9F)16 = 3x163 + 10x162 + 9x161 + 15x160 = 15,00710
• What about fractions?
• (2D3.5)16 = 2x162 + 13x161 + 3x160 + 5x16-1 = 723.312510
• Note that each hexadecimal digit can be represented with
four bits.
• (1110)2 = (E)16
• Groups of four bits are called a nibble.
• (1110)2
18
Putting It All Together

• Binary, octal, and


hexadecimal similar
• Easy to build circuits to
operate on these
representations
• Possible to convert
between the three formats

19
Convert an Integer from Decimal to another Base
• For each digit position:
• Divide decimal number by the base (e.g. 2)
• The remainder is the lowest-order digit
• Repeat first two steps until no divisor remains.
Example for (13)10:
Integer Remainder Coefficient
Quotient

13/2 = 6 + ½ a0 = 1
6/2 = 3 + 0 a1 = 0
3/2 = 1 + ½ a2 = 1
1/2 = 0 + ½ a3 = 1
Answer (13)10 = (a3 a2 a1 a0)2 = (1101)2

20
Convert a Fraction from Decimal to another Base
• For each digit position:
• Multiply decimal number by the base (e.g. 2)
• The integer is the highest-order digit
• Repeat first two steps until fraction becomes zero.

Example for (0.625)10:


Integer Fraction Coefficient

0.625 x 2 = 1 + 0.25 a -1 = 1
0.250 x 2 = 0 + 0.50 a-2 = 0
0.500 x 2 = 1 + 0 a-3 = 1

Answer (0.625)10 = (0.a-1 a-2 a-3 )2 = (0.101)2

21
22
Converting from Base 2 to Base 16

(0011 1010 1001 1111)2


3 A 9 F

• Conversion is easy!
• Divide the binary digits in groups of 4 digits
• Then convert each group to hexadecimal digits

23
24
Converting from Base 2 to Base 8

( 011 101 010 011 111)2


3 5 2 3 7

• Conversion is easy!
• Divide the binary digits in groups of 3 digits
• Then convert each group to octal digits

25
26
Converting from Base 16 and Base 2

3A9F16 = (0011 1010 1001 1111)2


3 A 9 F

• Conversion is easy!
• Determine 4-bit value for each hex digit
• Note that there are 24 = 16 different values of four
bits
• Easier to read and write in hexadecimal.
• Representations are equivalent!

27
28
Converting from Base 16 to Base 8

3A9F16 = (0011 1010 1001 1111)2


3 A 9 F

352378 = (011 101 010 011 111)2


3 5 2 3 7

• Convert from Base 16 to Base 2


• Regroup bits into groups of three starting from right
• Ignore leading zeros
• Each group of three bits forms an octal digit.

29
30
Converting from Base 8 to Base 2

3 5 2 3 7

352378 = (011 101 010 011 111)2

• Conversion is easy!
• Determine 3-bit value for each octal digit

31
32
Converting from Base 8 to Base 16

• Convert from Base 8 to Base 2


• Regroup bits into groups of four starting from right
• Each group of four bits forms a hexadecimal digit.

33
34

You might also like