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.

Slides:



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

HEXADECIMAL NUMBERS Code
2-1 Chapter 2 - Data Representation Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer Architecture.
Chapter 2: Data Representation
Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 2: Data Representation.
CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Winter 2004 Lecture 2.
Radix Conversion Given a value X represented in source system with radix  s, represent the same number in a destination system with radix  d Consider.
CENG536 Computer Engineering Department Çankaya University.
UNIVERSITY OF MASSACHUSETTS Dept
CHAPTER 4: Representing Integer Data The Architecture of Computer Hardware and Systems Software: An Information Technology Approach 3rd Edition, Irv Englander.
Assembly Language and Computer Architecture Using C++ and Java
Assembly Language and Computer Architecture Using C++ and Java
2-1 Computer Organization Part Fixed Point Numbers Using only two digits of precision for signed base 10 numbers, the range (interval between lowest.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Copyright 2008 Koren ECE666/Koren Part.6a.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Fixed-Point Negative Numbers Two Common Forms: 1.Signed-Magnitude Form 2.Complement Forms Signed-Magnitude Numbers First Digit is Sign Digit, Remaining.
3-1 Chapter 3 - Arithmetic Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer Architecture.
Dr. Bernard Chen Ph.D. University of Central Arkansas
Data Representation – Binary Numbers
General Fixed Radix Number Systems Nonredundant Positive radix, ß n digits in digit set Vector:
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.
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 1 Today’s Topics How information.
Logic and Digital System Design - CS 303
Part.7.1 Copyright 2007 Koren & Krishna, Morgan-Kaufman FAULT TOLERANT SYSTEMS Part 7 - Coding.
IT253: Computer Organization
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer.
Lecture Overview Introduction Positional Numbering System
Chapter 4 – Arithmetic Functions and HDLs Logic and Computer Design Fundamentals.
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.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
Reconfigurable Computing - Multipliers: Options in Circuit Design John Morris Chung-Ang University The University of Auckland ‘Iolanthe’ at 13 knots on.
Computer Arithmetic and the Arithmetic Unit Lesson 2 - Ioan Despi.
ECE 8053 Introduction to Computer Arithmetic (Website: Course & Text Content: Part 1: Number Representation.
Mohammad Reza Najafi Main Ref: Computer Arithmetic Algorithms and Hardware Designs (Behrooz Parhami) Spring 2010 Class presentation for the course: “Custom.
Topic 1 – Number Systems. What is a Number System? A number system consists of an ordered set of symbols (digits) with relations defined for addition,
Sep 29, 2004Subtraction (lvk)1 Negative Numbers and Subtraction The adders we designed can add only non-negative numbers – If we can represent negative.
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
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.
Unconventional Fixed-Radix Number Systems
Overview of Residue Number System (RNS) for Advanced VLSI Design and VLSI Signal Processing NTUEE 吳安宇.
Chapter 1: Binary Systems
IT1004: Data Representation and Organization Negative number representation.
Recursive Architectures for 2DLNS Multiplication RESEARCH CENTRE FOR INTEGRATED MICROSYSTEMS - UNIVERSITY OF WINDSOR 11 Recursive Architectures for 2DLNS.
Reconfigurable Computing - Options in Circuit Design John Morris Chung-Ang University The University of Auckland ‘Iolanthe’ at 13 knots on Cockburn Sound,
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,
DATA REPRESENTATION Data Types Complements Fixed Point Representations
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.
Binary Numbers The arithmetic used by computers differs in some ways from that used by people. Computers perform operations on numbers with finite and.
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.
Unit 1 Introduction Number Systems and Conversion.
Cosc 2150: Computer Organization
Chapter Contents 3.1 Overview 3.2 Fixed Point Addition and Subtraction
Binary Numbers The arithmetic used by computers differs in some ways from that used by people. Computers perform operations on numbers with finite and.
Digital Logic & Design Dr. Waseem Ikram Lecture 02.
UNIVERSITY OF MASSACHUSETTS Dept
Data Representation in Computer Systems
Overview of Residue Number System (RNS) for Advanced VLSI Design and VLSI Signal Processing NTUEE 吳安宇.
Chapter 3 Data Representation
CSE 575 Computer Arithmetic Spring 2003 Mary Jane Irwin (www. cse. psu
CHAPTER 4: Representing Integer Data
Brief Overview of Residue Number System (RNS)
King Fahd University of Petroleum and Minerals
Unconventional Fixed-Radix Number Systems
Data Representation in Computer Systems
Subtraction The arithmetic we did so far was limited to unsigned (positive) integers. Today we’ll consider negative numbers and subtraction. The main problem.
Digital Logic & Design Lecture 02.
UNIVERSITY OF MASSACHUSETTS Dept
Presentation transcript:

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 Wait for Worst-case Time Asynchronous (Self-Timed) Design 3.Speed-up Propagation Using Carry Lookahead and Other Methods Lookahead Carry-skip Ling Adder Carry-select Prefix Adders Conditional Sum 4.Eliminate Carry Propagation Altogether Redundant Number Systems Signed-Digit Representations

Residue Number Systems (RNS) Convert Arithmetic on Large Numbers to Arithmetic on Small Numbers Significant Speedup in Some Signal Processing Algorithms Valuable Tool for Theoretical Studies of the Limits of Fast Arithmetic

Residue Number Systems (RNS) Integer System Addition, Subtraction, Multiplication  Carry Free !!! Division, Comparison, Sign Detection  Complex and Slow Inconvenient For Fractional Representations Generally Used For Special Purpose Applications such as DSP Filters

Residue Number Systems (RNS) Radix is n-tuple of Integers (m n,m n-1,...,m 1 ) Not a Single Base Value Integer X Represented by n-tuple (x n,x n-1,...,x 1 ) q i is Largest Integer Such That: x i is the Residue of X mod m i

RNS Example Problem Chinese Scholar, Sun Tzu wrote (1500 years ago): What number has the remainders of 2, 3 and 2 when divided by the values 7, 5 and 3 respectively? NOTATION: Sun Tzu’s Problem:

Residue (Modulo) of a Number Many Examples in Chapter 4 of Text Use:

Moduli Selection Dynamic Range – Product of k Relatively Prime Moduli Product, M, is Number of Different Representable Values in the RNS DEFINITON m i and m j are Relatively Prime if gcd(m i,m j ) = 1 EXAMPLE m i = 4 and m j = 9, gcd(4,9) = 1 Although Neither 4 Nor 9 is Prime, They are Relatively Prime

RNS Representation Consider RNS(8|7|5|3) (our default RNS in this class) 840 Distinct Representable Values Since Can Represent Any Interval of 840 Consecutive Values

Example RNS Values RNS=(8|7|5|3)

RNS Example RNS=(8|7|5|3)

RNS Complementation Given RNS Representation of X, -X is Obtained by Complementing Each Digit. Zero Digits are unchanged. EXAMPLE CHECK

Chinese Remainder Theorem RNS can be viewed as a weighted system. EXAMPLE

RNS Encoding Efficiency Example Requires 11 Bits mod 8mod 7mod 5mod Different Values Represented 2 11 =2048 lg 2 (840)=9.714  =1.3 Bits Wasted

RNS Arithmetic Addition, Subtraction, Multiplication Can be Performed with Independent Operations on Each Digit Following Examples Show This Process For Subtraction, Can Complement the Number and Add Also

RNS Circuit Structure mod 8mod 7mod 5mod 3 mod-8 unit mod-7 unit mod-5 unit mod-3 unit

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 Range  M=30, –Insufficient Dynamic Range –Maximum Digit Width = 4 bits, Total = 17 bits RNS(17|13|11|7|5|3|2), Dynamic Range  M=510, – Dynamic Range 5.1 Times Too Large – Maximum Digit Width = 5 bits, Total = 22 bits Adding More Prime Moduli is Inefficient

Choosing RNS Moduli Remove m i =5 From RNS(17|13|11|7|5|3|2) RNS(17|13|11|7|3|2), Dynamic Range  M=102, Still Have Relatively Prime Moduli – Maximum Digit Width = 5 bits, Total = 19 bits – 1 5-bit, 2 4-bit, 1 3-bit, 1 2-bit and 1 1-bit Modulo Units Required Maximum Delay 5-bit Carry-Propagate Can Combine (3,7) and (2,13) Moduli With no Speed Penalty RNS(26|21|17|11), Dynamic Range  M=102, – Maximum Digit Width = 5 bits, Total = 19 bits – 3 5-bit and 1 4-bit Modulo Units Required

Relatively Prime Values Powers of Smaller Primes are Relatively Prime Example gcd(3 2, 2 2 ) = 1 But gcd(3 2,3) = 3 – Can REPLACE a Modulus With its Power – Try Use Sequence of SMALLEST Valued Moduli RNS(2 2 |3), Dynamic Range  M=12 10 RNS(3 2 |2 3 |7|5), Dynamic Range  M=2, RNS(11|3 2 |2 3 |7|5), Dynamic Range  M=27, RNS(13|11|3 2 |2 3 |7|5), Dynamic Range  M=360, – Maximum Digit Width = 4 bits, Total = 21 bits – Dynamic Range 3.6 times that Needed

Relatively Prime Values RNS(13|11|3 2 |2 3 |7|5), Dynamic Range  M=360, – Maximum Digit Width = 4 bits, Total = 21 bits – Dynamic Range 3.6 times that Needed Reduce the Above by Factor of 3 Replace 3 2 with 3 and Combine 3 and 5 to Get 15 RNS(15|13|11 |2 3 |7), Dynamic Range  M=120, – Maximum Digit Width = 4 bits, Total = 18 bits – Dynamic Range 1.2 times that Needed Using This Strategy Can Generally Find the “Best” Moduli in Terms of Speed and Representation Efficiency

Moduli Choice for Simple Arithmetic Unit Design Simple Units Also Lead to Speed and Cost Benefits Modulo-ADD,SUBTRACT, MULTIPLY Units Simple to Design if m i =2 ai or 2 ai -1 Power of 2 Moduli Lead to Simple Design – Standard a-bit Binary Adder – Example: Use 16 Instead of 13 – Exception in Case of Lookup Table Implementation Power of 2 a -1 Moduli Lead to Simple Design – Standard a-bit Binary Adder with End-around Carry – Referred to as “Low-cost” Moduli

RNS Low-Cost Moduli Theorem: A sufficient condition for 2 a -1 and 2 b -1 to be a relatively prime pair is that a and b are relatively prime. Any List of Relatively Prime Numbers: a k-2 >...>a 1 >a 0 Can be Used as a BASIS of k-modulus RNS: RNS(2 a k-2 |2 a k-2 -1|...|2 a 1 -1|2 a 0 -1) Widest Residues (Longest Carry-chain) is a k-2 -bit Values

Low-Cost Moduli Example Consider the Example From Earlier X=[0,100,000] Choosing the Moduli From Smallest to Largest: RNS(2 3 | | )Basis:3, 2M= RNS(2 4 | | )Basis:4, 3M= RNS(2 5 | | | )Basis:5, 3, 2M=20, RNS(2 5 | | | )Basis:5, 4, 3M=104, Can’t Include 2 and 4 in Same Basis Set, gcd(2,4)=2

Low-Cost Moduli Example RNS(2 5 | | | )Basis:5, 4, 3M=104, = RNS(32 | 31 | 15| 7) Requires =17 bits Requires 2 5-bit, 1 4-bit and 1 3-bit Module 4 RNS Digits Efficiency = (100,001/104,160)=  100% Comparing With Unrestricted Moduli: RNS(2 5 | | | )17 bits M=104, bit Carry-ripple but Simpler Circuit, Fewer Digits RNS( 15|13|11 |2 3 |7 )18 bits M=120, bit Carry-ripple, 1 Extra Digit

Encoding and Decoding Advantages of Alternative Number Systems Must Not be Outweighed By Conversions to/from the System Encoding From Fixed Positional System to RNSEasily Accomplished Using a Table- Lookup and Modulo Addition Circuits

Encoding with Lookup Table Conversion of Signed-Magnitude or 2’s Complement Accomplished by Converting Magnitude and Taking RNS Complement Consider the Following Identity: Idea is to Compute a Table of All Terms and Store in a Table for all i, j Then Add

Example Lookup Table Use Default RNS=(8|7|5|3) For m i =8 We Can Use 3 LSbs of Value

Example Encoding

RNS to Mixed-Radix Form CRT States That a Mixed-Radix Number System (MRS) is Associated with any RNS Solves comparison, sign detection, and overflow problems MRS is k-digit Weighted Positional Number System (m k-1 |m k-2 |...|m 2 |m 1 |m 0 ) MRS Weights are Products: (m k-2...m 2 m 1 m 0,...,m 2 m 1 m 0, m 1 m 0, m 0,1) MRS Digit Sets in Each of k Positions: [0, m k-1 -1],...,[0, m 2 -1],[0, m 1 -1],[0, m 0 -1] MRS Digits in Same Range as RNS Digits

RNS to MRS Example Example Position Weights MRS (8|7|5|3) (7)(5)(3)=105, (5)(3)=15, 3, 1 (0|3|1|0) MRS(8|7|5|3) =(0)(105)+(3)(15)+(1)(3)+(0)(1)=48 10 RNS to MRS Conversion Requires Finding the z i that Correspond to the y i in:

RNS to MRS Conversion From MRS Definition we Have: Easy to See that z 0 = y 0, Subtracting This Value From RNS and MRS Values Results in:

RNS to MRS Conversion (cont) Thus, if We Can Divide by m 0, We Have an Iterative Approach for Conversion Dividing y' (a Multiple of m 0 ) by m 0 is SCALING Easier Than Normal RNS Division Accomplished by Multiplying by Muliplicative Inverse of m 0 Next, Divide Both Representations by m 0 :

Multiplicative Inverses Multiplicative Inverse is a Value When Multiplied by Given Quantity Yields a Product of 1 Example Multiplicative Inverses of 3 Relative to m i =8, 7, 5: Thus, Multiplicative Inverses are 3, 5 and 2 Can Build a Lookup Table Circuit to Store Inverses

CRT LUT

Multiplicative Inverses Example Divide the Number Y' = (0|6|3|0) RNS by 3 Accomplish Through Multiplication by (3|5|2|-) RNS

RNS/MRS Conversion Example Convert Y=(0|6|3|0) RNS to MRS z 0 = y 0 = 0 Divide by 3 Now, We Have z 1 =1, Subtract by 1 and Divide by 5 This Gives z 2 = 3, Subtract by 3 and Divide by 7

RNS/MRS Conversion Example Thus Y=(0|6|3|0) RNS is (0|3|1|0) MRS Position Weights MRS (8|7|5|3) (7)(5)(3)=105, (5)(3)=15, 3, 1 So, Y=(0|6|3|0) RNS = (0|3|1|0) MRS = (48) 10

RNS/MRS Conversion Consider Conversion of (3|2|4|2) RNS from RNS(8|7|5|3) to Decimal Need to Determine Values of (1|0|0|0) RNS, (0|1|0|0) RNS, (0|0|1|0) RNS and (0|0|0|1) RNS

RNS/MRS Conversion From Definition of RNS, Positions with 0 are Multiples of RNS(8|7|5|3) and Position with 1 are m i =1

Chinese Remainder Theorem How Did We Find w 3 = (1|0|0|0) RNS = 105? Since Digits in 7, 5, 3 Places are 0, w 3 Must be a Multiple of (7)(5)(3)=105 Must Pick the Multiple of 105 Such That its Residue With Respect to 8 is 1 Accomplished by Multiplying 105 by its’ Multiplicative Inverse with Respect to 8 This Process is Formalized in Chinese Remainder Theorem

Chinese Remainder Theorem THEOREM: Chinese Remainder Theorem (CRT) The magnitude of an RNS number can be obtained from the CRT formula: where, by definition, M i = M/m i and  i = m i is the multiplicative inverse of M i with respect to m i.

Chinese Remainder Theorem Can Avoid Multiplications in Conversion Process by Storing mi > M in a Table Example Table Given on page 64 of Textbook (and also in slide 33)

Difficult RNS Operations Sign Test Magnitude Comparison Overflow Detection Generalized Division Suffices to discuss first three in context of being able to do magnitude comparison since they are essentially same if M is such that M=N+P+1 where the values represented are in interval [-N,P].

Difficult RNS Operations Sign Test same as Comparison with P Overflow Detection accomplished using Signs of Operands and Results Focus On: Magnitude Comparison Generalized Division

Magnitude Comparison Could Convert to Weighted Representation Using CRT  Too Complicated – too much Overhead  Use Approximate CRT Instead  Divide CRT Equality by M by Definition

Approximate CRT Addition of Terms is Modulo-1 All m i -1 mi Are in [0,1) Whole Part of Result Discarded and Fractional Part Kept Much Easier than CRT Modulo-M Addition m i -1 mi Can be Precomputed for all y and i Use Table Lookup Circuit and Fractional Adder (ignore carry-outs)

Approximate CRT LUT

Magnitude Comparison Example Use approximate CRT decoding to determine the larger of the two numbers. Reading the Values from the Tables: Thus, we conclude that:

Approximate CRT Error If Maximum Error in Approximate CRT Table is , then Approximate CRT Decoding Yields Scaled Value of RNS Number with Error No Greater than k  = > 4  = , so X > Y is Safe Previous Example Table Entries Rounded to 4 Digits Maximum Error in Each Entry is  = k = 4 Digits Error is 4  =

Redundant RNS Representations Do Not Have Restrict Digits in RNS to Set [0, m i -1] If [0,  i ] Where  i  m i Then RNS is Redundant Redundant RNS Simplifies Modular Reduction Step for Each Arithmetic Operation

Redundant RNS Example Consider mod-13 with [0,15] Redundant since: Addition Using Pseudo-redundancies Can be Done with Two 4-bit Adders 00 Ignore Cout XY SUM