Upload
buithuy
View
216
Download
0
Embed Size (px)
Citation preview
Course title: Arithmetic of Digital Systems (ADS)
Faculty of Automatic Control, Electronics and Computer Science,
Institute of Informatics
Field of study: Informatics
Stationary first degree studies
Silesian University of Technology as Centre of Modern Education
Based on Research and Innovations
POWR.03.05.00-IP.08-00-PZ1/17Project co-financed by the European Union under the European Social Fund
LECTURE 1
3
Introduction: Course Description
• Teaching modes and hours• Semester 1: lecture 15, classes 15
• Method of assessment: tests• References
[1] Stańczyk U., Cyran K., Pochopień B. Theory of logic circuits volume 1 Fundamental issues, Publishers of the Silesian University of Technology, Gliwice 2007[2] Pochopień B. Arytmetyka komputerowa. Akademicka Oficyna Wydawnicza EXIT, Warszawa 2012[3] Pochopień B., Stańczyk U., Wróbel E.: Arytmetyka systemów cyfrowych w teorii i praktyce. Wydanie II poprawione i uzupełnione. Wydawnictwo Politechniki Śląskiej, Gliwice 2012
4
Important Practical Information
• Course instructors• PhD Eng. Urszula Stańczyk• PhD DSc Eng. Bartłomiej Zieliński
• Lecturer• PhD Eng. Urszula Stańczyk• Office hours: room 315• E-mail: [email protected]
• Database• zmitac.aei.polsl.pl• user accounts• access to courses and grades• more detailed information to follow in classes
5
Course Objectives
Getting acquainted with the theory and gaining practical skills in the scope of: principles of the implementation of basic arithmetic operations and methods of arithmetic operations in fixed-point and floating-point arithmetic and their selection, evaluation and application.
6
Discussed topics (1)• Number systems
• Arithmetic operations on single digits in a system with radix R
• Complements in positional number system with radix R
• Representation of numbers with sign
• Representation of numbers in digital systems
• Codes
• BCD numbers – Representation
– Complements
7
Discussed topics (2)• Conversions between positional number systems
with different radixes
• Arithmetic of fixed-point numbers – Binary addition and subtraction
– Binary multiplication and division
– Addition and subtraction for BCD numbers
– Multiplication and division for BCD numbers
• Floating point arithmetic– Addition and subtraction
– Multiplication and division
8
Discussed topics (3)• Fundamental arithmetic circuits
– Adder
– Subtractor
– Comparator
• Parallel and serial circuits
9
Number system• A number – an abstract entity that represents
a count or measurement
• Components of a number system
– Set of arbitrarily established symbols for representing numbers
– Set of rules dictating representation of any number by these symbols
– Set of rules for performing arithmetic operations on numbers
10
Number systems• Symbolic non-positional systems
– The numerical value of a digit is independent on its position within a number
– Example: Roman number system
I, II, III, IV, IX,…
• Weighted positional number systems– The numerical value of a digit is indicated by its
position, as to all specific weights are assigned
– Example: Arabic number system
1, 11, 111, 12, 212,…
11
Positional number system• In a weighted positional number system
(N+M)-positional non-negative number
is represented as:
12
Characteristics of a positional number
system• The maximal value of number A that can be
represented
• The minimal value of non-zero A number
• The number of all different numbers that can be represented in the system
• Absolute error of representation of A
13
Positional systems with positive radix
• The most widely used systems:
– binary
– octal
– decimal
– hexadecimal
– binary-coded decimal (BCD)
14
Representation of integers in systems
with various radixes
15
Arithmetic operations in a number
system with radix R
16
• Four basic operations:
• Addition, subtraction and multiplication on two (N+M)-positional nonnegative numbers
in a number system with radix R can be reduced to these operations on single digits
Arithmetic operations on single digits
in a system with radix R
17
Results of basic operations in binary
system
18
LECTURE 2
19
Conversion of numbers• Converting a number X represented in a number system
with radix R
into its equivalent form in a number system with radix Smeans finding
• Methods convenient when– R=10 and S≠10– R ≠10 and S=10
• Fraction that is finite in one system can become infinite when we change radix, then we obtain rounding off error
20
Quotient-product method• Two parts of the conversion process
– digits of integer part of the number are found as numerators of fractional remainders obtained from division by S in the system with radix R
• Firstly we divide the integer part , then resulting quotients.
• The division stops when we reach the quotient equal 0.
– digits of fractional part of the number are found as carry digits shifted to the integer part when multiplying by S in the system with radix R
• Firstly we divide the fractional part , then resulting fractions.
• The multiplication stops when we reach the fraction equal 0, or when we find the required number of digits
• Most convenient when R=10 and S≠10
21
Example
22
Direct method• Digits of a number and radix R are
expressed by their equivalents in a number system with radix S as
• Representation of the number is found by performing operations in system with radix S
• Most convenient when R ≠10 and S=10
23
Example
24
For binary number find its decimal equivalent
Tabular version of direct method
25
2nd version of direct method• Repetitive multiplication by R i and R -i
computationally expensive
• Instead nested calculations can be employed
26
Example
27
For binary number find its decimal equivalent(�)�= 1011.101
Differential method• Conversion by subtracting multiples of powers
of a radix – Firstly from the converted number we subtract the
highest multiple of the highest power of a radix that is not grater than the converted number
– Next we subtract from the obtained difference, and the powers gradually decrease
– The process stops when we reach zero or required accuracy
• Most convenient when R = 10 and S≠ 10
28
Example
29
Conversion between systems with
radix BK
• It is fairly easy to convert numbers between systems for which radixes are equal to powers of the same base
• The simplest case: powers of 2 – binary – 20
– octal – 23
– hexadecimal 24
• Conversions
30
Example
31
Conversion accuracy• To maintain accuracy through conversion we need
to find the required number of digits in the fractional part K
• Generally an absolute error of representation of A
is
• For systems with radixes R and S
• It is common to use
32
ExampleFor a decimal number with 2 fractional digits (soK10=2) find numbers of fractional digits required to maintain accuracy for the conversions:
decimal-binary, decimal-octal, decimal-hexadecimal
33