1 / 42

Advanced Computer Arithmetic M ultilevel RNS Week 5

CENG536 Computer Engineering department Ç ankaya University. Advanced Computer Arithmetic M ultilevel RNS Week 5.

brant
Download Presentation

Advanced Computer Arithmetic M ultilevel RNS Week 5

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CENG536 Computer Engineering department Çankaya University Advanced Computer ArithmeticMultilevel RNSWeek 5

  2. One of essential advantage of the residue number system is the parallel processing of all digits, that are residue by selected moduli . The range of representation P is the product of moduli and it extends more then number of bits to represent the number. One of possible system that gives range P  1017 will be 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47. The number of bits in registers to store residui will be 2, 3, 3, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6 Multilevel RNS CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  3. We want extend range of data representation, but decrease number of bits to represent each residue. In turn it leads to system with few levels of moduli. Let the main system of moduli is and its provides range for operations [0, P ). The largest number in this system after multiplication is (pn – 1)2. Let we represent all digits of the main system in a new system with moduli that gives range In this system the largest number after multiplication is (r– 1)2. Multilevel RNS CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  4. We can write the numbers of system with moduli i in a new system with bases satisfying and so on . . . This transfer from large to small bases simplifies and unifies arithmetic unit. For the system with range P  1017the largest base is pn = 47. Multiplication can gives result 462 = 2116. From this, the second level of the system should have the range for the biggest modulo   2116. From the set of relatively prime numbers we can select bases i that are 3, 5, 11, 13. For this system we need only 4 bits for the largest base. Multilevel RNS CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  5. The largest result of multiplication for this system will be 122 = 144, and if we add third level, the selected bases can be 3, 5, 11. Here the largest result of operation is 102 = 100. For this level the bases are 3, 5, 7. Its evident, that no other levels necessary to add. Multilevel RNS CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  6. Example of the multilevel system: To produce computations with numbers from 1 to 103 we select system of moduli to represent numbers in range from 1 to 106. One of system is It provides range Let each digit will be presented on second level system Its range is The largest possible result will be defined as (7 -1 )2 = 36, but for the first system of bases its (21 – 1)2 = 400. Second level operates with numbers 10 times less. Multilevel RNS CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  7. Example: First level Second level Let we multiply 115  541. Their representation in first level system are and in second level are Multiplication in second and first level accordingly gives Results are identical. Multilevel RNS CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  8. Rational Operations in RNS CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  9. Realizing arithmetic operations we need to check overflow over the range. But for some reasons intermediate overflows are possible, if the final result is in range of the system. The same may be expand on computation of the polynomial. Let is given polynomial where are the coefficients and powers of the polynomial base, represented in RNS with bases p1, p2, …, pn. Rational operations in RNS CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  10. Introducing and applying rules of addition and multiplication in RNS we can write The polynomial components should be presented in artificial form. Rational operations in RNS CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  11. Example 1: Given the system with bases Compute expression for Artificial form of numbers: First we compute Checking in decimal gives Rational operations in RNS CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  12. Example 2: Given the system with bases Compute expression for Artificial form of numbers: First we compute Checking in decimal gives Rational operations in RNS CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  13. Example 3: Given the system with bases Compute expression for We write with the coefficients in artificial form Then we compute where is the residue by (mod pj) From this Checking in decimal gives Rational operations in RNS CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  14. Conversion of Numbers From Positional System to RNS and Vice Versa CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  15. Transform of number N from positional system to RNS and vice versa may be realized by applying set of special constant, that are powers of p(the base of positional system) represented in RNS. Let is given N in positional system with base p or (*) Here i – one of number 0, 1, 2, ..., p-1 and let for are representation of the polynomial (*) coefficients. Conversion of numbers CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  16. Denoting (**) we get that is, to create representation of N in RNS we need r constants, that are powers of p and p– 1 constants of different meanings of i. Its easy then division of N by each base and creating the residue. Conversion of numbers CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  17. Example: • Transform number 102 from decimal to RNS with the bases • Constants for this transform are • According to (**) we get • Expanding set of constants • transform will be realized by adding of appropriate constants. Conversion of numbers CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  18. To realize transform from RNS to positional system we need another set of constants. Let the bases of the system are Let be determined n numbers both in RNS and in positional systems. This numbers are orthogonal bases or numbers of the system. Let the number A to be converted from RNS to positional system is of form Conversion of numbers CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  19. To convert number we need determine numbers that gives This equation in RNS will be of form Equating proper residues gives system of linear algebraic equations. Conversion of numbers CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  20. From this equation we can determine System have integer solutions, if determinant will satisfy Conversion of numbers CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  21. There may be selected large set of , but for practical reasons may be selected numbers of form And for this orthogonal bases we get from which Conversion of numbers CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  22. Determinant for this orthogonal bases is of form Conversion of numbers CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  23. Example: • Transform number from RNS with the bases to decimal. • First we determine the orthogonal bases • Then we can compute • And final result by modulo P = 105 is Conversion of numbers CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  24. By definition orthogonal bases may be represented as where mi– integer positive number, the weight of the orthogonal basis. It should be selected to satisfy or where li– integer positive number. Adding all orthogonal bases we get Conversion of numbers CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  25. Elements of the Theory of Congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  26. Definition. Two integers a and b are congruent by modulo p, if their difference (a – b) is multiple to p, i.e. a – b = l  p, where l – integer. Congruences possesses many properties typical for the equalities. Elements of theory of congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  27. Property 1. For integers a, b, c, d from congruences follows, that a identically equal to b By definition where l1 and l2 – integers. Removing c from both equalities gives Elements of theory of congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  28. Property 2. In congruence, as well as in the equality, members can be transferred from one part to the other. For the congruence We can write Then, we can rewrite it as Turning from equality to the congruence we get Elements of theory of congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  29. Property 3. Given congruences and we can write Congruences can be rewritten as equalities Adding and subtracting them we get Turning from equalities to the congruences we obtain proof of this property. Elements of theory of congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  30. Example: For the congruences and let we found their sum and difference the validity of which is easy to check. Elements of theory of congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  31. Property 4. If there is and integer r, then, multiplying we get First congruence is equivalent to equality Multiplying both sides by r we get equality where which is equivalent to second congruence. Elements of theory of congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  32. Property 5. Let then Lets write congruences as equalities Multiplying this equations term by term gives which is equivalent to congruence. Elements of theory of congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  33. Property 6. Let given the polynomial And let the numbers a and b satisfy a b (mod p) For this case we get This property can be proofed by using preceding properties. Elements of theory of congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  34. Example: Given the polynomial We want check, that for and is satisfied Polynomial for this values of x gives Subtracting we get It is easy to see that the difference is divisible by 5, i.e. Elements of theory of congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  35. Property 7. Let we have congruence and let c and p are relatively prime. In this case will be satisfied congruence (Division!) The initial congruence is equivalent to equality Both sides must be multiple to c. As c and p are relatively prime, k should be multiple to c that gives Removing c from both sides we get and Elements of theory of congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  36. Example: Lets simplify congruence We can write it in form 34  11 = 7  11 (mod 9) Numbers 9 and 11 are relatively prime The difference 34 – 7 is multiple to 9, then we get 34 = 7 (mod 9) Elements of theory of congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  37. Property 8. Let be the congruence Then, we can write congruence The initial congruence is equivalent to equality All members of the expressions contain factor c that can reduce. Elements of theory of congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  38. Solving of ElementaryCongruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  39. Let x is solution of the congruence If this congruence has one solution, then it has infinite number of solutions that are congruent by (mod p).Among these solutions there is the least positive residue and the least negative residue. Let we introduce concept of independent solution of the congruence. Two solutions ( and ) will be independent solutions, if they are non comparable by (mod p). Solving of Elementary Congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  40. Theorem. Congruence has as many solutions as many numbers in the series 0, 1, ..., p – 1 (*) will satisfy it. Denoting these numbers , totality of solutions n is of form Solving of Elementary Congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  41. Let  is arbitrary number from series (*). Arbitrary number  which is out of elements of this series has a form Let  is solution of congruence, i.e. Substituting it in the right side of the polynomial we get This gives that is  is solution of congruence. But the number  is comparable to  and it is not the independent solution. So we have not more than p independent solutions. Solving of Elementary Congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

  42. Example: Given the polynomial Substituting x equal 0, 1, 2, ..., 10 we get f(x) 2, 12, 44, 116, 246, 452, 752, 1164, 1706, 2396, 3152 The only number 44 is multiple p = 11, which corresponds to x = 2. The congruence has the only solution x = 2 (mod p) Solving of Elementary Congruences CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

More Related