0% found this document useful (0 votes)
14 views41 pages

ELEC2607 - Slides1 - Digital Systems and Binary Numbers 1

switching circuits, lecture 1

Uploaded by

diaansiddiky
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)
14 views41 pages

ELEC2607 - Slides1 - Digital Systems and Binary Numbers 1

switching circuits, lecture 1

Uploaded by

diaansiddiky
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/ 41

Switching Circuits

Digital Systems and Binary Numbers (1)

Credentials: majority of information are from the textbook:


Digital Design with an Introduction to the Verilog HDL, VHDL, and SystemVerilog, 6th Edition
Objectives

1. Understand numeral systems.


2. Know how to convert between binary, octal, decimal, and hexadecimal numbers.
3. Know how to perform arithmetic operations on binary numbers.

2
ELEC 2607 - A. Ahmadi
Digital Systems
→ Digital systems have such a prominent role in everyday life
that we refer to the present technological period as the
digital age.
→ Digital systems are used in communication, business
transactions, traffic control, spacecraft guidance, medical
treatment, weather monitoring, the Internet, and many
other commercial, industrial, and scientific enterprises. We
have digital telephones, digital televisions, digital discs,
digital cameras, personal, handheld, touch-screen
Digital age1
devices, and, of course, digital computers.
→ The user can specify and change the program or the data according to the specific need.
Because of this flexibility, general-purpose digital computers can perform a variety of
information-processing tasks that range over a wide spectrum of applications and provide
unprecedented access to massive repositories of information and media.
1: https://blogs.uoregon.edu/eng250kelly/2018/03/06/technology-in-the-digital-age/

3
ELEC 2607 - A. Ahmadi
Digital Systems
→ The main characteristic of the digital systems is based on their ability to
“represent and manipulate information”
→ The key questions are:
➢ What is information?
➢ How to represent information?
➢ How to manipulate information?
→ Answering with these question requires dealing with varieties of theoretical and practical
problems.
➢ Theory: mathematics, logic, statistics, information theory, cognitive science, …
➢ Practice: circuit design, optimization, fabrication, …

4
ELEC 2607 - A. Ahmadi
Digital Systems Data are individual facts, statistics, or items of information,
often numeric, that are collected through observation.
→ What is information? (search online)
?
❖ Information is processed, organized and structured data (Wikipedia).
❖ Knowledge obtained from investigation, study, or instruction (Merriam-Webster).
❖ What is represented by a particular arrangement or sequence of things! (Oxford)
❖ Information can be viewed as a type of input to an organism or system.
❖ The cognitive scientist and applied mathematician Ronaldo Vigo argues that information
is a concept that requires at least two related entities to make quantitative sense.
❖ A key measure in information theory is entropy. Entropy quantifies the amount of
uncertainty involved in the value of a random variable or the outcome of a random
process.
❖ Information theory is the scientific study of the quantification, storage, and
communication of information.

5
ELEC 2607 - A. Ahmadi
Digital Systems
→ By definition, digital systems is about representation and manipulation of discrete elements
of information.
→ Any set that is restricted to a finite number of elements contains discrete information.
→ Examples of discrete sets are 0123456789
➢ 10 decimal digits, ABCDEFGHIJKLMNOPQRSTUVWXYZ
➢ 26 letters of the alphabet,
➢ 52 playing cards, and
➢ 64 squares of a chessboard. The point is:
THEY ALL ARE COUNTABLE!

→ Early digital computers were used for numeric computations. In this case, the discrete
elements were the digits.
→ From this application, the term digital computer emerged.

6
ELEC 2607 - A. Ahmadi
Discrete quantities of information either emerge from the nature of the data being
processed or may be quantized from a continuous process.
7
0000000010010
0000000011000
0000000011010
0000000011100
0000001010010
………………….
0000000111000
0000001111010
0000011010000

Continuous Discrete
what we normally see on a multimeter or an what we normally have in a
oscilloscope computer file

7
ELEC 2607 - A. Ahmadi
Digital Systems
→ In practice, discrete elements of information are represented by physical quantities called
signals. Electrical signals such as voltages and currents are the most common.
→ Electronic switches (i.e., transistors) predominate in the circuitry that implement, represent,
and manipulate these signals.
→ The signals in most present-day electronic digital systems use just two discrete values and
are therefore said to be binary.
→ A binary digit, called a bit, has two numerical values: 0 and 1.
→ Discrete elements of information are represented with groups of bits called binary codes.
→ For example, the decimal digits 0 through 9 are represented in a digital system with a code
of four bits (e.g., the number 7 is represented by 0111).

8
ELEC 2607 - A. Ahmadi
Digital Systems
→ How a pattern of bits is interpreted as a number depends on the code system in which it
resides.
→ To make this distinction, we could write
➢ (0111)2 to indicate that the pattern 0111 is to be interpreted in a binary system,
➢ (0111)10 to indicate that the reference system is decimal.
➢ Then (0111)2 = (7)10, which is not the same as (0111)10, or one hundred eleven.
→ The subscript indicating the base for interpreting a pattern of bits will be used only when
clarification is needed.
→ Through various techniques, groups of bits can be made to represent discrete symbols, not
necessarily numbers, which are then used to develop the system in a digital format.
→ A digital system is a system that manipulates discrete elements of information represented
internally in binary form. In today’s technology, binary systems are most practical because,
as we will see, they can be implemented with electronic components.

9
ELEC 2607 - A. Ahmadi
Digital Systems
→ In this course we study foundations of digital systems both in theory and practice.
→ Theory aspects:
➢ Information representation: numbers and symbols,
➢ Information manipulation: arithmetic and logic.
→ Practical aspects:
➢ Circuit design,
➢ Circuit optimization,
➢ Hardware Description Languages (HDL)

10
ELEC 2607 - A. Ahmadi
Numbers Representation 𝑒
𝜋 𝜋
𝑒
A number is a mathematical object used to count, measure, and label.

101001000100001
Numeral Systems
▪ System of numeration is a writing system for expressing numbers; that is, a mathematical
notation for representing numbers of a given set, using digits or other symbols in a
consistent manner.
▪ The same sequence of symbols may represent different numbers in different numeral
systems. For example, "11" represents the number eleven in the decimal numeral system
(used in common life), the number three in the binary numeral system (used in computers),
and the number two in the unary numeral system.

Hieroglyphs Number representation


12
ELEC 2607 - A. Ahmadi
Numeral Systems
→ The positional numeral system, specifically decimal, is the most common system for the
symbolic representation of numbers in the world in which the contribution of a digit to the
value of a number is the value of the digit multiplied by a factor determined by the position
of the digit.
→ In a radix-R positional system, there are R digits, d ∈ {0, 1, 2, 3, …, R-1}, by which an n-
digit number x is presented by
𝑛−1

𝑥 = (𝑑𝑛−1 ⋯ 𝑑2 𝑑1 𝑑0 )𝑅 = 𝑑𝑛−1 × 𝑅𝑛−1 + ⋯ + 𝑑1 × 𝑅1 + 𝑑0 × 𝑅0 = ෍ 𝑑𝑖 × 𝑅𝑖


𝑖=0
→ For instance,
(111)10 = 1x102 + 1x101 + 1x100 = 111
(111)2 = 1x22 + 1x21 + 1x20 = 7
(111)8 = 1x82 + 1x81 + 1x80 = 73
(111)16 = 1x162 + 1x161 + 1x160 = 273
(111)π = 1xπ2 + 1xπ1 + 1xπ0 =

13
ELEC 2607 - A. Ahmadi
Numeral Systems
→ The most popular systems which we consider in this course are:
➢ Decimal (base-10), R = 10, digits di = {0,1,2,3,4,5,6,7,8,9} 11 13 15
➢ Binary (base-2, R =2 ), R = 2, digits di = {0,1} 10 12 14
➢ Octal (base-8), R = 8, digits di = {0,1,2,3,4,5,6,7}
➢ Hexadecimal (base-16), R = 16, digits di = {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}

→ In this section, we are going to have a review on these numeral systems and arithmetic
operations in them.

14
ELEC 2607 - A. Ahmadi
Decimal Numbers
→ A decimal number such as 7392 represents a quantity equal to 7 thousands, plus 3
hundreds, plus 9 tens, plus 2 units.
→ The thousands, hundreds, etc., are powers of 10 implied by the position of the coefficients
(symbols) in the number. To be more exact, 7392 is a shorthand notation for what should
be written as
7392 = 7×103 + 3×102 + 9×101 + 2×100
→ As another example, a number with decimal point, such as 1367.924, is equal to
1367.924 = 1×103 + 3×102 + 6×101 + 7×100 + 9×10-1 + 2×10-2 + 4×10-3

→ The decimal number system is said to be of base, or radix, 10 because it uses 10 digits,
and the coefficients are multiplied by powers of 10.

15
ELEC 2607 - A. Ahmadi
Binary Systems
→ The binary system is another number system in which coefficients of the binary number
system have only two possible values: 0 and 1.
→ Each coefficient di is multiplied by a power of the radix, 2i, and the results are added to
obtain the decimal equivalent of the number.
→ The radix point, similar to the decimal point when 10 is the radix, distinguishes positive
powers of 2 from negative powers of 2.
→ For example, the decimal equivalent of the binary number 1001 is:
1×23+0×22+0×21+1×20 = 9
→ and the decimal equivalent of the binary number 11010.11 is:
1×24+1×23+0×22+1×21+0×20+1×2−1+1×2−2=26.75
→ The binary number system is said to be of base, or radix, 2 because it uses 2 digits, and
the coefficients are multiplied by powers of 2.

16
ELEC 2607 - A. Ahmadi
Octal Systems
→ In the octal system coefficients of the octal number system have 8 possible values:
{0,1,2,3,4,5,6,7}.
→ Each coefficient di is multiplied by a power of the radix, 8i, and the results are added to
obtain the decimal equivalent of the number.
→ The radix point, similar to the decimal point when 10 or 2 is the radix, distinguishes positive
powers of 8 from negative powers of 8.
→ For example, the decimal equivalent of the octal number 671 is:
6×82 + 7×81 + 1×80 = 441
→ and the decimal equivalent of the octal number 547.63 is:
5×82 + 4×81 + 7×80 + 6×8−1 + 3×8−2 = 359.796875
→ The octal number system is said to be of base, or radix, 8 because it uses 8 digits, and the
coefficients are multiplied by powers of 8.

17
ELEC 2607 - A. Ahmadi
Hexadecimal Systems
→ In the hexadecimal system coefficients of the octal number system have 16 possible
values: {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}, where A=10, B=11, C=12, D=13, E=14, F=15.
→ Each coefficient di is multiplied by a power of the radix, 16i, and the results are added to
obtain the decimal equivalent of the number.
→ The radix point, similar to the decimal point when 10, 2, or 8 is the radix, distinguishes
positive powers of 16 from negative powers of 16.
→ For example, the decimal equivalent of the hexadecimal number 3A0B is:
3×163 + 10×162 + 0×161 + B×160 = 14859
→ and the decimal equivalent of the hexadecimal number C15D.7B is:
12×163 + 1×162 + 5×161 + 13×160 + 7×16−1 + 11×16−2 = 49501.48046875
→ The hexadecimal number system is said to be of base, or radix, 16 because it uses 16
digits, and the coefficients are multiplied by powers of 16.

18
ELEC 2607 - A. Ahmadi
Number-Based Conversion
→ Representations of a number in a different radix are said to be equivalent if they have the
same decimal representation. For example, (0011)8 and (1001)2 are equivalent—both have
decimal value 9.
→ The conversion of a number in base R to decimal is done by expanding the number in a
power series and adding all the terms as shown previously.
→ We also need to present a general procedure for the reverse operation of converting a
decimal number to a number in base R.
→ If the number includes a radix point, it is necessary to separate the number into an integer
part and a fraction part, since each part must be converted differently. The conversion of a
decimal integer to a number in base R is done by dividing the number and all successive
quotients by R and accumulating the remainders. This procedure is best illustrated by
example.

19
ELEC 2607 - A. Ahmadi
Number-Based Conversion
Example: Convert decimal (41)10 to binary.
→ 41 = 2x20 + 1 ÷2

→ 20 = 2x10 + 0 Quotient 41 1 Remainder


20 0
→ 10 = 2x5 + 0
10 0
→ 5 = 2x2 + 1 5 1
→ 2 = 2x1 + 0 2 0

→ 1 = 2x0 + 1 1 1
0 end
(101001)2

20
ELEC 2607 - A. Ahmadi
Number-Based Conversion
Example: Convert decimal (153)10 to octal.
→ 153 = 8x19 + 1 ÷8

→ 19 = 8x 2 + 3 Quotient 153 1 Remainder


19 3
→2 = 8x 0 + 2
2 2

(231)8 0 end

21
ELEC 2607 - A. Ahmadi
Class notes:
Number-Based Conversion
Example: Convert (0.6875)10 to binary.
×2
→ 0.6875×2= 1.3750 0.6875 1
→ 0.3750×2= 0.7500 Fractions 0.3750 0 Integers
→ 0.7500×2= 1.5000 0.7500 1
→ 0.5000×2= 1.0000 0.5000 1
end end
0

(0.1011)2

23
ELEC 2607 - A. Ahmadi
Number-Based Conversion
Example: Convert (0.513)10 to octal.
×8
→ 0.513×8 = 4.104 Fractions 0.513 4 Integers
→ 0.104×8 = 0.832 0.104 0
→ 0.832×8 = 6.656 0.832 6
→ 0.656×8 = 5.248 0.656 5
→ 0.248×8 = 1.984 0.248 1
→ 0.984×8 = 7.872 0.984 7
might not end 0.872 6
0.976 7
(0.406517…)8 might not end
continued fraction!

24
ELEC 2607 - A. Ahmadi
Number-Based Conversion
Example: Convert (117.23)10 to octal.
→ Using explained methods: (117.23)10 = (117)10 + (0.23)10
→ Integer part → (117)10 = (165)8
→ Fraction part → (0.23)10 = (0.1656)8
→ Therefore
(117.23)10 = (165.1656)8

25
ELEC 2607 - A. Ahmadi
Number-Based Conversion
→ The conversion from and to binary, octal, and hexadecimal plays an important role in digital
computers, because shorter patterns of hex characters are easier to recognize than long
patterns of 1’s and 0’s. Conversion between these bases is very straight forward.
→ Since 23=8, each octal digit corresponds to three binary digits.
→ Since 24 = 16 each hexadecimal digit corresponds to four binary digits.
→ The conversion from binary to octal is easily accomplished by partitioning the binary
number into groups of three digits each, starting from the binary point and proceeding to
the left and to the right. The corresponding octal digit is then assigned to each group.
→ The following example illustrates the procedure:

010 1ต
(ต 10 0ต
01 1ต
01 0ต
11 . 1ต
11 1ต
00 0ต
00 1ต
10)2 = (26153.7406)8
2 6 1 5 3 7 4 0 6

26
ELEC 2607 - A. Ahmadi
Number-Based Conversion
→ Conversion from binary to hexadecimal is similar, except that the binary number is divided
into groups of four digits:
(0010 1100 0110 1011 . 1111 0010)2 = 2C6B. F2 16
2 C 6 B F 2

→ The corresponding hexadecimal (or octal) digit for each group of binary digits is easily
remembered from the values listed in Table 1.2.
→ Conversion from octal or hexadecimal to binary is done by reversing the preceding
procedure. Each octal digit is converted to its three-digit binary equivalent. Similarly, each
hexadecimal digit is converted to its four-digit binary equivalent. The procedure is illustrated
in the following examples:
(ณ
6 ณ7 ณ3 . ณ1 ณ2 ณ 4 )8 = (110 111 011. 001 010 100)2
110 111 011 001 010 100

→ and
( ณ
3 ณ
0 ณ
6 . D
ณ )16 = (0011 0000 0110 . 1101)2
0011 0000 0110 1101

27
ELEC 2607 - A. Ahmadi
Table 1.2 Numbers with Different Bases.

28
ELEC 2607 - A. Ahmadi
Number-Based Conversion
→ Binary numbers are difficult to work with because they require three or four times as many
digits as their decimal equivalents.
→ For example, the binary number 111111111111 is equivalent to decimal 4095. However,
digital computers use binary representation of numbers, and it is sometimes necessary for
the human operator or user to communicate directly with the machine by means of such
numbers.
→ One scheme that retains the binary system in the computer but reduces the number of
digits the human must consider, utilizes the relationship between the binary number system
and the octal or hexadecimal system.
→ By this method, the human thinks in terms of octal or hexadecimal numbers and performs
the required conversion by inspection when direct communication with the machine is
necessary.
→ Most computer manuals use either octal or hexadecimal numbers to specify instructions
and other binary quantities.

29
ELEC 2607 - A. Ahmadi
Math Operations
→ Variety of mathematical operations are involved in modern digital systems and data
processing.
→ This includes basic operations such as arithmetic and logic to more complex non-algebraic
functions. Q: How do you define complexity from math, software, or hardware point of views?
Q: How do you rate math operations in terms of their complexity?

→ Logic operations will be discussed extensively in this course.


→ Basic arithmetic operations, addition, subtraction, multiplication, and division can be
performed on binary numbers like the decimal system.
→ More complex operations, such as trigonometric, logarithmic, exponential etc., are normally
broken down into simpler operations.
Q: How do you define simplicity from math, software, or hardware point of views?
Q: How do you rate math operations in terms of their simplicity?

30
ELEC 2607 - A. Ahmadi
Binary Arithmetic Operations
→ The simplest arithmetic operation in binary is addition. Adding two single-digit binary
numbers is relatively simple:
→ 0+0→0
→ 0+1→1
→ 1+0→1
→ 1 + 1 → 10
→ Adding two 1 digits produces a digit 0, while the extra 1 (carry bit) will have to be added to
the next column.
→ This is similar to what happens in decimal when certain single-digit numbers are added
together; if the result equals or exceeds the value of the 10 (radix), the digit to the left is
incremented

31
ELEC 2607 - A. Ahmadi
Binary Arithmetic Operations
Example: Calculate (1101)2 + (10111)2 Example (in class): Calculate (111)2 + (10110)2

32
ELEC 2607 - A. Ahmadi
Binary Arithmetic Operations
→ Subtraction works in much the same way. For one-bit binary numbers we have:
→ 0−0→0
→ 0 − 1 → -1 (means 1 and borrow 1) Q: Which one is simpler, addition or subtraction?
→ 1−0→1 Q: What happens if subtraction result is negative?
→ 1−1→0 Q: How do we represent negative numbers in binary system?
→ Subtracting a 1 digit from a 0 digit produces the digit 1, while 1 will have to be subtracted
from the next column. This is known as borrowing. The principle is the same as for
carrying. Check the examples below:
borrow

33
ELEC 2607 - A. Ahmadi
Binary Arithmetic Operations
→ Multiplication in binary is similar to its decimal counterpart. Two numbers A and B can be
multiplied by partial products: for each digit in B, the product of that digit in A is calculated
and written on a new line, shifted leftward so that its rightmost digit lines up with the digit in
B that was used. The sum of all these partial products gives the final result.
→ Since there are only two digits in binary, 0 and 1, there are only two possible outcomes of
single bit multiplication: b x A
→ If the digit b is 0, the partial product is also 0,
→ If the digit b is 1, the partial product is equal to A.
→ One-bit Multiplication table X 0 1
0 0 0
1 0 1
→ Example, find multiplication the binary numbers 1011 and 1010:

34
ELEC 2607 - A. Ahmadi
Binary Arithmetic Operations
→ Fractional binary numbers can also be multiplied with bits after a binary point:
→ Example:
find multiplication the binary numbers 101.101 and 110.01

Q: Multiplication is more complicated or addition?

Q: How many additions are contained within each multiplication?

Q: If we multiply an m-bit number with an n-bit, how many bits


will be in the result?

Q: Is there any simpler/cheaper way to multiply numbers?

35
ELEC 2607 - A. Ahmadi
Binary Arithmetic Operations
→ Division in binary can be done similar to its decimal counterpart.
Two numbers A and B can be divided using a similar procedure as
of decimal division.
→ Example: find the binary division of (11011)2 and (101)2:

→ Note: in practice, there are methods to approximate division with


simpler arithmetic operations such as addition and subtraction.

36
ELEC 2607 - A. Ahmadi
Binary Numbers: some notes
→ Q: As we know, in binary (2)10 = (10)2. What happens when you multiply a number by two in
the binary system?
→ A: you add a 0 in front of the LSB to multiply it!
→ Example: 11011x10 = 110110,
→ Q: what happens when you divide a number by two in the binary system?
→ A: you remove the LSB to divide them!
→ Example: 11011÷10 = 1101
→ Q: As we know, in binary 2n = (1 00 ⋯ 0)2. What happens when you multiply or divide a
𝑛
2n
number by in the binary system?
→ A: you add a n 0s in front of the LSB to multiply it by 2n or remove n-bits from its left-
hand-side to divide it by 2n

37
ELEC 2607 - A. Ahmadi
38
ELEC 2607 - A. Ahmadi
Take homes
→ Digital system are opening new horizons and paradigms in technology and society.
→ Digitalization (!) requires digital-compatible representation of information and operations.
→ Numbers, as one of the most important components of information, can be represented in
different numeral systems, some of which are implementable using switching circuits.
→ Basic arithmetic operations on radix-2 numbers.
→ We are left with few intriguing question:
→ What is information?
→ What is complexity?
→ Is there any better way to implement arithmetic operations?

39
ELEC 2607 - A. Ahmadi
Some quotes!
→ “The digital revolution is far more significant than the invention of writing or even of printing” --
Douglas Engelbart
→ “The Second Wave Society is industrial and based on mass production, mass distribution, mass
consumption, mass education, mass media, mass recreation, mass entertainment, and weapons of
mass destruction. You combine those things with standardization, centralization, concentration, and
synchronization, and you wind up with a style of organization we call bureaucracy”. The Third Wave
is the post-industrial society. -- Alvin Toffler, The Third Wave
→ "Not everything that counts can be counted, and not everything that can be counted counts.” --
credited to either Einstein or William Bruce Cameron

40
ELEC 2607 - A. Ahmadi
Next Session
→ We will learn how to take the complement and reduced radix complement of a number.
→ We will learn how to form the code of a number.
→ We will learn how to form the parity bit of a word and error check.

41
ELEC 2607 - A. Ahmadi

You might also like