CENG536 Computer Engineering department Çankaya University.

Slides:



Advertisements
Similar presentations
CENG536 Computer Engineering Department Çankaya University.
Advertisements

CENG536 Computer Engineering department Çankaya University.
Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
Study Guides Quantitative - Arithmetic - Numbers, Divisibility Test, HCF and LCM Mycatstudy.com.
Number Theory and Cryptography
CENG536 Computer Engineering Department Çankaya University.
UNIVERSITY OF MASSACHUSETTS Dept
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Congruence class arithmetic. Definitions: a ≡ b mod m iff a mod m = b mod m. a  [b] iff a ≡ b mod m.
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
1 CSE-221 Digital Logic Design (DLD) Lecture-1: Digital Systems & Number Systems.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Mantıksal Tasarım – BBM231 M. Önder Efe
Fall 2002CMSC Discrete Structures1 Let us get into… Number Theory.
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
Whole Numbers Are the whole numbers with the property of addition a group?
Slide 5-1 Copyright © 2005 Pearson Education, Inc. SEVENTH EDITION and EXPANDED SEVENTH EDITION.
Lecture for Week Spring.  Numbers can be represented in many ways. We are familiar with the decimal system since it is most widely used in everyday.
1 Arithmetic and Logical Operations - Part II. Unsigned Numbers Addition in unsigned numbers is the same regardless of the base. Given a pair of bit sequences.
Mathematics of Cryptography Part I: Modular Arithmetic
ELEN 5346/4304 DSP and Filter Design Fall Lecture 12: Number representation and Quantization effects Instructor: Dr. Gleb V. Tcheslavski Contact:
Coping With the Carry Problem 1. Limit Carry to Small Number of Bits Hybrid Redundant Residue Number Systems 2.Detect the End of Propagation Rather Than.
MATH 224 – Discrete Mathematics
Numeral Systems Subjects: Numeral System Positional systems Decimal
Computer Arithmetic Nizamettin AYDIN
3-1 Chapter 3 - Arithmetic Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer Architecture.
Logic and Digital System Design - CS 303
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
Mathematics Review Exponents Logarithms Series Modular arithmetic Proofs.
07/19/2005 Arithmetic / Logic Unit – ALU Design Presentation F CSE : Introduction to Computer Architecture Slides by Gojko Babić.
Number Systems. Why binary numbers? Digital systems process information in binary form. That is using 0s and 1s (LOW and HIGH, 0v and 5v). Digital designer.
Reconfigurable Computing - Multipliers: Options in Circuit Design John Morris Chung-Ang University The University of Auckland ‘Iolanthe’ at 13 knots on.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
Computer Arithmetic and the Arithmetic Unit Lesson 2 - Ioan Despi.
1 EENG 2710 Chapter 1 Number Systems and Codes. 2 Chapter 1 Homework 1.1c, 1.2c, 1.3c, 1.4e, 1.5e, 1.6c, 1.7e, 1.8a, 1.9a, 1.10b, 1.13a, 1.19.
Cosc 2150: Computer Organization Chapter 2 Part 1 Integers addition and subtraction.
CSC 221 Computer Organization and Assembly Language
Copyright © 2009 Pearson Education, Inc. Chapter 5 Section 1 - Slide 1 Chapter 1 Number Theory and the Real Number System.
Significant Figure Rules RulesExamples The following are always significant Non zero digits Zeros between non zero digits Zero to the right of a non zero.
1 2.1 Introduction A bit is the most basic unit of information in a computer. –It is a state of “on” or “off” in a digital circuit. –Sometimes these states.
Module #9 – Number Theory 1/5/ Algorithms, The Integers and Matrices.
Copyright © Cengage Learning. All rights reserved. Fundamental Concepts of Algebra 1.1 Real Numbers.
Introduction To Number Systems Binary System M. AL-Towaileb1.
Overview of Residue Number System (RNS) for Advanced VLSI Design and VLSI Signal Processing NTUEE 吳安宇.
Slide Copyright © 2009 Pearson Education, Inc. Unit 1 Number Theory MM-150 SURVEY OF MATHEMATICS – Jody Harris.
Integer Operations Computer Organization and Assembly Language: Module 5.
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Brief Overview of Residue Number System (RNS) VLSI Signal Processing 台灣大學電機系 吳安宇.
BINARY SYSTEMS ENGR. KASHIF SHAHZAD 1. BINARY NUMBERS 1/2 Internally, information in digital systems is of binary form groups of bits (i.e. binary numbers)
Reconfigurable Computing - Options in Circuit Design John Morris Chung-Ang University The University of Auckland ‘Iolanthe’ at 13 knots on Cockburn Sound,
Number Theory Lecture 1 Text book: Discrete Mathematics and its Applications, 7 th Edition.
Slide Copyright © 2009 Pearson Education, Inc. Slide Copyright © 2009 Pearson Education, Inc. Chapter 1 Number Theory and the Real Number System.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Choosing RNS Moduli Assume we wish to represent 100, Values Standard Binary  lg 2 (100,000) 10  =   =17 bits RNS(13|11|7|5|3|2), Dynamic.
Cosc 2150: Computer Organization
Digital Logic & Design Adil Waheed Lecture 02.
Digital Logic & Design Dr. Waseem Ikram Lecture 02.
Digital Systems and Number Systems
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Data Representation in Computer Systems
Overview of Residue Number System (RNS) for Advanced VLSI Design and VLSI Signal Processing NTUEE 吳安宇.
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
Brief Overview of Residue Number System (RNS)
Data Representation in Computer Systems
Digital Logic & Design Lecture 02.
Overview Part 1 – Design Procedure Part 2 – Combinational Logic
Binary to Decimal Conversion
Presentation transcript:

CENG536 Computer Engineering department Çankaya University

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 2 Residue number systems (RNS) were invented by the third- century Chinese scholar Sun Tzu – a different Sun Tzu from the author of the famous Art of War. In Problem 26 of his Suan Ching (Calculation Classic), our Sun Tzu posed a mathematical riddle: We have things of which we do not know the number If we count them by threes, we have two left over If we count them by fives, we have three left over If we count them by sevens, we have two left over How many things are there?

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 3 In other words, “What number yields the remainders 2, 3, and 2 when divided by 3, 5, and 7, respectively?" In modern terminology, 2, 3, and 2 are residues, and 3, 5, and 7, are moduli. Sun Tzu gave a rule, the Tai-Yen (Great Generalization) for the solution of his puzzle. In 1247, another Chinese mathematician, Qin Jiushao, generalized the Great Generalization into what we now call the Chinese Remainder Theorem, a mathematical jewel.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 4 In the 1950s, RNS were rediscovered by computer scientists, who sought to put them to use in the implementation of fast arithmetic and fault-tolerant computing. Three properties of RNS make them well suited for these. The first is absence of carry propagation in addition and multiplication, carry-propagation being the most significant speed-limiting factor in these operations.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 5 The second is that because the residue representations carry no weight-information, an error in any digit-position in a given representation does not affect other digit-positions. And the third is that there is no significance-ordering of digits in an RNS representation, which means that faulty digit-positions may be discarded with no effect other than a reduction in dynamic range.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 6 Papers printed by Czech scientists M. Valach and A. Svoboda were the impulse to start explorations in RNS mathematic (1955 – 1957). Soviet scientists I. Akushskiy, D. Yuditskiy, V. Amerbayev and B. Pak analyzing and developing this system have offered computer arithmetic (1955 – 1962). RNS was used in few military systems of USSR designed in period 1958 – 1970.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 7 Anti-missile defense system A-35 Exoatmospheric missile А-350Ж ( ) (distance of flight 400 km, height range of defeat km, time of flight (max) 3 min, nuclear warhead)

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 8 Anti-missile defense system A-35 Exoatmospheric missile А-350Ж

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 9 Anti-missile defense system A-35 Radar "Дунай-3У" ( )

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 10 Anti-missile defense system A-35 Control center

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 11 Soviet military computer 5Э53 – designed for anti-missile defense system A-35 ( ). Work in residue number system. Rate 40 MIPS. Clocking frequency 6 MHz. RAM 10 Mbit. ROM 2,9 Mbit. External memory 3 Gbit. Harvard architecture. Pipelined arithmetic.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 12 Front bomber СУ24 (First flight – 1967). Equipped by control computer based on RNC.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 13 Western definition of RNS : Residue number systems are based on the congruence relation, which is defined as follows. Two integers a and b are said to be congruent modulo m if m divides exactly the difference of a and b; it is common, especially in mathematics tests, to write a  b (mod m) to denote this. Thus, for example, 10  7 (mod 3); 10  4 (mod 3); 10  1 (mod 3), and 10  – 2 (mod 3). The number m is a modulus or base, and we shall assume that its values exclude unity, which produces only trivial congruences.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 14 Western definition of RNS : If q and r are the quotient and remainder, respectively, of the integer division of a by m – that is, a = q:m + r – then, by definition, we have a  r (mod m). The number r is said to be the residue of a with respect to m, and is usually denoted by r = |a| m. The set of m smallest values {0, 1, 2, …., m – 1}, that the residue may assume is called the set of least positive residues modulo m. Unless otherwise specified, we shall assume that these are the only residues in use.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 15 Russian definition of RNC: Let is given set of positive integer relatively prime numbers that are the moduli (bases) of the system. The residue number system is that system in which integer positive number is presented by set of residui (remainders) on selected moduli where each  i is determined according equation for each where operation [. ] means separation of integer part.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 16 Theory of numbers proves that, if numbers p i are relatively prime, the number described by digits has the unique representation. The range of numbers (dynamic range), represented in this system is Like in positional system range of numbers increases as product of moduli and number of digits to represent N increases as the sum of word lengths of the same bases.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 17 p 1 = 3, p 2 = 5, p 3 = 7 – the moduli of the RNS system P = 3 ∙ 5 ∙ 7 = 105 – range of numbers presentation 0 ≡ ( 0, 0, 0 )8 ≡ ( 2, 3, 1 ) 1 ≡ ( 1, 1, 1 ). 2 ≡ ( 2, 2, 2 ). 3 ≡ ( 0, 3, 3 ). 4 ≡ ( 1, 4, 4 )103 ≡ ( 1, 3, 5 ) 5 ≡ ( 2, 0, 5 )104 ≡ ( 2, 4, 6 ) 6 ≡ ( 0, 1, 6 )105 ≡ ( 0, 0, 0 ) 7 ≡ ( 1, 2, 0 )106 ≡ ( 1, 1, 1 ) Example:

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 18 Lets analyze the rules of execution of arithmetic operations for the case of both operands and result are in range [ 0, P ). and the conditions are satisfied. includednot included

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 19 Residui for addition and multiplication will be determined as and the digit of results is taken from

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 20 For addition we can write Representation of A and B are where k i and l i are non negative integers. Then From which

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 21 In case of multiplication Substituting representation of A an B gives From which

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 22 Example 1: Let the moduli of the system are We want add numbers A = 17 and B = 63. For the given moduli numbers are represented as Result of addition is Its easy check that (2, 0, 3) is 80 and is equal to the sum of operands.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 23 Example 2: For the system with the same moduli we want multiply numbers In accordance with the multiplication rules result is Its easy to check, that this number is 102 and is equal to product of operands.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 24 Advantages of the system: - Independence of creating (determining) of the digits, as each residue carry information about whole original number. - Independence of digits of each other and from this possibility of parallel processing of residui. - Small number of bits to represent each residue, that opens possibility to process data using tables, instead of units on the base of logical elements.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 25 Disadvantages of the system: - Impossibility to visual comparing of the numbers. - Absence of simple indication of overflow and underflow over the range [ 0, P ). - Limitedness of the system by the area of integer positive numbers. - Obtaining in all cases accurate results and absence of possibilities of rounding and truncation.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 26 How to introduce negative numbers? Let be realized subtraction of two numbers for the same system. Result is presented by residui  i for the same bases And let conditions are satisfied. Then for subtraction we have

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 27 Sign of result is not determined. Strongly say, sign of operands were not processed (in representation of numbers they are absent) and the sign of result is not created. Let for the system with the bases the range of numbers is Let the base We denote or In residue number system this number is presented as

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 28 Accepting this number as zero we can represent positive numbers in form and negative numbers as Realizing algebraic addition positive and negative numbers will be represented as This form is referred to as artificial form and we always will deal with positive numbers. But, the numbers in range will reflect negative numbers in this artificial form, and in range – positive.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 29 Let we add two numbers N 1 and N 2. The artificial forms are and their sum is Artificial form of the sum is presented by then from this and because is half of the range, we can write 0

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 30 Example 1: Given the system with the moduli and half of range Let We create artificial forms And determining sum of this numbers we get The number is artificial form of the sum, that may be checked by conversion to decimal

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 31 Example 2: For the same system with the moduli and half of range Let The artificial forms arepositive Determining sum of this numbers we getnegative Result is artificial form of the sum, that may be checked by conversion to decimal

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 32 Example 3: For the same system we add numbers We create artificial formsnegative numbers Adding this numbers we get Result is artificial form of the sum, that may be checked by conversion to decimal

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 33 Transform of positive numbers to negative and vice versa, i.e. creating of its complement is realized by subtracting of this number from number For analyzed examples this transform may be illustrated as Note: If subtrahend is in artificial form, to form the complement it should be subtracted not from but from

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 34 Example: Given numbersTheir artificial forms are complement code of N 2 is Sum of and is From one of preceding examples is known that

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 35 Example: Given numbers Lets create complement code of N 2 and add these numbers Producing mathematical operations in decimal we get

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 36 Lets analyze multiplication. Artificial forms of the two numbers are then from which Taking in account that and because that numbers are in artificial form we get Because P is odd number, we have The rule for multiplication is defined in form: if N 1 and N 2 are of the same parity if N 1 and N 2 are of different parity

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 37 Because one of the basis of the system is 2, we can determine parity (odd, even) of the number analyzing residue by this modulo. Odd numbers have residue of 1 and even – 0.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 38 Example 1: For the same system let Artificial form of numbers are Product of numbers is Because both numbers are of the same parity we get Applying decimal conversion gives

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 39 Example 2: For the same system let Artificial form of numbers are Product of numbers is Because both numbers are of the same parity we get Applying decimal conversion gives

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 40 Example 3: For the same system let Artificial form of numbers are and their product is From Example 1 we have and the same result gives

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 41 Example 4: Now let numbers for the same system are of different parity Artificial form of numbers are and their product is Applying rule for multiplicand and multiplier of different parity gives In decimal system we get

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 42 Example 5: Now let numbers for the same system are of different parity Artificial form of numbers are and their product is Applying rule for multiplicand and multiplier of different parity gives In decimal system we get

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 43 The general approach to the introduction of negative numbers. Let moduli of the system are and let The range of numbers is divided in two parts and. Let

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 44 Let the number will represent zero for the system. Positive numbers will be represented in form and negative one will be of form General description for all numbers is Such representation is referred to as general artificial form of the number.

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 45 If no overflow/underflow while arithmetic operation is processed, addition and subtraction may be realized in artificial form Artificial form of the sum is Lets denoteas Here we have And sum of numbers in artificial code is

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 46 Complement code of N may be obtained by subtracting the number from If the number is represented in artificial form, complement code should be obtained by subtracting from

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 47 Example 1: Let system has moduli For this system Let The artificial forms are According to introduced rules And in decimal system and

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 48 Example 2: Let The artificial forms are And in decimal system

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 49 Now lets analyze multiplication representing numbers in general artificial form. Let numbers are and then Denoting we have from which We can denote Integer part Fraction part

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 50 Now new edition of this expression is of form and If  is even, then that gives If  is odd, then and in this case

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 51 Lets introduce variable t which is defined as if  is even, then and we have if  is odd, then Best form for  is in artificial representation of operands

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 52 Example 1: LetArtificial forms are Value of  and t are determined as Product is In decimal

CENG Spring Dr. Yuriy ALYEKSYEYENKOV 53 Example 2: LetArtificial forms are Value of  and t are determined as Product is In decimal