Reflected Number Systems

Similar documents
MYcsvtu Notes DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes

Chapter 3: Number Systems and Codes. Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc.

Ms Sandhya Rani Dash UNIT 2: NUMBER SYSTEM AND CODES. 1.1 Introduction

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

Hybrid Electronics Laboratory

CMSC 2833 Lecture 18. Parity Add a bit to make the number of ones (1s) transmitted odd.

FAULT TOLERANT SYSTEMS

D I G I T A L C I R C U I T S E E

BINARY SYSTEM. Binary system is used in digital systems because it is:

Digital Fundamentals

Lecture 5: Graphs. Rajat Mittal. IIT Kanpur

MC302 GRAPH THEORY SOLUTIONS TO HOMEWORK #1 9/19/13 68 points + 6 extra credit points

Chapter 10 Error Detection and Correction. Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Review of Number Systems

Chapter 10 Error Detection and Correction 10.1

IMAGE COMPRESSION TECHNIQUES

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Algorithms For Inference Fall 2014

CS256 Applied Theory of Computation

in this web service Cambridge University Press

CHW 261: Logic Design

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666

Chapter 4 Arithmetic Functions

CHAPTER 2 Data Representation in Computer Systems

Ch. 7 Error Detection and Correction

mywbut.com GATE SOLVED PAPER - CS (A) 2 k (B) ( k+ (C) 3 logk 2 (D) 2 logk 3

CHAPTER 2 Data Representation in Computer Systems

We would like to find the value of the right-hand side of this equation. We know that

Data Representation and Binary Arithmetic. Lecture 2

Arithmetic Processing

Advanced Computer Networks. Rab Nawaz Jadoon DCS. Assistant Professor COMSATS University, Lahore Pakistan. Department of Computer Science

DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM

CS321. Introduction to Numerical Methods

Positional Number System

Chapter 2. Data Representation in Computer Systems

Digital Fundamentals

EE 8351 Digital Logic Circuits Ms. J.Jayaudhaya, ASP/EEE

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation

ENEE x Digital Logic Design. Lecture 3

Unit 7 Number System and Bases. 7.1 Number System. 7.2 Binary Numbers. 7.3 Adding and Subtracting Binary Numbers. 7.4 Multiplying Binary Numbers

World Inside a Computer is Binary

Digital Design. Verilo. and. Fundamentals. fit HDL. Joseph Cavanagh. CRC Press Taylor & Francis Group Boca Raton London New York

PART III. Data Link Layer MGH T MGH C I 204

Number Systems CHAPTER Positional Number Systems

DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes. Error Detection Codes

Floating Point Square Root under HUB Format

Announcement. (CSC-3501) Lecture 3 (22 Jan 2008) Today, 1 st homework will be uploaded at our class website. Seung-Jong Park (Jay)

Lecture 2: Number Systems

LOW-DENSITY PARITY-CHECK (LDPC) codes [1] can

1. Let n be a positive number. a. When we divide a decimal number, n, by 10, how are the numeral and the quotient related?

Digital Systems and Binary Numbers

CS101 Lecture 04: Binary Arithmetic

CHAPTER TWO. Data Representation ( M.MORRIS MANO COMPUTER SYSTEM ARCHITECTURE THIRD EDITION ) IN THIS CHAPTER

The Cartesian product of cycles C n1, C n2,, C ns, denoted C n1 C n2 C ns can be viewed as the Cayley graph of Abelian group Z n1 Z n2 Z ns

Read this before starting!

Error Detection. Hamming Codes 1

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

Carry-Free Radix-2 Subtractive Division Algorithm and Implementation of the Divider

Lecture 2 Error Detection & Correction. Types of Errors Detection Correction

DATA LINK LAYER UNIT 7.

Unit 10: Sorting/Searching/Recursion

A Novel Approach for Error Detection using Double Redundancy Check

COMPUTER ARITHMETIC (Part 1)

ARITHMETIC operations based on residue number systems

Achieving Reliable Digital Data Communication through Mathematical Algebraic Coding Techniques

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

Solutions to Homework 10

Chapter 1. Digital Systems and Binary Numbers

Output: For each size provided as input, a figure of that size is to appear, followed by a blank line.

More Programming Constructs -- Introduction

UNIT-II 1. Discuss the issues in the data link layer. Answer:

A Path Decomposition Approach for Computing Blocking Probabilities in Wavelength-Routing Networks

Data Partitioning. Figure 1-31: Communication Topologies. Regular Partitions

Inadmissible Class of Boolean Functions under Stuck-at Faults

CMPUT 396 Sliding Tile Puzzle

Advanced Computer Architecture-CS501

TEACHING & EXAMINATION SCHEME For the Examination COMPUTER SCIENCE. B.Sc. Part-I

R07. Code No: V0423. II B. Tech II Semester, Supplementary Examinations, April

CS321: Computer Networks Error Detection and Correction

15110 Principles of Computing, Carnegie Mellon University - CORTINA. Digital Data

[Ramalingam, 4(12): December 2017] ISSN DOI /zenodo Impact Factor

Mutations for Permutations

1KOd17RMoURxjn2 CSE 20 DISCRETE MATH Fall

Module 2: Computer Arithmetic

Decimal Binary Conversion Decimal Binary Place Value = 13 (Base 10) becomes = 1101 (Base 2).

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS

Digital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand

A Review of Various Adders for Fast ALU

SNAP Centre Workshop. Graphing Lines

Maximal Monochromatic Geodesics in an Antipodal Coloring of Hypercube

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition.

COPYRIGHTED MATERIAL. Number Systems. 1.1 Analogue Versus Digital

CSN Telecommunications. 5: Error Coding. Data, Audio, Video and Images Prof Bill Buchanan

1 Historical Notes. Kinematics 5: Quaternions

Operations, Operands, and Instructions

Linear programming II João Carlos Lourenço

Module 1: Information Representation I -- Number Systems

Right-to-Left or Left-to-Right Exponentiation?

Greedy Algorithms CHAPTER 16

CS254 Network Technologies. Lecture 2: Network Models & Error Detection and Correction. Dr Nikos Antonopoulos

[1] IEEE , Standard for Floating-Point Arithmetic [and Floating-Point formats]

Transcription:

Reflected Number Systems Anurag Acharya November, 1992 CMU-CS-92-209 School of Computer Science Carnegie Mellon University Pittsburgh, PA 15213 Abstract This paper introduces the class of reflected number systems. Members of this class have the adjacency property, i.e. representations for consecutive numbers differ in only one digit and the magnitude of this difference is one. It shows that every number system based on a positional weighting scheme has a reflected analogue. It presents procedures to convert a number system to its reflected analogue and vice versa. A conventional number system and its reflected analogue share some properties. Hence the conversion procedure can be used to design reflected number systems that are likely to have desired properties. This paper presents two examples.

Keywords: reflected number systems, Gray code, hamming distance, cyclic codes, positional weighting schemes, design of number systems

1 Introduction The hamming distance between representations of consecutive numbers in conventional number systems can be anywhere between 1 and n, where n is the width of the representation. Many algorithms and applications, such as encoding input/output quantities, genetic algorithms, graph embedding, hypercube algorithms including data distribution, emulation of other networks and processor allocation, signal transmission and library document ordering, require that the hamming distance between representations of consecutive numbers be exactly one. Gray code[3] is the best-known example of representations that satisfy this requirement (Such representations are called cyclic [3]) and has been widely used. Such representations are usually generated in an ad-hoc manner, as an arbitrary set of digit sequences. No cyclic number systems had been developed till recently when Acharya [1] and Irshid [2] independently provided a weighting scheme for the Gray code. The Gray code is a member of the class of reflected number systems. Members of this class possess the adjacency property, i.e representations for consecutive numbers differ in only one digit and the magnitude of this difference is one. This is a stronger version of the cyclic constraint which says the hamming distance between consecutive numbers should be exactly one. These number systems are called reflected because it is possible to generate representations for the set of n-digit numbers by reflecting the representations for the set of (n? 1)-digit numbers. Figure 1 shows three examples. The horizontal bars in the figure represent reflections. Section 2 describes reflected representations in greater detail and show that they cyclic constraint. It also shows that every conventional number system which represents numbers as a weighted sequence of digits has a reflected analogue. Section 3 describes weighting schemes for reflected representations. Section 4 describes the design of reflected number systems that are likely to have specific properties. It presents two examples for the properties division by powers of two is equivalent to right shifts and easy formation of additive inverse. 2 Reflected Representations A conventional number system that is based on a positional weighting scheme and a digit set D generates representations for numbers in its range by iterating over D for each position. Iteration for each position is performed in a standard order imposed on D. Iterations for different positions proceed at different rates, the rate for each position proceeds slower than that for the position to its right. The ratio of the rates at successive positions is equal to the jdj, i.e. the digit at position i is changed once after a complete iteration at position (i? 1). When one iteration is completed for a particular position, the next one begins with the same order on D. This procedure leads to hamming cliffs 1 between the number at the end of one iteration and the number at the beginning of the next one. Several examples of this are shown in Figure 2. In the figure, hamming cliffs are indicated by underlining. These hamming cliffs can be avoided if the order on D is reversed at the end of each iteration. Consider positions i and (i? 1). When an iteration ends at position (i? 1), the digit at that position is the last one in the current order. When the next iteration begins at position (i?1), 1 Hamming cliffs occur between sequences of digits that differ in more than one position. 1

Number Gray Ternary Signed-digit ternary 0 0000 00 11 1 0001 01 10 2 0011 02 11 3 0010 12 01 4 0110 11 00 5 0111 10 01 6 0101 20 11 7 0100 21 10 8 1100 22 11 9 1101 10 1111 11 1110 12 1010 13 1011 14 1001 15 1000 Figure 1: Examples of reflected number systems the digit at position i is replaced by the next digit in the current order for that position. As the order for position (i? 1) has been reversed, the digit at that position does not change. Hence, the digit sequences differ in only one position. Examples of this can be seen in Figure 1. Since the order of digits is reversed, or reflected, at the end of each iteration, such representations are called reflected representations. Reflected representations satisfy a stronger version of the cyclic constraint. Not only do the representations of consecutive numbers differ at only one position, but the magnitude of the difference between the digits at that position is exactly one. 2 Note that the procedure described in the previous paragraph provides algorithms to convert the representations of numbers in a conventional number system to their reflected counterparts and vice versa. Note also that it does not depend on the any particular parameter of the number system. The only assumption that has been made is that the conventional number system is based on a positional weighting scheme. There is no constraint on the weights themselves, the digits used in the representations or the width of the representations. As a result, the algorithms are applicable to all conventional number systems based on positional weighting schemes. This includes positive, negative and imaginary radix number systems, radix-complement number systems, number systems based on an arbitrary sequence of weights, number systems with standard and non-standard digit sets etc. An important class 2 To be more rigorous, the digits at that position are next to each other in the standard order on D. 2

Number Binary Representation 0 000 1 001 2 010 3 011 4 100 5 101 6 110 7 111 Figure 2: Hamming cliffs in 3-bit binary number system of number systems to which it is not applicable is the class of residue number systems the members of which are not based on positional weighting schemes. 3 Reflected Number Systems In a reflected representation, the order of the digits is reversed in each iteration. Therefore, the value of a sequence of digits depends on the number of reflections at each position (this is the same as the number of completed iterations of the D at that position). Since there are only two possible orders, the value actually depends only on the oddness of number of iterations at each position and not its magnitude. Consider the number N within the range of a reflected representation. Since the value of N can be represented as a summation of the value of the digits at individual positions, consider the value of the i th digit, x i. As discussed in the previous section, order for the i th digit is changed after every jdj i numbers. Therefore, The number of iterations at the i th position is equal to the value of (x n?1 ; x n?2 ; :::; x i+1). If this value is odd, then x i is from the standard order, else it is from the reversed order. A conventional number system can be characterized by the tuple (n; D; W n ), where n is the width of the representations, D is the set of digits used in the representations and W n is the sequence of weights, w i ; i 2 f0; :::; n? 1g. The value of a sequence P of digits, (x n?1 ; x n?2 ; :::; x 1 ; x n?1 0) in the number system is given by the formula X = j=0 x jw j Let d l ; l 2 f0; :::; k? 1g be the standard order on D. Then the conjugate order is defined as d c l ; l 2 f0; :::; k? 1g : dc l = d (k?1?l). The value of a sequence of digits in the reflected analogue of (n; D; W n ) is given by the formula: X = Xn?1 j=0 v j w j (1) v j = jx c j + c j x j (2) x c j = conjugate(x j ) (3) 3

j = odd(x n?1 ; x n?2 ; :::; x j+1) (4) n?1 = 0 (5) c j = 1? j (6) The conjugate of a digit d i in the standard order is the digit d c i in the conjugate order. j is the reflection parity of the j th position, i.e. the oddness of the number of iterations at the j th position. It can take the values 0 and 1. It can be recursively defined as: j = j+1 odd(x j+1 ) n?1 = 0 odd(x j+1 ) = odd(l) : x j+1 = d l The equation above means that the oddness of a digit is defined as the oddness of the position it occupies in the standard order. This allows the set of equations to hold for arbitrary digit sets. 4 Designing Reflected Number Systems A conventional number system and its reflected analogue share all the three parameters of the 3-tuple (n; D; W n ) that characterizes a number system based on positional weights. The difference is primarily in the sequence of digits that are used to represent particular numbers. As a result, they share those properties that do not depend on the sequence of digits used to represent particular numbers. Examples include aggregate properties like range, redundancy, completeness, largest number representable, smallest number representable etc. On the other hand, properties that depend on the sequence of digits used to represent particular number may or may not be shared depending on the details of the particular number system and the property. Examples of such properties include whether the oddness of the number can be determined by examining the last digit, whether division by powers of two is equivalent to right shifting, fast generation of additive inverse, multiple representations for zero, number of occurrences of a particular digit in the digit sequence etc. To design a reflected number system with a paricular property that does not depend on the digit sequences used for particular numbers, find a conventional number system which has this property and generate its reflected analogue. Design of reflected number systems with properties that depend on the digit sequences used for particular numbers has a generateand-test flavor since it may be necessary to find several conventional number systems with the particular property before finding one for which the property is preserved across the conversion. In fact, no such number system may exist. An example of such a property is equivalence of simple left shifts with multiplication with powers of two. No reflected number system can have this property because shifting the most significant bit out might change the reflection parity for all positions and the value of the least significant bit shifted in depends on the value of the number being shifted. Following subsections briefly illustrate the design of two reflected number systems. 4

Number Original Shifted 0 000 000 1 001 000 2 011 001 3 010 001 4 110 011 5 111 011 6 101 010 7 100 010 Figure 3: Right shifts on the 3-bit gray number system 4.1 The Gray Number System Suppose the property of interest is division by powers of two is equivalent to right shifting. A conventional number system for which this property holds is the binary number system. The reflected analogue of the binary number system is the gray number system. It can easily be shown that the gray number system has the desired property. Figure 3 provides an illustration. 4.2 The Reflected Two s Complement Number System Suppose the property of interest is easy generation of additive inverse. A conventional number system that has this property is the two s complement number system. The reflected analogue of the two s complement number system is the reflected two s complement number system. The following derivation shows that the desired property holds for it. To generate the additive inverse of a reflected two s complement number, complement the most significant bit and add one to the resulting number. In the following derivation, X c is the number generated by performing this procedure. X =?x n?12 n?1 + P n?2 j=0 ( jx c j + c j x j)2 j?x = x n?12 n?1? P n?2 j=0 ( jx c j + c j x j)2 j =?(1? x n?1)2 n?1 + 2 n?1? P n?2 j=0 ( jx c j + c j x j)2 j =?x c n?1 2n?1 + P n?2 j=0 2j + 1? P n?2 j=0 ( jx c j + c j x j)2 j =?x c n?1 2n?1 + P n?2 j=0 (1? ( jx c j + c j x j))2 j + 1 =?x c n?1 2n?1 + P n?2 j=0 (c j xc j + jx j ))2 j + 1 X c =?x c n?1 2n?1 + P n?2 j=0 (c j xc j + jx j ))2 j + 1 Note that complementing the most significant bit complements all the j. Figure 4 shows the 3-bit reflected two s complement number system. 5

Number Two s complement Reflected two s complement -4 100 110-3 101 111-2 110 101-1 111 100 0 000 000 1 001 001 2 010 011 3 011 010 References Figure 4: The 3-bit reflected two s complement number system [1] A. Acharya. Reflected number systems, Sept 1986. All India Student Paper Contest, IIT Kharagpur. [2] M. I. Irshid. Gray code weighting system. IEEE Transactions on Information Theory, 33(6):930 931, Nov 1987. [3] Z. Kohavi. Switching and Automata Theory. Tata McGraw-Hill, New Delhi, 1978. 6