0% found this document useful (0 votes)
35 views65 pages

Chapter 01

Uploaded by

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

Chapter 01

Uploaded by

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

Alfaisal University

College of Engineering
Electrical and Software Engineering Programs

EE 210/SE223
Digital Design

Chapter 1
Digital Systems and Binary Numbers
Outline
• Digital and analog systems
• Numerical representations
• Digital number systems
• Digital circuits/logic circuits
• Digital computers

Represent numbers in digital format,


convert between different bases and
represent signed numbers in both 1’s
and 2’s complement representation.

Outcome 1 2
Numerical Representations
• In science, technology, business and other
fields, we deal with quantities
• Quantities are measured, monitored,
recorded, manipulated arithmetically and
observed in most physical systems
• It is important when dealing with various
quantities that we can represent their values
efficiently and accurately

3
Analog Representations
• A quantity is represented by a voltage,
current, or meter movement that is
proportional to the value of that quantity
• Example 1: Analog multimeter
• Example 2: Glass thermometer

4
Digital Representations
• Quantities are represented not by movement
proportional to the quantities but by symbols
called digits.
• The quantity changes in discrete steps
• Example 1: Digital multimeter
• Example 2: Digital thermometer

5
Signal Examples Over Time

Time
Continuous in
Analog value & time

Digital Discrete in
value &
Asynchronous continuous in
time
Discrete in
Synchronous
value & time
6
Exercise

• Select the correct answer


– In digital multimeters, the voltage/current is
represented by a movement that is proportional
to the value of that quantity.
• True
• False

7
Why do we use Binary system?
• It is very difficult to design electronic equipment so
that it can work with ten different voltage levels
• On the other hand, it is very easy to design simple,
accurate electronic circuits that operate with only
two voltage levels
• In the binary system there are only two symbols or
possible digit values, 0 and 1
• Combinations of the two values, called codes, are
used to represent numbers, symbols, alphabetic
characters and other types of information

8
Binary Digits and Logic Levels
• The two digits in the binary system, 1 and 0,
are called bits
• A 1 is represented by the higher (usually)
voltage, which we will refer to as a HIGH
• A 0 is represented by the lower voltage level,
which we will refer to as a LOW

HIGH = 1 and LOW = 0

9
Logic Levels
• The voltages used to represent a 1 and a 0 are
called logic levels
• In a digital circuit, however, a HIGH can be any
voltage between a specified minimum value
and a specified maximum value
• Likewise, a LOW can be any voltage between a
specified minimum and a specified maximum

10
Typical Voltage Assignment in Digital
Systems

5V
Binary 1
2V 1 1
Not used 5V
0.8 V
Binary 0 0 0
0V 0V t
t1 t2 t3 t4 t5

Typical Voltage Assignments Typical Timing Diagram


(Digital waveform)
11
Analog Systems
• An analog system contains devices that
manipulate physical quantities that are
represented in analog form; the quantity
varies over a continuous range of values
• Examples:
– speaker, audio amplifiers, magnetic tape
recording and playback, simple light
dimmer switch

12
DIGITAL SYSTEMS
• Takes a set of discrete information inputs and
discrete internal information (system state) and
generates a set of discrete information outputs.

Discrete
Discrete information Discrete
Inputs processing Outputs
system

System State

13
Types of Digital Systems
• No state present
– Combinational Logic System
– Output = Function(Input)
• State present
– State updated at discrete times
=> Synchronous Sequential System
– State updated at any time
=>Asynchronous Sequential System
– State = Function (State, Input)
– Output = Function (State)
or Function (State, Input)

14
Digital System Example:
A Digital Counter (e. g., odometer):

Count Up
Reset 0 0 1 3 5 6 4

Inputs: Count Up, Reset


Outputs: Visual Display
Combinational/Sequential? Sequential
Synchronous or Asynchronous? Asynchronous
15
Digital Computers
• A Digital computer is a system of hardware that
performs arithmetic operations, manipulates data
(usually in binary form), and makes decisions
• For the most part, human beings can do whatever
computers can do, but the computers can do it
with much greater speed and accuracy!
• A computer must be given a complete set of
instructions that tell it exactly what to do at each
step of its operation. The set of instructions is
called a program
16
Digital Computer Example

Memory

Arithmetic &
Control Unit
CPU (CU)
Logic Unit
(ALU)

Inputs: keyboard, Outputs: LCD


mouse, wireless, Input/Output screen, wireless,
microphone speakers
Synchronous or Asynchronous?
Synchronous 17
Major Parts of a Computer
• Input unit: Through this unit a complete set of instructions and
data is fed into the computer system and into the memory
unit, to be stored until needed. Information typically enters
the input unit from a keyboard or a disk
• Memory unit: The memory stores the instructions and data
received from the input unit. It stores the results of arithmetic
operations received from the ALU. It also supplies information
to the output unit
• Control unit: This unit takes instructions from the memory unit
and interprets them. It then sends appropriate signals to all
the other units to cause the specific instruction to be executed
• Arithmetic/logic unit: All calculations and decisions are
performed in this unit, which can then send results to the
memory unit.
• Output unit: This unit takes data from the memory unit and
prints out, displays, or presents the information to the
operator
18
Exercise

• Answer with True/False


1. The input unit takes data from the memory unit
and presents it to the operator.
2. The output unit stores the results of arithmetic
operations received from the ALU.
3. The ALU sends appropriate signals to all the
other units to cause the specific instruction to
be executed.

19
Outline
• Base-b Number System
• Binary Number System
• Octal Number System
• Hexadecimal Number System
• Representing negative numbers
• Addition and multiplication

Represent numbers in digital format,


convert between different bases and
represent signed numbers in both 1’s
and 2’s complement representation.

20
Outcome 1
NUMBER SYSTEMS – Representation

• A number with radix r is represented by a


string of digits:
An - 1An - 2 … A1A0 . A- 1 A- 2 … A- m + 1 A- m
in which 0 ≤ Ai < r and . is the radix point.
• The string of digits represents the power
series:

(Number)10 = (å i=n-1
Ai r )+( å
i
j=-1

Aj r)
j

i=0 j=-m
(Integer Portion) + (Fraction Portion)
21
Number Systems – Examples
General Decimal Binary Octal
Radix (Base) r 10 2 8
Symbols 0 => r - 1 0 => 9 0 => 1 0 => 7
0 r0 1 20 = 1 1
1 r1 10 21 = 2 8
2 r2 100 22 = 4 64
3 r3 1000 23 = 8 512
Powers of 4 r4 10,000 24 = 16 4096
Radix 5 r5 100,000 25 = 32 32768
-1 r -1 0.1 2-1 = 0.5 0.125
-2 r -2 0.01 2-2 = 0.25 0.015625
-3 r -3 0.001 2-3 = 0.125 0.001953125
-4 r -4 0.0001 2-4 = 0.0625 1/(8)4
-5 r -5 0.00001 2-5 = 0.03125 1/(8)5 22
Decimal System
• In a decimal system (base-10), 10 symbols are used to
construct any number. The symbols are: 0, 1, 2, 3, 4, 5, 6,
7, 8, 9
• How do you read 1234.567?
– 1000 plus 200 plus 30 plus 4 plus 5 tenth plus 6 hundredth
plus 7 thousandth
– That is: 1´103 + 2´102 + 3´101 + 4´100 + 5 ´10-1
+ 6´10-2 + 7´10-3

1 2 3 4 . 5 6 7

MSB decimal LSB 23


point
Decimal counting
• When counting in the decimal system, we start with
0 in the units position and take each symbol in
progression until we reach 9
• We add one to the next higher position and start
over with zero in the first position (10). This process
continues until the count of 99 is reached
• Then, we add one to the third position and start over
with zeros in the first two positions (100)
• This same pattern is followed continuously as high as
we wish to count

24
Decimal counting

0 10 100 1000
1 11 101 1001
2 12 102 1002
3 13 103 1003
4 . . .
5 . . .
6 . . .
7 . . .
8 98 998 9998
9 99 999 9999

25
Binary system
• 1011.1012 = 1×23 + 0×22 + 1×21 + 1×20 +
1×2-1 + 0×2-2 + 1×2-3
= 8 + 0 + 2 + 1 + 0.5 + 0 + 0.125
= 11.62510

1 0 1 1 . 1 0 1

MSB Binary LSB


point
26
Binary counting
23 = 8 22 = 4 21 = 2 20 = 1
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1 0 10 100 1000
0 1 0 0 1 11 101 1001
0 1 0 1 110 1010
0 1 1 0 111 1011
0 1 1 1
1100
1 0 0 0
1 0 0 1
1101
1 0 1 0 1110
1 0 1 1 1111
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1 27
BASE CONVERSION - Positive Powers of 2
• Useful for Base Conversion

Exponent Value Exponent Value


0 1 11 2,048
1 2 12 4,096
2 4 13 8,192
3 8 14 16,384
4 16 15 32,768
5 32 16 65,536
6 64 17 131,072
7 128 18 262,144
8 256 19 524,288
9 512 20 1,048,576
10 1024 21 2,097,152
28
Special Powers of 2

§ 210 (1024) is Kilo, denoted "K"

§ 220 (1,048,576) is Mega, denoted "M"

§ 230 (1,073,741,824)is Giga, denoted "G"

§ 240 (1,099,511,627,776 ) is Tera, denoted “T"

29
Representing Binary Numbers
• 216 = 26 ´ 210 = 64 K

Exercise

– Represent the following numbers in Binary


Format:
• 256 K
•8M
•4G

30
Base-b to decimal (base-10)
• To convert from base-b to decimal, simply
multiply each digit by b raised to the power
corresponding to the position of the digit
• Ex: convert 310.234 to decimal

3×42 + 1× 41 + 0×40 + 2×4-1 + 3×4-2

= 48 + 4 + 0 + 2/4 + 3/16
= 52.6875
31
Converting from decimal to binary
• To convert a number from base-10 to base-2,
you successively divide the number by 2 and
keep track of the remainder
• Ex: convert 12 to binary.

Number Result of division by 2 remainder


12 12/2 = 6 0
6 6/2 = 3 0
3 3/2 = 1 1
1 1/2 = 0 1

The final result is 1 1 0 0


32
Base-10 to base-b
• For non-fractional part, repeatedly divide the
number by b and keep track of remainders
• For fractions, repeatedly multiply the fraction
by b and keep track of whole number values

33
Base-10 to base-b
• Ex: convert the decimal number 325.512 to base-
5
Number Result of division by 5 remainder
325 325/5 = 65 0
65 65/5 = 13 0
13 13/5 = 2 3
2 2/5 = 0 2

Fraction Fraction multiplied by 5 Whole number


0.512 0.512X5 = 2.56 2
0.56 0.56X5 = 2.8 2
0.8 0.8X5 = 4.0 4

The number is 2300.224 34


Octal number system
• The octal number system has a base of eight, that
means it has eight different digits, namely, 0, 1, 2,
3, 4, 5, 6, and 7
• To convert an octal number to decimal, simply
multiply each digit by the corresponding power of
eight
• Ex: 3728 = 3× (82) + 7× (81) + 2× (80)
= 3 × 64 + 7 × 8 + 2 × 1
= 25010

35
Octal numbers and binary numbers
• There is a simple way to convert a binary
number to octal (without converting to
decimal first).
• Starting from the binary point, group each
three binary digits into one octal digit
• Ex: convert 101110111.100010 to octal

5 6 7 . 4 2
copy
binary
point 36
Octal number to binary number
• To convert from octal to binary, simply
expand each octal digit into 3 binary digits
• Ex: convert 436.57 to binary

100 011 110 . 101 111


copy
octal
point

37
Hexadecimal numbers
• In a hexadecimal system there are 16 different
digits, namely, 0 to 9 and A, B, C, D, E, and F

Decimal Binary Hexadecimal


0 to 9 0000 to 1001 0 to 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F

38
Hexadecimal to decimal
• To convert from a hexadecimal number, simply
multiply each hex-digit by the corresponding power
of 16
• Ex: convert 1AB.CD to decimal
1AB.CD16 = 1× (162) + 10× (161) + 11× (160)
+ 12× (16-1) + 13× (16-2)
= 256 + 160 + 11 + 0.75 + 0.05078125
= 427.8007812510

39
Hexadecimal and binary numbers
• To convert a binary number to hexadecimal
number, simply group each four binary digits
into one hex-digit
• Ex: convert 110001101111.0101 to hex

C 6 F . 5
copy
binary
point
To convert a hex number to binary, perform
40
the opposite operation
Notes on converting octal and hex
• What do you do if the number of binary digits
is not a multiple of 3 in case of converting to
octal? Add extra zeros as needed to the end of
the sequence
• Ex: convert the binary number 1.1 to octal

Add extra zeros 001.100

1 . 4
41
Exercise

• Complete the following table:


Decimal Binary Octal Hexadecimal

11011011.101

3672.672

528.65

AB9.CD

42
Number of Elements Represented
• Given n digits in radix r, there are rn distinct
elements that can be represented.

• Examples:
– You can represent 4 elements in radix r = 2 with
n = 2 digits: (00, 01, 10, 11).

43
Exercise

How many elements you can represent with 8


digits in radix 5?

How many elements can you represent with 32


digits in radix 2?

44
Number of Bits Required
• Given M elements to be represented by a
binary code, the minimum number of bits, n,
needed, satisfies the following relationships:
2n ³ M > 2(n – 1)
n = log2 M where x , called the ceiling
function, is the integer greater than or equal
to x.

• Example:
– You need 5 digits to represent 25 elements in
radix 2

45
Exercise

How many bits are required to represent


decimal digits with a binary code?

How many bits are required to represent 2G in


radix 2?

46
Representing negative numbers
• There are three common ways to represent
negative numbers, they are:
– Sign magnitude
– 1’s complement
– 2’s complement
• Sign magnitude
– The sign and the magnitude are separate
– There is one sign bit, zero for positive and one for
negative
– The magnitude is usually represented by more than
one bit
47
Sign magnitude
• Assume 8 bits are used for the sign and the
magnitude
• Positive 8 is represented as: 00001000
• Negative 8 is represented as: 10001000
• The only difference between the negative and
the positive number is in the sign bit
• It is not clear how adding negative 8 to
positive 8 yields zero! It is much more
complicated than simply adding the bits

48
1’s complement
• To represent a negative number, each bit of the
corresponding positive number is inverted
• Ex: the 1’s complement representation for negative 8,
using 8 bits, can be found as follows:
00001000 positive 8

1111 0111 negative 8


• Given a number an-1an-2 …a1a0 in 1’s complement
representation, you can find its decimal value using the
equation:
-an-1× 2n-1+an-2 × 2n-2 …+a1× 21+a0 × 20 +1
• Ex: 11110111 in 1’s complement equals:
-1×27+1×26+1×25+1×24+0×23+1×22+1×21+1×20 + 1 = -8 49
2’s complement
• To represent a negative number, take the 1’s
complement of the positive value and add 1 to
the result
• Ex: The 2’s complement representation of
negative 8 is:
00001000 positive 8
111
11110111 1’s complement of 8
1+ add 1 to result
1111 1000
50
2’s complement
• To find the decimal value of a number an-1an-2
…a1a0 in 2’s complement, use the equation:
-an-1× 2n-1 + an-2×2n-2 …+a1×21+a0 × 20
• Ex: 11111000 in 2’s complement equals:
-1×27+1×26+1×25+1×24+1×23+0×22+0×21+ 0×20 =
-128 + 64 + 32 + 16 + 8 = -8
• You can also find the decimal value of a negative
2’s complement number by taking the 2’s
complement and using binary to decimal
conversion
51
Exercise

Complete the following table

Decimal Sign Magnitude 1st Complement 2s Complement


-1

-7

52
Addition in base-b
• The rules of addition remain the same for base-b
• Consider additions in base-2 (binary) and base-
16(hex)

011 01 1
1001 + A2CE
+
0011 B963
1 10 0 15C31

53
Exercise

Add the following numbers:

• 0101112 + 1010112

• 63758 + 14468

54
Four-bit Signed Binary Numbers

55
Signed 2's-complement Addition
• Add all n bits, including their sign bits
• Discard a carry out of the sign-bit
• Check for the overflow

00110 11010
+ 11011 + 11011

10110 01111
+ 10011 + 01011

56
Overflow
• It appears if the result of addition cannot be
represented by n bits
– i.e., if we start with two n-bit numbers and the
sum occupies n+1 bits, we say we have overflow
• It may happen if two +ve or two –ve numbers
are added
– If the sign of the result ≠ the sign of 2 inputs,
there is an overflow
• Consider the carry bits related to the sign bit:
– If carry in ≠ carry out, there is an overflow

57
Signed 2's-complement Subtraction
• Let X and Y be represented in signed 2’s
complement number system using n bits,
• X-Y=X+(-Y) can be obtained as
– Take the 2's complement of Y (including the sign
bit) to represent -Y
– add it to X (including the sign bit)
– A carry out of the sign-bit position is discarded.

58
Example
In the 6-bit signed 2’s complement number system,
Obtain
(a)-6-(-13)

(b) -7-(14)

59
Binary Codes
• Any discrete element of information can be
represented with a binary code (i.e., a pattern of 0's
and 1's)
• An n-bit binary code is a group of n bits that has up
to 2n distinct combinations of 1's and 0's
– Binary numbers from 0 to 2n-1 (00…0 to 11…1)
• Each element must be assigned a unique binary bit
combination,
• No two elements can have the same value

60
BCD (Binary Coded Decimal) Code

• Each decimal digit is coded by its 4-bit


binary # (From Mano & Ciletti)

• k-digit #à 4k bits in BCD


• (163)10=(?)2 =(?)BCD

61
BCD Addition
To obtain a BCD # with the addition of 2 BCD #s:
• add 2 digits using binary addition
• If the result is > 1001 add it to 0110

27 à 0010 0111
+34 à 0011 0100

62
Other Decimal Codes
• Many different codes can be generated
weighted codes self complemented codes

(From Mano & Ciletti) 63


Gray Code
• Only one bit changes
during any transition
between two numbers
• Used in position
encoders

64
ASCII Codes

65

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy