The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers.    


Datasheet Search Engine   
 
Part # or Description: • 5V RS232 Driver • 2SC5066* • "Real Time Clock" • "USB connector" • "blue led" 5mm • 10 watt zener diode • 2N3055* motorola
 
Search Tip: Try entering the part number only. Include a wildcard (eg. lm317* or 1n4148*)

 

 

April 1997, ver. Introduction Binary numbering systems used


Datasheet Thumbnail

  

Download PDF



Top Searches for this datasheet



Binary Numbering Systems
April 1997, ver.
Introduction
Binary numbering systems used virtually digital systems, including digital signal processing (DSP), networking, computers. Before choose numbering system, important understand advantages disadvantages each system. This application note describes following numbering systems, advantages disadvantages each, convert between different systems.
Unsigned integer Two's complement integer Unsigned fractional Two's complement signed fractional Gray code Signed-magnitude Offset two's complement One's complement Floating point Block floating point
Table summarizes binary numbering systems described this application note. each numbering system, number range provided N-bit number. fractional numbering systems, number range provided M-bit number, where integer part number fractional part number.
Altera Corporation
A-AN-083-01
Binary Numbering Systems
Table Summary Binary Numbering Systems
System
Unsigned Integer
Number Range
Advantages
Universal numbering system. Easy perform arithmetic operations such addition subtraction.
Disadvantages
Cannot store negative numbers.
Two's Complement Integer Unsigned Fractional
-2(N
Stores both positive negative Requires extra storage numbers. Easy perform space when only positive arithmetic with regular adders. numbers necessary. Stores positive numbers greater Cannot store negative numbers. than less than Operations identical unsigned integer operations.
Two's Complement Signed Fractional Gray Code
-2(N Stores positive negative steps numbers both greater than less than Operations identical two's complement operations. Only changes between adjacent numbers, which facilitates interfaces with physical systems.
Difficult perform arithmetic operations without first converting systems listed above. Difficult perform arithmetic operations (although easier than with Gray code).
SignedMagnitude Offset Two's Complement
-2(N Useful applications that require magnitude distinct from sign. -2(N Used many analog-to-digital (A/D) digital-to-analog (D/A) converters. Easy perform arithmetic operations.
One's Complement Floating Point Block Floating Point
-2(N Easy perform negations. "Floating Point" page "Block Floating Point" page Very large dynamic range. Large dynamic range requires minimal hardware.
Difficult perform arithmetic operations other than negations. Requires more hardware perform arithmetic. numbers have same exponent given time.
Table shows 3-bit binary number equivalent decimal value each numbering system.
Altera Corporation
Binary Numbering Systems
Table Values 3-Bit Binary Number
Binary Number
Unsigned Integer
Two's Complement
Gray Code
Signed Magnitude
Offset Two's Complement
One's Complement
Unsigned Integer
best known numbering system unsigned integer representation. Like decimal numbering system, unsigned integers simple binary place value. position digit determines value (i.e., place value digit 2position). Figure This representation exactly like decimal numbering system, which place value 10position.
Figure Position
Binary Number Position Place Value
Table shows decimal value each 5-bit unsigned integer.
Table Unsigned Integer Values
Position
Place Value
Decimal Value
Altera Corporation
Binary Numbering Systems
Table shows determine decimal value unsigned integer.
Table Unsigned Integer Conversion
Unsigned Integer
01000 10011 11011
Decimal Value
Conversion
easily perform arithmetic operations unsigned numbers following same rules used decimal number operations. However, binary numbers, digit carried after rather than after (i.e., when added together, placed corresponding position carried next position). Figure shows unsigned integers together.
Figure Unsigned Integer Addition
unsigned integer numbering system widely used. This numbering system's main limitation that only store numbers ranging from most signal processing systems need store both positive negative numbers.
Two's Complement Integer
most commonly used numbering system that store both positive negative numbers two's complement integer. This system similar unsigned integers, except sign most significant (MSB) negated. example, N-bit number, value value value (i.e., MSB) value -2(N Table shows decimal value each position 5-bit two's complement integer.
Altera Corporation
Binary Numbering Systems
Table Two's Complement Integer Values 5-Bit Number
Position
(MSB)
Place Value
Decimal Value
Table shows determine decimal value two's complement number.
Table Two's Complement Integer Conversion
Two's Complement Integer
01000 11000 10000 10111
Decimal Value
Conversion
Two's complement integers represent numbers ranging from -2(N negate two's complement integer, simply invert bits example, following steps show negate number Substitute binary values decimal number: Invert bits: 01001 10110 (10110 10111
shown Table 10111 equal biggest advantage two's complement numbering system that adding subtracting two's complement numbers same adding subtracting unsigned numbers. However, sign extension must performed before operation carry adder should ignored. Figure shows 2-bit two's complement numbers.
Altera Corporation
Binary Numbering Systems
Figure Two's Complement Integer Addition
Positive Positive
Negative Positive
Negative Negative
Figure digits shaded blue represent bits used sign extension. blue digits carry 3-bit adder, which must ignored. Other than sign extension ignoring carry-out adder, addition two's complement numbers identical addition unsigned integer numbers.
Unsigned Fractional
other systems, often necessary store numbers that have both integer fractional component. Because some positions negative, unsigned fractional numbering system store numbers greater than less than place value digit unsigned fractional numbering system 2position, where position positive negative (see Figure Therefore, unsigned fractional numbering system superset unsigned integer numbering system.
Figure Position
Binary Number Position Place Value
Table shows decimal value each unsigned fractional number.
Table Unsigned Fractional Values
Position
Place Value
Decimal Value
0.25 0.50
Table shows determine decimal value unsigned fractional number.
Altera Corporation
Binary Numbering Systems
Table Unsigned Fractional Conversion
Unsigned Fractional Number
01001 11011 00010
Decimal Value
2.25 6.75
Conversion
0.25 2.25 0.25 6.75
Unsigned fractional numbers convenient notation keep track location radix point (i.e., binary decimal point); number with bits left radix point bits right said number (e.g., number digits left radix point digits right). numbers your system have same value (i.e., same fractional bit-width), arithmetic operations straightforward. example, number 12.3 number using 15-bit binary adder. Figure shows 00100101.101 (37.625) 001101110011.001 (883.125).
Figure Addition with Same Values
37.625 883.125 920.750 00100101.101 001101110011.001 001110011000.110
numbers with different values, must extra zeros keep radix points aligned. example, number number, must number with zeros create number. Thus, must 13-bit adder rather than 11-bit adder numbers. Figure shows 11011011.110 (219.750) 110111.11011 (55.84375).
Figure Addition with Different Values
Digits used padding highlighted blue.
219.75000 055.84375 275.59375 11011011.11000 00110111.11011 100010011.10101
Altera Corporation
Binary Numbering Systems
Other than aligning radix points, there difference between unsigned integer unsigned fractional numbering systems. fact, unsigned integer number simply unsigned fractional number (i.e., unsigned integer numbers have bits right radix point). hardware built integer numbers will work with fractional numbers.
Two's Complement Signed Fractional
Like unsigned fractional, two's complement signed fractional numbering system uses notation must have radix points aligned during arithmetic operations. Figure shows number number.
Figure Two's Complement Signed Fractional Addition
Digits used padding highlighted blue.
-36.25000 13.90625 -22.34375 111011011.11000 000001101.11101 100010011.10101
Again, numbers padded with zeros sign-extended obtain correct result.
Gray Code
Gray code numbering system that used mainly real-world sensing applications. fundamental feature Gray code that only changes time progress sequentially through numbers. Table
Table Gray Code Values
Gray Code Number
Decimal Value
Altera Corporation
Binary Numbering Systems
understand numbering system which only changes time useful, consider optical sensor shown Figure This sensor shaft encoder that gives physical position (i.e., rotation) shaft. simplicity, sensor shown with only 2-bit code. sensor light-emitting diodes (LEDs) photo detectors sensing position shaft. number bits represented wheel depends closely space cut-outs wheel without wheel becoming flimsy, diameter light beam, other physical parameters. Figure shows binary shaft encoder with signals:
Figure Straight Binary Shaft Encoder
Photo Detectors (00) (11) LEDs
(01)
(10)
Shaft
Figure shows ideal waveforms wheel cycles through full rotation.
Figure Ideal Waveforms
s[1.0]
contrast, real waveforms generated optical sensors vary slowly sensors always misaligned least small amount, which causes signals resemble waveforms shown Figure
Altera Corporation
Binary Numbering Systems
Figure Waveforms Caused Misaligned Sensors
s[1.0]
When optical sensors misaligned, switch same instant. Therefore, intervening codes appear sensed shaft position. Figure s[1.0] signal should have cycled through shaft position sequence However, actually cycles through sequence which incorrect. This error could catastrophic shaft encoder example, sensing rudder position airplane. fundamental problem with non-Gray code that more than changes when going from position another, such going from position (01) position (10). 2-bit Gray code, decimal sequence represented Notice that only changes between adjacent numbers, which prevents problems incurred with simultaneous switching misaligned sensors. Figure shows shaft encoder 2-bit Gray code.
Figure Shaft Encoder 2-Bit Gray Code
Photo Detectors (00) (10) LEDs
Shaft (01) (11)
When sensors this encoder misaligned, even significant amount, there extra codes sequence shown Figure
Altera Corporation
Binary Numbering Systems
Figure Gray Code Sequence with Significant Misalignment
s[1.0]
Unfortunately, difficult perform arithmetic Gray code numbers. easiest perform operations first converting numbers from Gray code either unsigned signed two's complement numbers after sensing. create longer Gray code sequences concatenating smaller sequence with reversed version same sequence, setting example, following steps show build 3-bit Gray code: first numbers, append 2-bit Gray code. last numbers, reverse order 2-bit Gray code append MSB.
This method ensures that only changes between adjacent numbers. Table
Table Creating Longer Gray Code Sequences
Decimal Value
2-Bit Gray Code
3-Bit Gray Code
SignedMagnitude
Signed-magnitude useful applications which sign magnitude number must accessed separately. signedmagnitude systems, represents sign number (i.e., positive, negative) other bits represent magnitude. This notation similar decimal notation, which uses sign uses remaining bits represent magnitude.
Altera Corporation
Binary Numbering Systems
signed-magnitude two's complement numbering systems both determine sign. However, confuse signedmagnitude with two's complement. Although used determine sign two's complement, other bits represent magnitude when sign negative. addition, two's complement only representation zero, whereas signed-magnitude numbering system (i.e., -0). perform complex arithmetic operations signed-magnitude data, usually easiest convert numbers two's complement, perform operations, then convert numbers back signedmagnitude system, required.
Offset Two's Complement
offset two's complement numbering system used many converters. distinguishing characteristic this numbering system that numbers move from monotonically count binary from 111-there jumps discontinuities. contrast, decimal value two's complement numbers goes from then counts from binary number progresses from 111. convert numbers from two's complement offset two's complement, simply invert MSB, shown Table
Table Converting Offset Two's Complement
Decimal Value
Two's Complement
Offset Two's Complement
One's Complement
one's complement numbering system seldom used because same drawbacks non-two's complement numbers-it difficult perform arithmetic representations zero (i.e., -0).
Altera Corporation
Binary Numbering Systems
When one's complement number inverse, answer zero, which creates inconsistent algebra. fact, Table page shows, representations zero 111, which makes zero sensing more difficult (i.e., must N-bit N-bit gate). negate number one's complement numbering system, simply invert bits (i.e., like two's complement).
Floating Point
previous numbering systems have common characteristic: they have relatively small dynamic range between largest smallest numbers they store. power dynamic range decibels (dB) previous numbering systems approximately 20log(2N), where total number bits numbering system. 8-bit number, dynamic range 48.1 16-bit number, dynamic range 96.3 many cases, need larger dynamic ranges. example, need large dynamic range perform simple physical calculation, such figuring mass grams) 1,000 atoms carbon. following equation used calculate mass carbon. where: Mass (grams) Number atoms 1,000 Atomic mass (grams/mole) 12.0107 Avogadro's number (1/mole) 6.022 1023
Calculating mass with fixed-point numbering system similar performing calculations without scientific notation. represent both Avogadro's number decimal places atomic mass accurate 0.0001 simultaneously, need decimal digits accuracy represent input operands, another digits represent result-a total decimal digits. perform same calculation binary, would require bits accuracy. illustrate, following calculation shows calculate mass with fixed-point arithmetic (all digits used illustrate fact that would similarly have keep track bits hardware):
Altera Corporation
Binary Numbering Systems
Obviously, 157-bit multiplier/divider would costly circuit. perform this calculation hand, scientific notation, shown below: 1.00000 1.20107 -1.99447 10-20 This method storing numbers easier numbers with differing magnitudes. scientific notation requires only digit left radix point, digits right (these digits known mantissa), along with extra digits exponent. This method requires multiplier/divider with only digits bits) accuracy. place values digits next radix point have extremely different magnitudes, which depend directly upon exponent. think this "floating" decimal point. Thus, scientific notation simply floating-point notation decimal calculations. perform this calculation digital systems, same concept mantissa exponent. mantissa fractional part number, exponent gives power which mantissa should multiplied. following example shows floating-point representation decimal number 3072. 3072.0 (decimal) 110000000000.0 (binary) 2-bit mantissa 4-bit exponent represent this number floating-point notation, shown below: (decimal) 21010 (binary) This notation requires only bits store number, opposed bits used fixed-point notation. floating-point format, radix point placed right most significant exponent adjusted accordingly. example, equation shown above represented 21011, rather than 21010. This format called normalized floating point. Because always left binary point normalized floating-point numbers, assumed stored, leaving extra storing mantissa exponent.
Altera Corporation
Binary Numbering Systems
example, number 3,072 stored directly concatenating mantissa exponent. With 2-bit mantissa 4-bit exponent, obtain 111011. Using normalized floating-point format obtain 101011 (again with bits mantissa, bits exponent).
variety floating-point formats available, each with various advantages disadvantages. more information other floatingpoint formats, Functional Specification (fp_add_sub Floating-Point Adder/Subtractor) Functional Specification (fp_mult Floating-Point Multiplier). block floating point numbering system used signal processing applications dealing with numbers that vary widely throughout calculation, such fast Fourier transform (FFT) function. example, data function come from 16-bit converter, which dynamic range processes data, numbers grow significantly throughout calculation. Because floating-point hardware more expensive than fixed-point hardware, many calculations performed with fixed-point hardware. floating-point hardware economically willing give dynamic range given data keep track magnitude entire data separately from each individual piece data. example, function start with points data, each with 16-bit value between -32,768 32,767. first pass through FFT, values range between -65,536 65,536, which requires extra precision. keep data 16-bits wide, divide points store register. This method requires only extra register keep data bits. This method called block floating point because radix point entire block data moves same time, which keeps radix points aligned with each other. true floating point, radix point every piece data different location. floating point numbering system should confused with block floating point numbering system. They dramatically different require different hardware computation.
Block Floating Point
more information FFTs, Fast Fourier Transform Data Sheet.
Altera Corporation
Binary Numbering Systems
2610 Orchard Parkway Jose, 95134-2020 (408) 544-7000 http://www.altera.com Applications Hotline: (800) 800-EPLD Customer Marketing: (408) 894-7104 Literature Services: (888) 3-ALTERA lit_req@altera.com
Altera trademark and/or service mark Altera Corporation United States other countries. Altera acknowledges trademarks other organizations their respective products services mentioned this document. Altera products protected under numerous U.S. foreign patents pending applications, maskwork rights, copyrights. Altera warrants performance semiconductor products current specifications accordance with Altera's standard warranty, reserves right make changes products services time without notice. Altera assumes responsibility liability arising application information, product, service described herein except expressly agreed writing Altera Corporation. Altera customers advised obtain latest version device specifications before relying published information before placing orders products services. Copyright 1997 Altera Corporation. rights reserved.
Printed Recycled Paper.
Altera Corporation

Other recent searches


SCHS146E - SCHS146E   SCHS146E Datasheet
PCM1727 - PCM1727   PCM1727 Datasheet
IDT74LVC162245A - IDT74LVC162245A   IDT74LVC162245A Datasheet
H5008 - H5008   H5008 Datasheet
ACT4454 - ACT4454   ACT4454 Datasheet
4460 - 4460   4460 Datasheet

 

Privacy Policy | Disclaimer
© 2012 Datasheet Archive