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

1. Digital Systems and Binary Numbers

The document provides an introduction to digital systems and binary numbers, emphasizing the importance of digital design in various applications such as computers, cameras, and calculators. It explains the representation of binary numbers, arithmetic operations, number-base conversions, and the concept of complements in binary arithmetic. Additionally, it covers signed binary numbers and their representation in digital systems.

Uploaded by

ziad.ahmed1204
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)
26 views

1. Digital Systems and Binary Numbers

The document provides an introduction to digital systems and binary numbers, emphasizing the importance of digital design in various applications such as computers, cameras, and calculators. It explains the representation of binary numbers, arithmetic operations, number-base conversions, and the concept of complements in binary arithmetic. Additionally, it covers signed binary numbers and their representation in digital systems.

Uploaded by

ziad.ahmed1204
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/ 52

CHAPTER-1

Digital Systems and


Binary Numbers
Digital Design (with an introduction to the Verilog HDL) 6th Edition,
M. Morris Mano, Michael D. Ciletti

• Dr. Kalpana Settu


Assistant Professor
ECE, IIITDM Kancheepuram
Digital Systems
Digital age or information age
Digital computers
• general purposes
• many scientific, industrial and commercial
applications
Digital systems
• telephone switching exchanges
• digital camera
• electronic calculators
• digital TV

2
Signal
 An information variable represented by physical quantity
 For digital systems, the variable takes on discrete values
• Two level, or binary values are the most prevalent values
 Binary values are represented abstractly by:
• digits 0 and 1
• words (symbols) False (F) and True (T)
• words (symbols) Low (L) and High (H)
• and words On and Off.
 Binary values are represented by values or ranges of values
of physical quantities

3
Binary Numbers
• Decimal number (base or radix: 10) Coefficients (0, 1, 2,..9)

… a5a4a3a2a1a0.a1a2a3… aj
Decimal point
Place value
  105 a5  104 a4  103 a3  102 a2  101 a1  100 a0  101 a1  102 a2  103 a3  

Example:
7,329  7  103  3  102  2  101  9  100

• General form of base-r system


an  r n  an 1  r n 1    a2  r 2  a1  r1  a0  a1  r 1  a2  r 2    a m  r  m
Coefficient: aj = 0 to r  1

4
Binary Numbers
Name Radix Digits
Binary 2 0,1
Octal 8 0,1,2,3,4,5,6,7
Decimal 10 0,1,2,3,4,5,6,7,8,9
Hexadecimal 16 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

 The six letters (in addition to the 10 integers) in


hexadecimal represent: 10, 11, 12, 13, 14, and 15,
respectively.

5
Binary Numbers
Example: Base-2 number (Binary)
(11010.11) 2  (26.75)10
 1  24  1  23  0  22  1  21  0  20  1  2 1  1  2 2
Example: Base-5 number (Quinary)
(4021.2)5
 4  53  0  52  2  51  1  50  2  51  (511.5)10
Example: Base-8 number (Octal)
(127.4)8
 1  83  2  82  1  81  7  80  4  81  (87.5)10

Example: Base-16 number (Hexadecimal)


(B65 F)16  11  163  6  162  5  161  15  160  (46,687)10
The letters A, B, C, D, E, and F are used for the digits 10, 11, 12, 13, 14, and 15
6
Binary Numbers
Convert (110101)2 to decimal
(110101) 2  32  16  4  1  (53)10

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"

7
Binary Numbers

8
Binary Arithmetic
Arithmetic operations with numbers in base r follow the same rules as decimal numbers.
 Addition
Rules of Binary Addition
Augend: 101101 0 + 0 = 0
Addend: +100111 0 + 1 = 1
1 + 0 = 1
Sum: 1010100 1 + 1 = 0, and carry 1 to the next higher significant bit

 Subtraction 2
02 Rules of Binary Subtraction
Minuend: 101101 0 - 0 = 0
Subtrahend: 100111 0 - 1 = 1, and borrow from the next higher significant bit
1 - 0 = 1 (borrow in a given significant position adds 2
Difference: 000110 1 - 1 = 0 to a minuend digit)

9
Binary Arithmetic

• Practice

10
Binary Arithmetic

 Multiplication
Multiplicand: 1011 Rules of Binary Multiplication
Multiplier:  101 0 x 0 = 0
0 x 1 = 0
1011 1 x 0 = 0
0000 1 x 1 = 1, and no carry or borrow bits
1011
Product: 110111

11
Number-Base Conversions
Example1.1
Convert decimal 41 to binary. The process is continued until the integer quotient
becomes 0.

12
Number-Base Conversions
 The arithmetic process can be manipulated more conveniently as follows:

Conversion from decimal integers to any base r system is similar to this example,
except that division is done by r instead of 2.

13
Number-Base Conversions
Example 1.2
Convert decimal 153 to octal. The required base r is 8.

The conversion of a decimal fraction to binary is accomplished by a method similar to that used for
integers. However, multiplication is used instead of division, and integers instead of remainders are
accumulated.

14
Number-Base Conversions
Example1.3 Convert (0.6875)10 to binary.
The process is continued until the fraction becomes 0 or until the number of digits has
sufficient accuracy.

 To convert a decimal fraction to a number expressed in base r, a similar procedure is used.


However, multiplication is by r instead of 2, and the coefficients found from the integers may
range in value from 0 to r  1 instead of 0 and 1.

15
Number-Base Conversions
Example1.4
Convert (0.513)10 to octal.

 From Examples 1.1 and 1.3: (41.6875)10 = (101001.1011)2


 From Examples 1.2 and 1.4: (153.513)10 = (231.406517)8

16
Number-Base Conversions

17
Number-Base Conversions
 Conversion from binary to octal can be done by positioning the binary
number into groups of three digits each, starting from the binary point and
proceeding to the left and to the right.

(10 110 001 101 011 . 111 100 000 110) 2 = (26153.7406)8
2 6 1 5 3 7 4 0 6
 Conversion from binary to hexadecimal is similar, except that the binary
number is divided into groups of four digits:

 Conversion from octal or hexadecimal to binary is done by reversing the


preceding procedure.

18
Number-Base Conversions

• Convert octal 673.124 to hex


Convert every octal digit to 3 binary digits, then convert every 4
binary digits to 1 hex digit:
(673.124)8
= 6 7 3.1 2 4
= 110 111 011.001 010 1
= 1 1011 1011.0010 101
= 1 B B.2 A
= (1BB.2A)16

19
Complements of Numbers
 Complements are used in digital computers to simplify the subtraction
operation and for logical manipulation.

 There are two types of complements for each base r system:


1. Radix complement  r’s complement
2. Diminished radix complement  (r - 1)’s complement

 For binary numbers (r=2):


Radix complement  2’s complement
Diminished radix complement  1’s complement

 For decimal numbers (r=10):


Radix complement  10’s complement
Diminished radix complement  9’s complement

20
Complements of Numbers
■ Diminished Radix Complement  (r - 1)’s complement
Given a number N in base r having n digits, the (r - 1)’s complement of N, i.e., its
•" diminished radix complement, is defined as (rn - 1) - N.
Example:
 For decimal numbers, r = 10 and r – 1 = 9, 9's complement of N is (10n  1) – N.
(106  1) – 546700 = (1000000  1) – 546700 = 999999 – 546700

 For binary numbers, r = 2 and r – 1 = 1, so the 1's complement of N is (2n  1) – N.


2n is represented by a binary number that consists of a 1 followed by n 0’s. is
represented by a binary number that consists of a 1 followed by n 0’s.
(27  1) – 1011000 = ((10000000)2  1) – 1011000 = 1111111 – 1011000
1’s complement of a binary number
is formed by changing 1’s to 0’s and
0’s to 1’s

21
Complements of Numbers
■ Radix Complement  r ’s complement
The r's complement of an n-digit number N in base r is defined as rn – N for N ≠ 0
and as 0 for N = 0. Comparing with the (r  1) 's complement, we note that the r's
complement is obtained by adding 1 to the (r  1) 's complement, since rn – N =
[(rn  1) – N] + 1.

r ’s complement = (r 1)’s complement  1

Example: Base-10
“leaving all least significant 0’s unchanged,
The 10's complement of 012398 is 987602 subtracting the first nonzero least significant digit
The 10's complement of 246700 is 753300 from 10, and subtracting all higher significant digits
from 9”
Example: Base-2
“leaving all least significant 0’s and the first 1
The 2's complement of 1101100 is 0010100
unchanged and replacing 1’s with 0’s and 0’s with
The 2's complement of 0110111 is 1001001
1’s in all other higher significant digits”

22
Subtraction with Complements

■ Subtraction with Complements


The subtraction of two n-digit unsigned numbers M – N in base r can be done as
follows:

23
Subtraction with Complements
Example 1.5: Using 10's complement, subtract 72532 – 3250. M N

10’s complement of 03250 (N)

Example 1.6: Using 10's complement, subtract 3250 – 72532 M N

There is no end carry.

Therefore, the answer is – (10's complement of 30718) =  69282.

24
Subtraction with Complements
Example 1.7
Given the two binary numbers X = 1010100 and Y = 1000011, perform the subtraction
(a) X – Y and (b) Y  X by using 2's complement.

There is no end carry.


Therefore, the answer is
Y – X =  (2's
complement of 1101111)
=  0010001.

25
Subtraction with Complements
 Subtraction of unsigned numbers can also be done by means of the (r  1)'s
complement. Remember that the (r  1) 's complement is one less then the r's
complement.
Example 1.8 Repeat Example 1.7, but this time using 1's complement.

Removing the end carry and adding 1 to


the sum is referred to as an end‐around
carry.

There is no end carry,


Therefore, the answer is
Y – X =  (1's
complement of 1101110)
=  0010001.

26
Signed Binary Numbers
 In ordinary arithmetic, a negative number is indicated by a minus sign and a
positive number by a plus sign. Because of hardware limitations, computers must
represent everything with binary digits.
 It is customary to represent the sign with a bit placed in the leftmost position of
the number.
 The convention is to make the sign bit 0 for positive and 1 for negative.
Positive number representation
signed-magnitude representation:

0 0 0 0 1 0 0 1 +9
Sign bit Magnitude bits
Sign bit
Negative number representation

9

27
Signed Binary Numbers
 In signed magnitude, 9 is obtained from +9 by changing only the sign bit in the
leftmost position from 0 to 1.
 In signed 1’s-complement, 9 is obtained by complementing all the bits of +9,
including the sign bit.
 The signed 2’s complement representation of 9 is obtained by taking the 2’s
complement of the positive number, including the sign bit.
signed-magnitude representation:

0 0 0 0 1 0 0 1 +9

Sign bit Magnitude bits


Sign bit
Negative number representation

9

28
29
Signed Binary Numbers Arithmetic
■ Addition
 The addition of two signed binary numbers with negative numbers
represented in signed-2's-complement form is obtained from the addition of
the two numbers, including their sign bits.
 A carry out of the sign-bit position is discarded.
 The result is in signed form.
Example:

Note that negative numbers must


be initially in 2’s-complement form
and that if the sum obtained after
the addition is negative, it is in
2’s-complement form. For example,
-7 is represented as 11111001,
which is the 2s complement of +7.
1
Discard carry

30
Signed Binary Numbers Arithmetic
■ Subtraction
 Take the 2’s complement of the subtrahend (including the sign bit) and add it
to the minuend (including the sign bit).
(  A)  (  B)  (  A)  (  B)
 A carry out of the sign bit position is discarded.
(  A)  (  B )  (  A)  (  B)
Example:

Take the 2’s complement of the negative number and add:

31
Binary-Coded Decimal (BCD) code
 We naturally live in a base 10 environment
 Computer exist in a base 2 environment
 So give the computer/digital system the task of doing the
conversions for us.

 The binary-coded decimal (BCD) is an encoding for decimal


numbers in which each digit is represented by its own binary
sequence.

32
Binary-Coded Decimal (BCD) code
 A number with k decimal digits will
require 4k bits in BCD.
 Decimal 396 is represented in BCD
with 12 bits as 0011 1001 0110, with
each group of 4 bits representing one
decimal digit.
 A decimal number in BCD is the same
as its equivalent binary number only
when the number is between 0 and 9.
 A BCD number greater than 10 looks
different from its equivalent binary
number, even though both contain 1's
and 0's. Moreover, the binary
combinations 1010 through 1111 are not
used and have no meaning in BCD.

33
Binary-Coded Decimal (BCD) code

 The BCD value has 12 bits to encode the characters of the decimal value, but
the equivalent binary number needs only 8 bits.
representation of a BCD number needs more bits than its equivalent binary
value

 However, there is an advantage in the use of decimal numbers, because


computer input and output data are generated by people who use the
decimal system.

 BCD numbers are decimal numbers and not binary numbers, although they
use bits in their representation.

34
Binary-Coded Decimal (BCD) code
■ BCD Addition
 When the binary sum is equal to or less than 1001 (without a carry), the
corresponding BCD digit is correct.
 However, when the binary sum is greater than or equal to 1010, the result is
an invalid BCD digit.
 The addition of 6 = (0110)2 to the binary sum converts it to the correct digit
and also produces a carry as required.
 This is because a carry in the most significant bit position of the binary sum
and a decimal carry differ by 16 - 10 = 6.

35
Binary-Coded Decimal (BCD) code
■ BCD Addition
Example:
Consider the addition of 184 + 576 = 760 in BCD:

The first, least significant pair of BCD digits produces a BCD digit sum of 0000 and a carry for
the next pair of digits. The second pair of BCD digits plus a previous carry produces a digit
sum of 0110 and a carry for the next pair of digits. The third pair of digits plus a carry
produces a binary sum of 0111 and does not require a correction.

36
Binary-Coded Decimal (BCD) code
■ Decimal Arithmetic

plus  0  0000
minus  9  1001

Addition is done by summing all digits, including the sign digit,


and discarding the end carry. This operation assumes that all
negative numbers are in 10’s-complement form.
Consider the addition (+375) + (-240) = +135, done in the
signed-complement system:

9760 is the 10’s complement of 0240

37
Other Decimal Codes
In a weighted code, each bit position is
assigned a weighting factor in such a way that
each digit can be evaluated by adding the
weights of all the 1’s in the coded
combination.
 BCD and the 2421 code are examples of
weighted codes.
 The 2421 and the excess‐3 codes are
examples of self‐complementing codes.
(9’s complement of a decimal number is
obtained directly by changing 1’s to 0’s and
0’s to 1’s)
 Excess‐3 is an unweighted code in which
each coded combination is obtained from
the corresponding binary value plus 3.
 The 8, 4, -2, -1 code is an example of
assigning both positive and negative
weights to a decimal code.

38
Gray Code

 Gray code is an unweighted


code
 The advantage of the Gray code
over the straight binary number
sequence is that only one bit in
the code group changes in going
from one number to the next.
 The Gray code is used in
applications in which the normal
sequence of binary numbers
generated by the hardware may
produce an error or ambiguity
during the transition from one
number to the next.

39
ASCII Character Code

 The standard binary code for the


alphanumeric characters is the
American Standard Code for
Information Interchange (ASCII),
which uses seven bits to code
128 characters.

 ASCII is a seven‐bit code, but


most computers manipulate an
eight‐bit quantity as a single unit
called a byte.

 Therefore, ASCII characters most


often are stored one per byte. The
extra bit is sometimes used for
other purposes, depending on
the application.

40
ASCII Character Code
■ ASCII Character Code

41
Error‐Detecting Code

To detect errors in data communication and processing, an


eighth bit is sometimes added to the ASCII character to
indicate its parity.

A parity bit is an extra bit included with a message to make the


total number of 1’s either even or odd.
Example:
Consider the following two characters and their even and odd parity:

42
Error‐Detecting Code
 Redundancy (e.g. extra information), in the form of extra bits,
can be incorporated into binary code words to detect and
correct errors.
 A simple form of redundancy is parity, an extra bit appended
onto the code word to make the number of 1’s odd or even.
Parity can detect all single-bit errors and some multiple-bit
errors.
 A code word has even parity if the number of 1’s in the code
word is even.
 A code word has odd parity if the number of 1’s in the code
word is odd.

43
Binary Storage and Registers
■ Registers
 A binary cell is a device that possesses two stable states and is capable of storing one of the
two states.
 A register is a group of binary cells. A register with n cells can store any discrete quantity of
information that contains n bits.
n cells 2n possible states
• A binary cell
– two stable state
– store one bit of information
– examples: flip-flop circuits
• A register
– a group of binary cells
– AX in x86 CPU

44
Binary Storage and Registers
■ Register Transfer

a transfer of the information stored in


one register to another
one of the major operations in digital
system

45
Binary Storage and Registers

The device most commonly used


for holding data is a register.

46
Binary Logic
 Binary logic consists of binary variables and a set of logical operations. The
variables are designated by letters of the alphabet, such as A, B, C, x, y, z, etc.,
with each variable having two and only two distinct possible values: 1 and 0,
There are three basic logical operations: AND, OR, and NOT.

47
Binary Logic
■ The truth tables for AND, OR, and NOT are given in Table 1.8.

48
Binary Logic
■ Logic gates
 Graphic Symbols and Input-Output Signals for Logic gates:

Fig. 1.4 Symbols for digital logic circuits

Fig. 1.5
Input-Output signals
for gates

49
Binary Logic
■ Logic gates

 Graphic Symbols and Input-Output Signals for Logic gates:

Fig. 1.6 Gates with multiple inputs

 The three input AND gate responds with logic 1 output if all three
inputs are logic 1. The output produces logic 0 if any input is logic 0.

 The four input OR gate responds with logic 1 if any input is logic 1;
its output becomes logic 0 only when all inputs are logic 0.

50
Binary Logic
 Electrical signals such as voltages or
currents exist as analog signals having
values over a given continuous range, say,
0 to 3 V, but in a digital system these
voltages are interpreted to be either of two
recognizable values, 0 or 1.
 Voltage operated logic circuits respond to
two separate voltage levels that represent a
binary variable equal to logic 1 or logic 0.
 For example, a particular digital system may
define logic “0” as a signal equal to 0 V and
logic “1” as a signal equal to 3 V.
 In practice, each voltage level has an
acceptable range.

51
The End

Reference:
1. Digital Design (with an introduction to the Verilog HDL) 6th Edition, M. Morris Mano,
Michael D. Ciletti

Note: The slides are supporting materials for the course “Digital Circuits” at IIITDM Kancheepuram.
Distribution without permission is prohibited.

52

You might also like