How To Set Bcd To A Register Computer
In computing and electronic systems, binary-coded decimal (BCD) is a class of binary encodings of decimal numbers where each digit is represented by a fixed number of bits, usually 4 or eight. Sometimes, special bit patterns are used for a sign or other indications (e.g. fault or overflow).
In byte-oriented systems (i.e. most modern computers), the term unpacked BCD[1] usually implies a full byte for each digit (oft including a sign), whereas packed BCD typically encodes two digits inside a single byte by taking reward of the fact that 4 $.25 are plenty to stand for the range 0 to 9. The precise 4-bit encoding, however, may vary for technical reasons (e.thousand. Excess-3).
The ten states representing a BCD digit are sometimes called tetrades [two] [3] (for the nibble typically needed to concord them is also known as a tetrade) while the unused, don't intendance-states are named pseudo-tetrad(e)southward
,[four] [5] [6] [7] [8] pseudo-decimals [iii] or pseudo-decimal digits.[9] [x] [nb one]BCD's master virtue, in comparing to binary positional systems, is its more authentic representation and rounding of decimal quantities, too equally its ease of conversion into conventional human-readable representations. Its principal drawbacks are a slight increase in the complication of the circuits needed to implement basic arithmetic equally well as slightly less dense storage.
BCD was used in many early decimal computers, and is implemented in the instruction set of machines such as the IBM System/360 series and its descendants, Digital Equipment Corporation's VAX, the Burroughs B1700, and the Motorola 68000-series processors. BCD per se is non equally widely used as in the past, and is unavailable or express in newer didactics sets (e.g., ARM; x86 in long mode). Even so, decimal fixed-indicate and floating-point formats are still important and continue to be used in financial, commercial, and industrial calculating, where the subtle conversion and fractional rounding errors that are inherent in floating point binary representations cannot be tolerated.[11]
Background [edit]
BCD takes advantage of the fact that any 1 decimal numeral tin be represented past a four-bit design. The near obvious mode of encoding digits is Natural BCD (NBCD), where each decimal digit is represented by its corresponding four-bit binary value, every bit shown in the post-obit tabular array. This is also called "8421" encoding.
Decimal digit | BCD | |||
---|---|---|---|---|
8 | 4 | 2 | one | |
0 | 0 | 0 | 0 | 0 |
1 | 0 | 0 | 0 | i |
ii | 0 | 0 | 1 | 0 |
3 | 0 | 0 | 1 | ane |
4 | 0 | one | 0 | 0 |
v | 0 | 1 | 0 | 1 |
6 | 0 | 1 | 1 | 0 |
7 | 0 | one | one | 1 |
8 | 1 | 0 | 0 | 0 |
9 | one | 0 | 0 | 1 |
This scheme tin can as well be referred to equally Unproblematic Binary-Coded Decimal (SBCD) or BCD 8421, and is the near common encoding.[12] Others include the so-called "4221" and "7421" encoding – named after the weighting used for the $.25 – and "Backlog-3".[thirteen] For example, the BCD digit half dozen, 0110'b
in 8421 notation, is 1100'b
in 4221 (two encodings are possible), 0110'b
in 7421, while in Excess-3 it is 1001'b
( ).
Fleck | Weight | 0 | 1 | ii | three | iv | 5 | vi | 7 | 8 | 9 | x | 11 | 12 | thirteen | 14 | 15 | Comment |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | viii | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | ane | ane | 1 | 1 | Binary |
three | 4 | 0 | 0 | 0 | 0 | ane | 1 | 1 | 1 | 0 | 0 | 0 | 0 | i | i | ane | one | |
ii | 2 | 0 | 0 | 1 | 1 | 0 | 0 | one | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | |
one | ane | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | ane | 0 | i | 0 | i | 0 | ane | |
Proper noun | 0 | 1 | two | 3 | 4 | 5 | 6 | vii | viii | ix | x | xi | 12 | 13 | xiv | 15 | Decimal | |
8 4 2 ane (XS-0) | 0 | 1 | two | iii | 4 | 5 | vi | 7 | 8 | 9 | 10 | 11 | 12 | xiii | xiv | 15 | [14] [15] [16] [17] [nb 2] | |
7 iv two 1 | 0 | one | 2 | 3 | 4 | 5 | 6 | vii | 8 | 9 | [18] [nineteen] [20] | |||||||
Aiken (two 4 2 one) | 0 | 1 | 2 | 3 | 4 | 5 | vi | seven | 8 | 9 | [14] [15] [16] [17] [nb 3] | |||||||
Backlog-three (XS-3) | -three | -two | -1 | 0 | 1 | two | 3 | 4 | 5 | half-dozen | 7 | 8 | ix | 10 | 11 | 12 | [14] [15] [16] [17] [nb two] | |
Excess-6 (XS-6) | -vi | -5 | -four | -3 | -2 | -i | 0 | i | 2 | 3 | 4 | 5 | 6 | seven | eight | nine | [18] [nb two] | |
Jump-at-2 (2 4 ii 1) | 0 | 1 | 2 | 3 | 4 | 5 | six | 7 | 8 | 9 | [16] [17] | |||||||
Jump-at-viii (2 4 2 1) | 0 | i | 2 | 3 | four | 5 | 6 | seven | 8 | 9 | [21] [22] [16] [17] [nb iv] | |||||||
four two ii one (I) | 0 | 1 | 2 | 3 | iv | 5 | vi | 7 | 8 | ix | [16] [17] | |||||||
4 2 2 1 (2) | 0 | 1 | ii | three | iv | five | 6 | seven | 8 | 9 | [21] [22] | |||||||
5 4 2 1 | 0 | 1 | ii | iii | iv | 5 | six | vii | viii | nine | [18] [14] [16] [17] | |||||||
5 2 2 ane | 0 | 1 | 2 | iii | 4 | 5 | half dozen | 7 | 8 | 9 | [xiv] [sixteen] [17] | |||||||
5 1 2 1 | 0 | 1 | two | 3 | 4 | v | vi | vii | viii | ix | [xix] | |||||||
v three 1 i | 0 | one | 2 | 3 | 4 | v | 6 | 7 | 8 | nine | [16] [17] | |||||||
White (five 2 1 i) | 0 | one | 2 | three | iv | v | 6 | 7 | 8 | 9 | [23] [18] [14] [16] [17] | |||||||
v 2 1 1 | 0 | i | 2 | 3 | 4 | v | half-dozen | vii | viii | 9 | [24] | |||||||
0 | ane | 2 | 3 | 4 | five | 6 | 7 | viii | ix | 10 | 11 | 12 | xiii | 14 | xv | |||
Magnetic tape | 1 | 2 | iii | 4 | 5 | 6 | vii | 8 | ix | 0 | [15] | |||||||
Paul | 1 | 3 | 2 | 6 | 7 | 5 | 4 | 0 | viii | 9 | [25] | |||||||
Gray | 0 | 1 | 3 | two | 7 | six | 4 | 5 | xv | 14 | 12 | thirteen | 8 | 9 | 11 | 10 | [26] [14] [15] [sixteen] [17] [nb 2] | |
Glixon | 0 | ane | 3 | ii | 6 | vii | v | 4 | 9 | 8 | [27] [14] [xv] [xvi] [17] | |||||||
Ledley | 0 | 1 | 3 | two | 7 | 6 | 4 | 5 | 8 | 9 | [28] | |||||||
4 three 1 1 | 0 | i | 2 | 3 | v | 4 | six | 7 | 8 | 9 | [xix] | |||||||
LARC | 0 | 1 | 2 | 4 | 3 | 5 | 6 | 7 | 9 | 8 | [29] | |||||||
Klar | 0 | 1 | 2 | 4 | 3 | ix | 8 | 7 | 5 | 6 | [2] [three] | |||||||
Petherick (RAE) | 1 | 3 | 2 | 0 | 4 | 8 | 6 | seven | nine | five | [thirty] [31] [nb 5] | |||||||
O'Brien I (Watts) | 0 | 1 | iii | two | 4 | nine | 8 | 6 | seven | 5 | [32] [14] [xvi] [17] [nb 6] | |||||||
5-circadian | 0 | ane | 3 | two | 4 | 5 | 6 | 8 | 7 | 9 | [28] | |||||||
Tompkins I | 0 | one | 3 | ii | 4 | ix | viii | 7 | 5 | six | [33] [14] [sixteen] [17] | |||||||
Lippel | 0 | 1 | 2 | 3 | 4 | 9 | 8 | 7 | 6 | five | [34] [35] [14] | |||||||
O'Brien Ii | 0 | 2 | 1 | 4 | three | nine | 7 | eight | 5 | six | [32] [14] [16] [17] | |||||||
Tompkins Ii | 0 | 1 | 4 | 3 | 2 | vii | 9 | 8 | 5 | half-dozen | [33] [14] [16] [17] | |||||||
Excess-3 Gray | -3 | -2 | 0 | -1 | 4 | three | 1 | 2 | 12 | xi | 9 | ten | 5 | vi | 8 | 7 | [16] [17] [20] [nb 7] [nb ii] | |
6 3 −2 −1 (I) | 3 | ii | one | 0 | v | 4 | eight | 9 | vii | vi | [29] [36] | |||||||
half dozen iii −2 −one (2) | 0 | iii | 2 | 1 | vi | 5 | 4 | 9 | 8 | 7 | [29] [36] | |||||||
8 4 −ii −one | 0 | 4 | 3 | 2 | ane | eight | 7 | 6 | 5 | nine | [29] | |||||||
Lucal | 0 | fifteen | 14 | 1 | 12 | three | ii | xiii | 8 | 7 | 6 | ix | 4 | 11 | 10 | 5 | [37] | |
Kautz I | 0 | 2 | 5 | 1 | iii | 7 | ix | 8 | 6 | iv | [eighteen] | |||||||
Kautz Two | 9 | 4 | 1 | 3 | 2 | 8 | 6 | 7 | 0 | 5 | [xviii] [14] | |||||||
Susskind I | 0 | 1 | four | three | two | 9 | eight | v | 6 | 7 | [35] | |||||||
Susskind 2 | 0 | 1 | 9 | viii | 4 | 3 | 2 | five | half-dozen | 7 | [35] | |||||||
0 | 1 | ii | iii | four | 5 | 6 | 7 | eight | 9 | x | eleven | 12 | 13 | xiv | 15 |
The post-obit table represents decimal digits from 0 to 9 in various BCD encoding systems. In the headers, the "8fourtwo1
" indicates the weight of each bit. In the fifth column ("BCD 84−ii−1"), two of the weights are negative. Both ASCII and EBCDIC character codes for the digits, which are examples of zoned BCD, are also shown.
Digit | BCD viiiiv21 | Stibitz lawmaking or Excess-3 | Aiken-Lawmaking or BCD 2fourtwoone | BCD viii4−ii−i | IBM 702, IBM 705, IBM 7080, IBM 1401 eight421 | ASCII 0000 8421 | EBCDIC 0000 8421 |
---|---|---|---|---|---|---|---|
0 | 0000 | 0011 | 0000 | 0000 | 1010 | 0011 0000 | 1111 0000 |
1 | 0001 | 0100 | 0001 | 0111 | 0001 | 0011 0001 | 1111 0001 |
2 | 0010 | 0101 | 0010 | 0110 | 0010 | 0011 0010 | 1111 0010 |
iii | 0011 | 0110 | 0011 | 0101 | 0011 | 0011 0011 | 1111 0011 |
4 | 0100 | 0111 | 0100 | 0100 | 0100 | 0011 0100 | 1111 0100 |
5 | 0101 | yard | 1011 | 1011 | 0101 | 0011 0101 | 1111 0101 |
half-dozen | 0110 | 1001 | 1100 | 1010 | 0110 | 0011 0110 | 1111 0110 |
7 | 0111 | 1010 | 1101 | 1001 | 0111 | 0011 0111 | 1111 0111 |
viii | 1000 | 1011 | 1110 | g | 1000 | 0011 chiliad | 1111 thousand |
ix | 1001 | 1100 | 1111 | 1111 | 1001 | 0011 1001 | 1111 1001 |
As most computers deal with data in eight-flake bytes, it is possible to use one of the following methods to encode a BCD number:
- Unpacked: Each decimal digit is encoded into 1 byte, with four bits representing the number and the remaining bits having no significance.
- Packed: Two decimal digits are encoded into a single byte, with one digit in the least significant crumb ($.25 0 through iii) and the other numeral in the most significant nibble (bits 4 through 7).[nb 8]
Equally an example, encoding the decimal number 91
using unpacked BCD results in the post-obit binary blueprint of two bytes:
Decimal: 9 1 Binary : 0000 1001 0000 0001
In packed BCD, the same number would fit into a single byte:
Decimal: 9 1 Binary: 1001 0001
Hence the numerical range for one unpacked BCD byte is naught through ix inclusive, whereas the range for one packed BCD byte is goose egg through ninety-nine inclusive.
To represent numbers larger than the range of a unmarried byte any number of face-to-face bytes may be used. For example, to correspond the decimal number 12345
in packed BCD, using large-endian format, a plan would encode every bit follows:
Decimal: 0 ane ii 3 4 five Binary : 0000 0001 0010 0011 0100 0101
Here, the most significant nibble of the almost significant byte has been encoded every bit zero, so the number is stored as 012345
(but formatting routines might replace or remove leading zeros). Packed BCD is more efficient in storage usage than unpacked BCD; encoding the aforementioned number (with the leading zippo) in unpacked format would swallow twice the storage.
Shifting and masking operations are used to pack or unpack a packed BCD digit. Other bitwise operations are used to convert a numeral to its equivalent bit pattern or reverse the procedure.
Packed BCD [edit]
In packed BCD (or but packed decimal [38]), each of the ii nibbles of each byte represent a decimal digit.[nb viii] Packed BCD has been in employ since at least the 1960s and is implemented in all IBM mainframe hardware since then. Most implementations are big endian, i.e. with the more than meaning digit in the upper half of each byte, and with the leftmost byte (residing at the lowest memory address) containing the most significant digits of the packed decimal value. The lower crumb of the rightmost byte is normally used as the sign flag, although some unsigned representations lack a sign flag. As an case, a 4-byte value consists of 8 nibbles, wherein the upper 7 nibbles shop the digits of a 7-digit decimal value, and the lowest nibble indicates the sign of the decimal integer value.
Standard sign values are 1100 (hex C) for positive (+) and 1101 (D) for negative (−). This convention comes from the zone field for EBCDIC characters and the signed overpunch representation. Other allowed signs are 1010 (A) and 1110 (Eastward) for positive and 1011 (B) for negative. IBM System/360 processors will use the 1010 (A) and 1011 (B) signs if the A bit is set in the PSW, for the ASCII-8 standard that never passed. Most implementations as well provide unsigned BCD values with a sign crumb of 1111 (F).[39] [forty] [41] ILE RPG uses 1111 (F) for positive and 1101 (D) for negative.[42] These match the EBCDIC zone for digits without a sign overpunch. In packed BCD, the number 127 is represented by 0001 0010 0111 1100 (127C) and −127 is represented by 0001 0010 0111 1101 (127D). Burroughs systems used 1101 (D) for negative, and whatever other value is considered a positive sign value (the processors will normalize a positive sign to 1100 (C)).
Sign digit | BCD 8 iv two 1 | Sign | Notes |
---|---|---|---|
A | 1 0 ane 0 | + | |
B | ane 0 one 1 | − | |
C | 1 1 0 0 | + | Preferred |
D | i 1 0 1 | − | Preferred |
E | ane 1 1 0 | + | |
F | 1 one 1 1 | + | Unsigned |
No matter how many bytes wide a word is, there is always an even number of nibbles because each byte has two of them. Therefore, a discussion of n bytes can contain up to (2northward)−1 decimal digits, which is always an odd number of digits. A decimal number with d digits requires i / ii (d+1) bytes of storage infinite.
For case, a 4-byte (32-bit) word can agree seven decimal digits plus a sign and tin represent values ranging from ±nine,999,999. Thus the number −1,234,567 is 7 digits wide and is encoded equally:
0001 0010 0011 0100 0101 0110 0111 1101 one 2 3 4 v 6 7 −
Like graphic symbol strings, the first byte of the packed decimal – that with the most significant two digits – is usually stored in the everyman accost in retention, independent of the endianness of the machine.
In contrast, a 4-byte binary two's complement integer can correspond values from −2,147,483,648 to +2,147,483,647.
While packed BCD does not make optimal use of storage (using almost xx% more memory than binary notation to store the same numbers), conversion to ASCII, EBCDIC, or the various encodings of Unicode is fabricated trivial, as no arithmetics operations are required. The extra storage requirements are usually offset by the demand for the accurateness and compatibility with calculator or hand adding that fixed-point decimal arithmetic provides. Denser packings of BCD exist which avert the storage penalisation and besides need no arithmetics operations for common conversions.
Packed BCD is supported in the COBOL programming linguistic communication equally the "COMPUTATIONAL-3" (an IBM extension adopted by many other compiler vendors) or "PACKED-DECIMAL" (role of the 1985 COBOL standard) information type. It is supported in PL/I as "Fixed DECIMAL". Beside the IBM System/360 and later compatible mainframes, packed BCD is implemented in the native didactics set of the original VAX processors from Digital Equipment Corporation and some models of the SDS Sigma series mainframes, and is the native format for the Burroughs Corporation Medium Systems line of mainframes (descended from the 1950s Electrodata 200 series).
X's complement representations for negative numbers offer an alternative arroyo to encoding the sign of packed (and other) BCD numbers. In this case, positive numbers always accept a most significant digit between 0 and 4 (inclusive), while negative numbers are represented by the 10's complement of the respective positive number. As a result, this system allows for 32-bit packed BCD numbers to range from −fifty,000,000 to +49,999,999, and −1 is represented as 99999999. (As with two's complement binary numbers, the range is not symmetric well-nigh zero.)
Fixed-point packed decimal [edit]
Stock-still-point decimal numbers are supported by some programming languages (such every bit COBOL and PL/I). These languages allow the developer to specify an implicit decimal point in front end of one of the digits. For example, a packed decimal value encoded with the bytes 12 34 56 7C represents the fixed-point value +1,234.567 when the implied decimal point is located between the 4th and 5th digits:
12 34 56 7C 12 34.56 7+
The decimal point is not actually stored in retentiveness, as the packed BCD storage format does not provide for it. Its location is merely known to the compiler, and the generated lawmaking acts accordingly for the diverse arithmetic operations.
Higher-density encodings [edit]
If a decimal digit requires four bits, and so three decimal digits require 12 bits. However, since 2x (one,024) is greater than 103 (1,000), if three decimal digits are encoded together, merely ten $.25 are needed. Two such encodings are Chen–Ho encoding and densely packed decimal (DPD). The latter has the advantage that subsets of the encoding encode two digits in the optimal seven bits and 1 digit in iv bits, as in regular BCD.
Zoned decimal [edit]
Some implementations, for example IBM mainframe systems, back up zoned decimal numeric representations. Each decimal digit is stored in ane byte, with the lower four bits encoding the digit in BCD class. The upper four bits, called the "zone" bits, are commonly set to a stock-still value so that the byte holds a character value corresponding to the digit. EBCDIC systems utilise a zone value of 1111 (hex F); this yields bytes in the range F0 to F9 (hex), which are the EBCDIC codes for the characters "0" through "nine". Similarly, ASCII systems employ a zone value of 0011 (hex three), giving graphic symbol codes 30 to 39 (hex).
For signed zoned decimal values, the rightmost (to the lowest degree significant) zone nibble holds the sign digit, which is the same set of values that are used for signed packed decimal numbers (see above). Thus a zoned decimal value encoded as the hex bytes F1 F2 D3 represents the signed decimal value −123:
F1 F2 D3 1 2 −3
EBCDIC zoned decimal conversion tabular array [edit]
BCD digit | Hexadecimal | EBCDIC grapheme | ||||||
---|---|---|---|---|---|---|---|---|
0+ | C0 | A0 | E0 | F0 | { (*) | \ (*) | 0 | |
1+ | C1 | A1 | E1 | F1 | A | ~ (*) | 1 | |
2+ | C2 | A2 | E2 | F2 | B | due south | S | 2 |
iii+ | C3 | A3 | E3 | F3 | C | t | T | 3 |
4+ | C4 | A4 | E4 | F4 | D | u | U | iv |
five+ | C5 | A5 | E5 | F5 | E | v | V | 5 |
half dozen+ | C6 | A6 | E6 | F6 | F | w | Due west | six |
7+ | C7 | A7 | E7 | F7 | G | x | Ten | 7 |
8+ | C8 | A8 | E8 | F8 | H | y | Y | 8 |
9+ | C9 | A9 | E9 | F9 | I | z | Z | nine |
0− | D0 | B0 | } (*) | ^ (*) | ||||
one− | D1 | B1 | J | |||||
two− | D2 | B2 | Yard | |||||
iii− | D3 | B3 | L | |||||
4− | D4 | B4 | Grand | |||||
5− | D5 | B5 | N | |||||
6− | D6 | B6 | O | |||||
seven− | D7 | B7 | P | |||||
eight− | D8 | B8 | Q | |||||
nine− | D9 | B9 | R |
(*) Note: These characters vary depending on the local character code page setting.
Fixed-bespeak zoned decimal [edit]
Some languages (such as COBOL and PL/I) direct support fixed-point zoned decimal values, assigning an implicit decimal indicate at some location betwixt the decimal digits of a number. For example, given a six-byte signed zoned decimal value with an unsaid decimal point to the right of the fourth digit, the hex bytes F1 F2 F7 F9 F5 C0 represent the value +1,279.fifty:
F1 F2 F7 F9 F5 C0 i ii 7 nine. 5 +0
BCD in computers [edit]
IBM [edit]
IBM used the terms Binary-Coded Decimal Interchange Code (BCDIC, sometimes just chosen BCD), for 6-bit alphanumeric codes that represented numbers, upper-instance letters and special characters. Some variation of BCDIC alphamerics is used in nearly early IBM computers, including the IBM 1620 (introduced in 1959), IBM 1400 series, and non-Decimal Architecture members of the IBM 700/7000 serial.
The IBM 1400 series are grapheme-addressable machines, each location being six bits labeled B, A, viii, 4, ii and 1, plus an odd parity check scrap (C) and a word mark bit (Grand). For encoding digits 1 through 9, B and A are zero and the digit value represented by standard 4-flake BCD in bits viii through 1. For most other characters $.25 B and A are derived simply from the "12", "xi", and "0" "zone punches" in the punched card character code, and $.25 8 through ane from the 1 through 9 punches. A "12 zone" punch set both B and A, an "xi zone" set B, and a "0 zone" (a 0 punch combined with whatsoever others) set A. Thus the letter A, which is (12,ane) in the punched card format, is encoded (B,A,1). The currency symbol $, (11,eight,iii) in the punched bill of fare, was encoded in memory every bit (B,viii,2,one). This allows the circuitry to catechumen between the punched card format and the internal storage format to be very unproblematic with merely a few special cases. One important special case is digit 0, represented past a lone 0 punch in the card, and (viii,2) in core memory.[43]
The memory of the IBM 1620 is organized into 6-bit addressable digits, the usual eight, 4, two, i plus F, used as a flag bit and C, an odd parity check flake. BCD alphamerics are encoded using digit pairs, with the "zone" in the even-addressed digit and the "digit" in the odd-addressed digit, the "zone" being related to the 12, 11, and 0 "zone punches" as in the 1400 series. Input/Output translation hardware converted betwixt the internal digit pairs and the external standard 6-bit BCD codes.
In the Decimal Architecture IBM 7070, IBM 7072, and IBM 7074 alphamerics are encoded using digit pairs (using two-out-of-five code in the digits, non BCD) of the 10-digit word, with the "zone" in the left digit and the "digit" in the right digit. Input/Output translation hardware converted between the internal digit pairs and the external standard six-chip BCD codes.
With the introduction of System/360, IBM expanded vi-fleck BCD alphamerics to eight-bit EBCDIC, allowing the addition of many more characters (east.g., lowercase letters). A variable length Packed BCD numeric data type is likewise implemented, providing machine instructions that perform arithmetic directly on packed decimal information.
On the IBM 1130 and 1800, packed BCD is supported in software past IBM's Commercial Subroutine Parcel.
Today, BCD information is still heavily used in IBM processors and databases, such as IBM DB2, mainframes, and Power6. In these products, the BCD is commonly zoned BCD (as in EBCDIC or ASCII), Packed BCD (two decimal digits per byte), or "pure" BCD encoding (one decimal digit stored equally BCD in the low iv $.25 of each byte). All of these are used inside hardware registers and processing units, and in software. To catechumen packed decimals in EBCDIC table unloads to readable numbers, you lot can utilise the OUTREC FIELDS mask of the JCL utility DFSORT.[44]
Other computers [edit]
The Digital Equipment Corporation VAX-11 series includes instructions that can perform arithmetic directly on packed BCD data and convert between packed BCD data and other integer representations.[41] The VAX's packed BCD format is compatible with that on IBM Organization/360 and IBM'southward after compatible processors. The MicroVAX and later VAX implementations dropped this ability from the CPU simply retained lawmaking compatibility with earlier machines by implementing the missing instructions in an operating arrangement-supplied software library. This is invoked automatically via exception treatment when the defunct instructions are encountered, and so that programs using them can execute without modification on the newer machines.
The Intel x86 architecture supports a unique 18-digit (10-byte) BCD format that can be loaded into and stored from the floating point registers, from where computations tin be performed.[45]
The Motorola 68000 series had BCD instructions.[46]
In more recent computers such capabilities are most ever implemented in software rather than the CPU'south instruction set, but BCD numeric data are however extremely common in commercial and fiscal applications. There are tricks for implementing packed BCD and zoned decimal add together–or–subtract operations using short but difficult to sympathise sequences of word-parallel logic and binary arithmetics operations.[47] For example, the following code (written in C) computes an unsigned 8-digit packed BCD add-on using 32-bit binary operations:
uint32_t BCDadd ( uint32_t a , uint32_t b ) { uint32_t t1 , t2 ; // unsigned 32-bit intermediate values t1 = a + 0x06666666 ; t2 = t1 ^ b ; // sum without behave propagation t1 = t1 + b ; // provisional sum t2 = t1 ^ t2 ; // all the binary carry bits t2 = ~ t2 & 0x11111110 ; // just the BCD acquit $.25 t2 = ( t2 >> 2 ) | ( t2 >> 3 ); // correction return t1 - t2 ; // corrected BCD sum }
BCD in electronics [edit]
BCD is very common in electronic systems where a numeric value is to be displayed, peculiarly in systems consisting solely of digital logic, and not containing a microprocessor. By employing BCD, the manipulation of numerical data for display can exist greatly simplified by treating each digit every bit a separate single sub-circuit. This matches much more closely the physical reality of display hardware—a designer might cull to employ a serial of separate identical seven-segment displays to build a metering circuit, for example. If the numeric quantity were stored and manipulated equally pure binary, interfacing with such a brandish would crave complex circuitry. Therefore, in cases where the calculations are relatively unproblematic, working throughout with BCD tin can pb to an overall simpler organisation than converting to and from binary. Well-nigh pocket calculators do all their calculations in BCD.
The same argument applies when hardware of this type uses an embedded microcontroller or other small processor. Ofttimes, representing numbers internally in BCD format results in smaller code, since a conversion from or to binary representation can exist expensive on such limited processors. For these applications, some small processors characteristic dedicated arithmetic modes, which assist when writing routines that manipulate BCD quantities.[48] [49]
Operations with BCD [edit]
Improver [edit]
It is possible to perform addition by first adding in binary, and then converting to BCD afterwards. Conversion of the uncomplicated sum of two digits can be done by adding half-dozen (that is, 16 − 10) when the five-bit effect of calculation a pair of digits has a value greater than 9. The reason for adding 6 is that there are sixteen possible 4-bit BCD values (since two4 = 16), but only 10 values are valid (0000 through 1001). For example:
1001 + 1000 = 10001 ix + 8 = 17
10001 is the binary, not decimal, representation of the desired result, but the virtually pregnant 1 (the "behave") cannot fit in a 4-bit binary number. In BCD as in decimal, there cannot exist a value greater than 9 (1001) per digit. To correct this, 6 (0110) is added to the total, and then the consequence is treated as two nibbles:
10001 + 0110 = 00010111 => 0001 0111 17 + 6 = 23 1 7
The two nibbles of the result, 0001 and 0111, correspond to the digits "ane" and "7". This yields "17" in BCD, which is the right result.
This technique can be extended to calculation multiple digits past adding in groups from right to left, propagating the second digit as a comport, e'er comparing the 5-bit result of each digit-pair sum to 9. Some CPUs provide a one-half-deport flag to facilitate BCD arithmetic adjustments following binary addition and subtraction operations. The Intel 8080, the Zilog Z80[50] and the CPUs of the x86 family unit[51] provide the opcode DAA (Decimal Adjust Accumulator).
Subtraction [edit]
Subtraction is washed by calculation the ten'due south complement of the subtrahend to the minuend. To represent the sign of a number in BCD, the number 0000 is used to represent a positive number, and 1001 is used to stand for a negative number. The remaining fourteen combinations are invalid signs. To illustrate signed BCD subtraction, consider the following problem: 357 − 432.
In signed BCD, 357 is 0000 0011 0101 0111. The ten'southward complement of 432 tin be obtained by taking the nine's complement of 432, and and so adding one. So, 999 − 432 = 567, and 567 + 1 = 568. By preceding 568 in BCD by the negative sign code, the number −432 tin be represented. Then, −432 in signed BCD is 1001 0101 0110 g.
Now that both numbers are represented in signed BCD, they can be added together:
0000 0011 0101 0111 0 three v 7 + 1001 0101 0110 thou 9 5 six eight = 1001 k 1011 1111 9 8 xi 15
Since BCD is a grade of decimal representation, several of the digit sums to a higher place are invalid. In the event that an invalid entry (any BCD digit greater than 1001) exists, 6 is added to generate a carry fleck and cause the sum to become a valid entry. So, adding 6 to the invalid entries results in the following:
1001 m 1011 1111 9 eight 11 15 + 0000 0000 0110 0110 0 0 6 6 = 1001 1001 0010 0101 9 9 two five
Thus the consequence of the subtraction is 1001 1001 0010 0101 (−925). To confirm the result, notation that the first digit is nine, which ways negative. This seems to be correct since 357 − 432 should result in a negative number. The remaining nibbles are BCD, so 1001 0010 0101 is 925. The ten'due south complement of 925 is 1000 − 925 = 75, then the calculated respond is −75.
If there are a dissimilar number of nibbles existence added together (such as 1053 − 2), the number with the fewer digits must first exist prefixed with zeros before taking the 10'due south complement or subtracting. So, with 1053 − 2, 2 would have to first exist represented every bit 0002 in BCD, and the x's complement of 0002 would have to be calculated.
Comparison with pure binary [edit]
Advantages [edit]
- Many non-integral values, such as decimal 0.two, have an infinite identify-value representation in binary (.001100110011...) merely take a finite place-value in binary-coded decimal (0.0010). Consequently, a system based on binary-coded decimal representations of decimal fractions avoids errors representing and computing such values. This is useful in financial calculations.
- Scaling by a ability of 10 is uncomplicated.
- Rounding at a decimal digit boundary is simpler. Improver and subtraction in decimal do not require rounding.[ dubious ]
- The alignment of ii decimal numbers (for example 1.three + 27.08) is a unproblematic, exact shift.
- Conversion to a graphic symbol form or for display (e.g., to a text-based format such as XML, or to drive signals for a 7-segment display) is a uncomplicated per-digit mapping, and can be washed in linear (O(n)) time. Conversion from pure binary involves relatively complex logic that spans digits, and for big numbers, no linear-time conversion algorithm is known (come across Binary numeral arrangement § Conversion to and from other numeral systems).
Disadvantages [edit]
- Some operations are more complex to implement. Adders require extra logic to cause them to wrap and generate a carry early on. 15 to 20 per cent more than circuitry is needed for BCD add together compared to pure binary.[ citation needed ] Multiplication requires the use of algorithms that are somewhat more complex than shift-mask-add (a binary multiplication, requiring binary shifts and adds or the equivalent, per-digit or group of digits is required).
- Standard BCD requires four bits per digit, roughly 20 per cent more space than a binary encoding (the ratio of 4 bits to logtwo10 bits is 1.204). When packed so that three digits are encoded in ten bits, the storage overhead is greatly reduced, at the expense of an encoding that is unaligned with the viii-bit byte boundaries mutual on existing hardware, resulting in slower implementations on these systems.
- Applied existing implementations of BCD are typically slower than operations on binary representations, especially on embedded systems, due to express processor support for native BCD operations.[52]
Representational variations [edit]
Various BCD implementations exist that use other representations for numbers. Programmable calculators manufactured past Texas Instruments, Hewlett-Packard, and others typically employ a floating-point BCD format, typically with two or three digits for the (decimal) exponent. The actress bits of the sign digit may be used to indicate special numeric values, such as infinity, underflow/overflow, and error (a blinking display).
Signed variations [edit]
Signed decimal values may be represented in several ways. The COBOL programming linguistic communication, for instance, supports 5 zoned decimal formats, with each one encoding the numeric sign in a unlike way:
Type | Clarification | Example |
---|---|---|
Unsigned | No sign nibble | F1 F2 F3 |
Signed abaft (canonical format) | Sign nibble in the last (least significant) byte | F1 F2 C3 |
Signed leading (overpunch) | Sign nibble in the first (almost significant) byte | C1 F2 F3 |
Signed abaft separate | Split sign character byte ('+' or '−' ) post-obit the digit bytes | F1 F2 F3 2B |
Signed leading split up | Separate sign graphic symbol byte ('+' or '−' ) preceding the digit bytes | 2B F1 F2 F3 |
Telephony binary-coded decimal (TBCD) [edit]
3GPP developed TBCD,[53] an expansion to BCD where the remaining (unused) fleck combinations are used to add specific telephony characters,[54] [55] with digits similar to those found in telephone keypads original design.
Decimal digit | TBCD viii 4 two 1 |
---|---|
* | 1 0 one 0 |
# | i 0 i ane |
a | 1 ane 0 0 |
b | 1 1 0 one |
c | 1 1 i 0 |
Used as filler when in that location is an odd number of digits | 1 1 i 1 |
The mentioned 3GPP certificate defines TBCD-STRING with swapped nibbles in each byte. Bits, octets and digits indexed from 1, bits from the right, digits and octets from the left.
bits 8765 of octet north encoding digit 2northward
bits 4321 of octet due north encoding digit 2(n – one) + 1
Meaning number 1234
, would become 21 43
in TBCD.
Culling encodings [edit]
If errors in representation and computation are more important than the speed of conversion to and from display, a scaled binary representation may be used, which stores a decimal number as a binary-encoded integer and a binary-encoded signed decimal exponent. For instance, 0.2 can be represented as 2×10 −1 .
This representation allows rapid multiplication and partitioning, but may require shifting by a power of x during addition and subtraction to align the decimal points. It is appropriate for applications with a fixed number of decimal places that practice non then require this adjustment—specially financial applications where ii or iv digits later the decimal point are usually enough. Indeed, this is almost a course of fixed indicate arithmetic since the position of the radix betoken is unsaid.
The Hertz and Chen–Ho encodings provide Boolean transformations for converting groups of three BCD-encoded digits to and from 10-bit values[nb 1] that can be efficiently encoded in hardware with simply two or 3 gate delays. Densely packed decimal (DPD) is a similar scheme[nb 1] that is used for most of the significand, except the atomic number 82 digit, for one of the two alternative decimal encodings specified in the IEEE 754-2008 floating-point standard.
Application [edit]
The BIOS in many personal computers stores the date and fourth dimension in BCD because the MC6818 real-time clock bit used in the original IBM PC AT motherboard provided the time encoded in BCD. This grade is easily converted into ASCII for display.[56] [57]
The Atari 8-bit family unit of computers used BCD to implement floating-point algorithms. The MOS 6502 processor has a BCD fashion that affects the addition and subtraction instructions. The Psion Organiser 1 handheld estimator's manufacturer-supplied software likewise entirely used BCD to implement floating point; later Psion models used binary exclusively.
Early models of the PlayStation 3 store the appointment and fourth dimension in BCD. This led to a worldwide outage of the console on i March 2010. The concluding two digits of the year stored as BCD were misinterpreted as xvi causing an error in the unit'due south date, rendering most functions inoperable. This has been referred to as the Year 2010 problem.
Legal history [edit]
In the 1972 instance Gottschalk v. Benson, the U.S. Supreme Court overturned a lower court's determination that had allowed a patent for converting BCD-encoded numbers to binary on a computer. The decision noted that a patent "would wholly pre-empt the mathematical formula and in applied effect would be a patent on the algorithm itself".[58] This was a landmark sentence that determining the patentability of software and algorithms.
See also [edit]
- Bi-quinary coded decimal
- Binary-coded ternary (BCT)
- Binary integer decimal (BID)
- Bitmask
- Chen–Ho encoding
- Decimal computer
- Densely packed decimal (DPD)
- Double fiddle, an algorithm for converting binary numbers to BCD
- Twelvemonth 2000 trouble
Notes [edit]
- ^ a b c In a standard packed 4-bit representation, at that place are 16 states (four bits for each digit) with x tetrades and half-dozen pseudo-tetrades, whereas in more than densely packed schemes such as Hertz, Chen–Ho or DPD encodings at that place are fewer—due east.grand., but 24 unused states in 1024 states (10 bits for three digits).
- ^ a b c d e Code states (shown in blackness) outside the decimal range 0–9 signal boosted states of the non-BCD variant of the code. In the BCD lawmaking variant discussed hither, they are pseudo-tetrades.
- ^ The Aiken code is ane of several 2 four 2 1 codes. It is also known as 2* four ii ane code.
- ^ The Jump-at-8 code is also known as unsymmetrical 2 4 two 1 code.
- ^ The Petherick code is too known as Majestic Aircraft Institution (RAE) code.
- ^ The O'Brien code blazon I is also known every bit Watts code or Watts reflected decimal (WRD) code.
- ^ The Backlog-iii Gray code is also known as Gray–Stibitz lawmaking.
- ^ a b In a similar fashion, multiple characters were oft packed into car words on minicomputers, see IBM SQUOZE and DEC RADIX 50.
References [edit]
- ^ Intel. "ia32 compages manual" (PDF). Intel. Retrieved 2015-07-01 .
- ^ a b Klar, Rainer (1970-02-01). "i.five.3 Konvertierung binär verschlĂĽsselter Dezimalzahlen" [ane.v.iii Conversion of binary coded decimal numbers]. Digitale Rechenautomaten – Eine EinfĂĽhrung [Digital Computers – An Introduction]. Sammlung Göschen (in German). Vol. 1241/1241a (1 ed.). Berlin, Germany: Walter de Gruyter & Co. / G. J. Göschen'sche Verlagsbuchhandlung. Retrieved 2020-04-thirteen . (205 pages) (NB. A 2019 reprint of the get-go edition is available nether ISBN 3-11002793-3, 978-three-11002793-viii. A reworked and expanded 4th edition exists too.) . pp. 17, 21. ISBNthree-11-083160-0. . Archiv-Nr. 7990709. Archived from the original on 2020-04-18
- ^ a b c Klar, Rainer (1989) [1988-10-01]. "1.4 Codes: Binär verschlĂĽsselte Dezimalzahlen" [1.4 Codes: Binary coded decimal numbers]. Digitale Rechenautomaten – Eine EinfĂĽhrung in die Struktur von Computerhardware [Digital Computers – An Introduction into the construction of calculator hardware]. Sammlung Göschen (in High german). Vol. 2050 (4th reworked ed.). Berlin, Germany: Walter de Gruyter & Co. pp. 25, 28, 38–39. ISBNthree-11011700-two. p. 25:
[…] Die nicht erlaubten 0/one-Muster nennt man auch Pseudodezimalen. […]
(320 pages) - ^ Schneider, Hans-Jochen (1986). Lexikon der Informatik und Datenverarbeitung (in German) (2 ed.). R. Oldenbourg Verlag MĂĽnchen Wien. ISBN3-486-22662-2.
- ^ Tafel, Hans Jörg (1971). Einführung in die digitale Datenverarbeitung [Introduction to digital information processing] (in German). Munich: Carl Hanser Verlag. ISBNiii-446-10569-vii.
- ^ Steinbuch, Karl Due west.; Weber, Wolfgang; Heinemann, Traute, eds. (1974) [1967]. Taschenbuch der Informatik - Band II - Struktur und Programmierung von EDV-Systemen. Taschenbuch der Nachrichtenverarbeitung (in German). Vol. 2 (3 ed.). Berlin, Deutschland: Springer-Verlag. ISBNthree-540-06241-6. LCCN 73-80607.
- ^ Tietze, Ulrich; Schenk, Christoph (2012-12-06). Avant-garde Electronic Circuits. Springer Science & Business Media. ISBN978-3642812415. 9783642812415. Retrieved 2015-08-05 .
- ^ Kowalski, Emil (2013-03-08) [1970]. Nuclear Electronics. Springer-Verlag. doi:10.1007/978-3-642-87663-9. ISBN978-3642876639. 9783642876639, 978-iii-642-87664-half dozen. Retrieved 2015-08-05 .
- ^ Ferretti, Vittorio (2013-03-13). Wörterbuch der Elektronik, Datentechnik und Telekommunikation / Dictionary of Electronics, Computing and Telecommunications: Teil 1: Deutsch-Englisch / Function 1: German-English. Vol. 1 (ii ed.). Springer-Verlag. ISBN978-3642980886. 9783642980886. Retrieved 2015-08-05 .
- ^ Speiser, Ambrosius Paul (1965) [1961]. Digitale Rechenanlagen - Grundlagen / Schaltungstechnik / Arbeitsweise / Betriebssicherheit [Digital computers - Basics / Circuits / Operation / Reliability] (in German language) (ii ed.). ETH ZĂĽrich, ZĂĽrich, Switzerland: Springer-Verlag / IBM. p. 209. LCCN 65-14624. 0978.
- ^ Cowlishaw, Mike F. (2015) [1981, 2008]. "General Decimal Arithmetics". Retrieved 2016-01-02 .
- ^ Evans, David Silvester (March 1961). "Chapter Four: Ancillary Equipment: Output-drive and parity-check relays for digitizers". Digital Data: Their derivation and reduction for analysis and process command (1 ed.). London, UK: Hilger & Watts Ltd / Interscience Publishers. pp. 46–64 [56–57]. Retrieved 2020-05-24 . (8+82 pages) (NB. The 4-scrap 8421 BCD code with an extra parity bit applied as to the lowest degree meaning bit to achieve odd parity of the resulting 5-chip code is also known equally Ferranti code.)
- ^ Lala, Parag K. (2007). Principles of Mod Digital Blueprint. John Wiley & Sons. pp. 20–25. ISBN978-0-470-07296-7.
- ^ a b c d east f g h i j k fifty m n Berger, Erich R. (1962). "1.iii.3. Die Codierung von Zahlen". Written at Karlsruhe, Deutschland. In Steinbuch, Karl Westward. (ed.). Taschenbuch der Nachrichtenverarbeitung (in German) (1 ed.). Berlin / Göttingen / New York: Springer-Verlag OHG. pp. 68–75. LCCN 62-14511. (NB. The shown Kautz code (II), containing all eight available binary states with an odd count of 1s, is a slight modification of the original Kautz code (I), containing all viii states with an even count of 1s, so that inversion of the most-pregnant bits volition create a 9s complement.)
- ^ a b c d e f Kämmerer, Wilhelm (May 1969). "II.15. Struktur: Informationsdarstellung im Automaten". Written at Jena, Germany. In FrĂĽhauf, Hans; Kämmerer, Wilhelm; Schröder, Kurz; Winkler, Helmut (eds.). Digitale Automaten – Theorie, Struktur, Technik, Programmieren. Elektronisches Rechnen und Regeln (in German). Vol. 5 (one ed.). Berlin, Frg: Akademie-Verlag GmbH. p. 161. License no. 202-100/416/69. Guild no. 4666 ES 20 K 3. (NB. A second edition 1973 exists besides.)
- ^ a b c d e f k h i j one thousand l m n o p q Dokter, Folkert; Steinhauer, JĂĽrgen (1973-06-18). Digital Electronics. Philips Technical Library (PTL) / Macmillan Educational activity (Reprint of 1st English ed.). Eindhoven, Netherlands: The Macmillan Press Ltd. / N. 5. Philips' Gloeilampenfabrieken. doi:x.1007/978-i-349-01417-0. ISBN978-i-349-01419-iv. SBN333-13360-9 . Retrieved 2020-05-11 . (270 pages) (NB. This is based on a translation of book I of the 2-volume High german edition.)
- ^ a b c d e f g h i j k l g n o p q Dokter, Folkert; Steinhauer, JĂĽrgen (1975) [1969]. Digitale Elektronik in der MeĂźtechnik und Datenverarbeitung: Theoretische Grundlagen und Schaltungstechnik. Philips FachbĂĽcher (in German). Vol. I (improved and extended 5th ed.). Hamburg, Germany: Deutsche Philips GmbH. p. 50. ISBN3-87145-272-half dozen. (xii+327+3 pages) (NB. The German edition of volume I was published in 1969, 1971, two editions in 1972, and 1975. Volume Ii was published in 1970, 1972, 1973, and 1975.)
- ^ a b c d e f Kautz, William H. (June 1954). "Four. Examples A. Binary Codes for Decimals, n = four". Optimized Data Encoding for Digital Computers. Convention Record of the I.R.E., 1954 National Convention, Part 4 - Electronic Computers and Information Theory. Session 19: Information Theory 3 - Speed and Ciphering. Stanford Enquiry Establish, Stanford, California, The states: I.R.East. pp. 47–57 [49, 51–52, 57]. Archived from the original on 2020-07-03. Retrieved 2020-07-03 . p. 52:
[…] The final cavalcade [of Table Two], labeled "Best," gives the maximum fraction possible with any code—namely 0.60—half again better than whatever conventional lawmaking. This extremal is reached with the ten [heavily-marked vertices of the graph of Fig. 4 for north = 4, or, in fact, with whatsoever fix of ten lawmaking combinations which include all eight with an even (or all eight with an odd) number of "1'southward." The second and 3rd rows of Table 2 list the average and tiptop decimal alter per undetected unmarried binary error, and accept been derived using the equations of Sec. II for Δ1 and δ1. The confusion index for decimals using the criterion of "decimal change," is taken to be cij = |i − j| i,j = 0, 1, … 9. Again, the "Best" organisation possible (the same for average and peak), 1 of which is shown in Fig. four, is substantially amend than the conventional codes. […] Fig. 4 Minimum-confusion code for decimals. […] δ1=2 Δ1=15 […]
[ane] [2] [iii] [4] [5] [6] [7] [8] [nine] [10] [xi] (eleven pages) (NB. Besides the combinatorial set of 4-fleck BCD "minimum-defoliation codes for decimals", of which the author illustrates only one explicitly (here reproduced as code I) in form of a iv-bit graph, the author besides shows a 16-state 4-bit "binary code for analog data" in form of a code table, which, however, is not discussed here. The lawmaking Two shown here is a modification of code I discussed by Berger.) - ^ a b c Chinal, Jean P. (January 1973). "3.3. Unit Distance Codes". Written at Paris, France. Blueprint Methods for Digital Systems. Translated past Preston, Alan; Summer, Arthur (1st English language ed.). Berlin, Deutschland: Akademie-Verlag / Springer-Verlag. p. 46. doi:ten.1007/978-3-642-86187-1_3. ISBN978-0-387-05871-9. License No. 202-100/542/73. Order No. 7617470(6047) ES nineteen B 1 / 20 Thousand 3. Retrieved 2020-06-21 . (eighteen+506 pages) (NB. The French 1967 original book was named "Techniques Booléennes et Calculateurs Arithmétiques", published by Éditions Dunod .)
- ^ a b Armed forces Handbook: Encoders - Shaft Bending To Digital (PDF). United States Department of Defense. 1991-09-30. MIL-HDBK-231A. Archived (PDF) from the original on 2020-07-25. Retrieved 2020-07-25 . (NB. Supersedes MIL-HDBK-231(AS) (1970-07-01).)
- ^ a b Stopper, Herbert (March 1960). Written at Litzelstetten, Germany. Runge, Wilhelm TolmĂ© (ed.). "Ermittlung des Codes und der logischen Schaltung einer Zähldekade". Telefunken-Zeitung (TZ) - Technisch-Wissenschaftliche Mitteilungen der Telefunken GMBH (in German). Berlin, Frg: Telefunken. 33 (127): xiii–19. (7 pages)
- ^ a b Borucki, Lorenz; Dittmann, Joachim (1971) [July 1970, 1966, Autumn 1965]. "2.3 Gebräuchliche Codes in der digitalen MeĂźtechnik". Written at Krefeld / Karlsruhe, Federal republic of germany. Digitale MeĂźtechnik: Eine EinfĂĽhrung (in German language) (ii ed.). Berlin / Heidelberg, Germany: Springer-Verlag. pp. 10–23 [12–14]. doi:ten.1007/978-3-642-80560-viii. ISBNiii-540-05058-two. LCCN 75-131547. ISBN 978-3-642-80561-five. (viii+252 pages) 1st edition
- ^ White, Garland South. (October 1953). "Coded Decimal Number Systems for Digital Computers". Proceedings of the Constitute of Radio Engineers. Institute of Radio Engineers (IRE). 41 (ten): 1450–1452. doi:x.1109/JRPROC.1953.274330. eISSN 2162-6634. ISSN 0096-8390. S2CID 51674710. (3 pages)
- ^ "Different Types of Binary Codes". Electronic Hub. 2019-05-01 [2015-01-28]. Section two.4 5211 Code. Archived from the original on 2017-eleven-14. Retrieved 2020-08-04 .
- ^ Paul, Matthias R. (1995-08-10) [1994]. "Unterbrechungsfreier Schleifencode" [Continuous loop code]. 1.02 (in German). Retrieved 2008-02-11 . (NB. The author called this code Schleifencode (English: "loop code"). It differs from Gray BCD code just in the encoding of state 0 to arrive a cyclic unit-distance code for total-circumvolve rotatory applications. Avoiding the all-zero code pattern allows for loop self-testing and to use the information lines for uninterrupted power distribution.)
- ^ Gray, Frank (1953-03-17) [1947-11-13]. Pulse Code Communication (PDF). New York, USA: Bell Phone Laboratories, Incorporated. U.S. Patent ii,632,058. Serial No. 785697. Archived (PDF) from the original on 2020-08-05. Retrieved 2020-08-05 . (13 pages)
- ^ Glixon, Harry Robert (March 1957). "Tin can Yous Have Advantage of the Cyclic Binary-Decimal Lawmaking?". Control Engineering. Technical Publishing Company, a division of Dun-Donnelley Publishing Corporation, Dun & Bradstreet Corp. iv (iii): 87–91. ISSN 0010-8049. (5 pages)
- ^ a b Ledley, Robert Steven; Rotolo, Louis S.; Wilson, James Bruce (1960). "Part 4. Logical Design of Digital-Computer Circuitry; Chapter xv. Serial Arithmetics Operations; Chapter 15-7. Boosted Topics". Digital Reckoner and Command Engineering (PDF). McGraw-Colina Electrical and Electronic Engineering Serial (1 ed.). New York, USA: McGraw-Loma Volume Company, Inc. (printer: The Maple Press Company, York, Pennsylvania, USA). pp. 517–518. ISBN0-07036981-X. ISSN 2574-7916. LCCN 59015055. OCLC 1033638267. OL 5776493M. SBN07036981-10. . ark:/13960/t72v3b312. Archived (PDF) from the original on 2021-02-nineteen. Retrieved 2021-02-19 . p. 517:
[…] The cyclic lawmaking is advantageous mainly in the utilize of relay circuits, for so a glutinous relay will non give a false state as information technology is delayed in going from ane cyclic number to the next. There are many other circadian codes that take this belongings. […]
[12] (xxiv+835+ane pages) (NB. Ledley classified the described cyclic code every bit a cyclic decimal-coded binary code.) - ^ a b c d Savard, John J. G. (2018) [2006]. "Decimal Representations". quadibloc. Archived from the original on 2018-07-16. Retrieved 2018-07-sixteen .
- ^ Petherick, Edward John (October 1953). A Cyclic Progressive Binary-coded-decimal System of Representing Numbers (Technical Note MS15). Farnborough, Uk: Royal Aircraft Establishment (RAE). (4 pages) (NB. Sometimes referred to every bit A Circadian-Coded Binary-Coded-Decimal System of Representing Numbers.)
- ^ Petherick, Edward John; Hopkins, A. J. (1958). Some Recently Developed Digital Devices for Encoding the Rotations of Shafts (Technical Notation MS21). Farnborough, UK: Royal Shipping Institution (RAE).
- ^ a b O'Brien, Joseph A. (May 1956) [1955-11-15, 1955-06-23]. "Cyclic Decimal Codes for Analogue to Digital Converters". Transactions of the American Institute of Electric Engineers, Part I: Communication and Electronics. Bong Telephone Laboratories, Whippany, New Jersey, USA. 75 (2): 120–122. doi:10.1109/TCE.1956.6372498. ISSN 0097-2452. S2CID 51657314. Newspaper 56-21. Retrieved 2020-05-xviii . (3 pages) (NB. This paper was prepared for presentation at the AIEE Winter General Meeting, New York, USA, 1956-01-30 to 1956-02-03.)
- ^ a b Tompkins, Howard Due east. (September 1956) [1956-07-16]. "Unit-Distance Binary-Decimal Codes for Two-Track Exchange". IRE Transactions on Electronic Computers. Correspondence. Moore School of Electric Engineering, Academy of Pennsylvania, Philadelphia, Pennsylvania, Usa. EC-5 (three): 139. doi:10.1109/TEC.1956.5219934. ISSN 0367-9950. Retrieved 2020-05-18 . (1 page)
- ^ Lippel, Bernhard (December 1955). "A Decimal Code for Analog-to-Digital Conversion". IRE Transactions on Electronic Computers. EC-4 (4): 158–159. doi:10.1109/TEC.1955.5219487. ISSN 0367-9950. (2 pages)
- ^ a b c Susskind, Alfred Kriss; Ward, John Erwin (1958-03-28) [1957, 1956]. "3.F. Unit-Distance Codes / 6.E.two. Reflected Binary Codes". Written at Cambridge, Massachusetts, United states of america. In Susskind, Alfred Kriss (ed.). Notes on Analog-Digital Conversion Techniques. Technology Books in Science and Engineering science. Vol. 1 (three ed.). New York, USA: Engineering science Press of the Massachusetts Institute of Technology / John Wiley & Sons, Inc. / Chapman & Hall, Ltd. pp. 3-vii–iii-8 [3-7], 3-10–3-16 [3-13–iii-xvi], 6-65–6-threescore [6-60]. (x+416+2 pages) (NB. The contents of the book was originally prepared by staff members of the Servomechanisms Laboraratory, Section of Electrical Engineering, MIT, for Special Summer Programs held in 1956 and 1957. The code Susskind really presented in his work as "reading-type code" is shown as code blazon Two here, whereas the blazon I code is a pocket-sized derivation with the two most significant scrap columns swapped to better illustrate symmetries.)
- ^ a b Yuen, Chun-Kwong (December 1977). "A New Representation for Decimal Numbers". IEEE Transactions on Computers. C-26 (12): 1286–1288. doi:10.1109/TC.1977.1674792. S2CID 40879271. Archived from the original on 2020-08-08. Retrieved 2020-08-08 .
- ^ Lucal, Harold M. (December 1959). "Arithmetics Operations for Digital Computers Using a Modified Reflected Binary". IRE Transactions on Electronic Computers. EC-viii (4): 449–458. doi:10.1109/TEC.1959.5222057. ISSN 0367-9950. S2CID 206673385. (10 pages)
- ^ Dewar, Robert Berriedale Keith; Smosna, Matthew (1990). Microprocessors - A Programmer's View (1 ed.). Courant Institute, New York University, New York, USA: McGraw-Colina Publishing Company. p. 14. ISBN0-07-016638-2. LCCN 89-77320. (xviii+462 pages)
- ^ "Chapter eight: Decimal Instructions". IBM Arrangement/370 Principles of Operation. IBM. March 1980.
- ^ "Affiliate 3: Data Representation". PDP-xi Compages Handbook. Digital Equipment Corporation. 1983.
- ^ a b VAX-11 Architecture Handbook. Digital Equipment Corporation. 1985.
- ^ "ILE RPG Reference".
- ^ IBM BM 1401/1440/1460/1410/7010 Grapheme Code Chart in BCD Order [ permanent expressionless link ]
- ^ http://publib.bedrock.ibm.com/infocenter/zos/v1r12/index.jsp?topic=%2Fcom.ibm.zos.r12.iceg200%2Fenf.htm [ permanent expressionless link ]
- ^ "4.7 BCD and packed BCD integers". Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1: Bones Architecture (PDF). Version 072. Vol. i. Intel Corporation. 2020-05-27 [1997]. pp. three–2, 4-nine–4-11 [4-10]. 253665-072US. Archived (PDF) from the original on 2020-08-06. Retrieved 2020-08-06 . p. four-ten:
[…] When operating on BCD integers in full general-purpose registers, the BCD values tin can be unpacked (one BCD digit per byte) or packed (two BCD digits per byte). The value of an unpacked BCD integer is the binary value of the depression halfbyte (bits 0 through iii). The loftier half-byte (bits 4 through seven) tin can exist any value during add-on and subtraction, but must be zip during multiplication and sectionalisation. Packed BCD integers allow two BCD digits to exist independent in one byte. Here, the digit in the high half-byte is more significant than the digit in the low half-byte. […] When operating on BCD integers in x87 FPU data registers, BCD values are packed in an 80-chip format and referred to as decimal integers. In this format, the first ix bytes hold eighteen BCD digits, 2 digits per byte. The least-significant digit is independent in the lower one-half-byte of byte 0 and the almost-meaning digit is contained in the upper half-byte of byte 9. The most pregnant bit of byte 10 contains the sign scrap (0 = positive and 1 = negative; bits 0 through 6 of byte 10 are don't care $.25). Negative decimal integers are non stored in two's complement class; they are distinguished from positive decimal integers only by the sign bit. The range of decimal integers that can exist encoded in this format is −10eighteen + 1 to ten18 − 1. The decimal integer format exists in retention only. When a decimal integer is loaded in an x87 FPU data annals, it is automatically converted to the double-extended-precision floating-indicate format. All decimal integers are exactly representable in double extended-precision format. […]
[13] - ^ url=http://www.tigernt.com/onlineDoc/68000.pdf
- ^ Jones, Douglas W. (2015-11-25) [1999]. "BCD Arithmetics, a tutorial". Arithmetic Tutorials. Iowa City, Iowa, U.s.a.: The University of Iowa, Section of Computer Science. Retrieved 2016-01-03 .
- ^ University of Alicante. "A Cordic-based Architecture for High Performance Decimal Calculations" (PDF). IEEE. Retrieved 2015-08-15 .
- ^ "Decimal CORDIC Rotation based on Choice by Rounding: Algorithm and Architecture" (PDF). British Computer Society. Retrieved 2015-08-xiv .
- ^ Zaks, Rodnay (1982). Programming the Z80 (3rd revised ed.). Sybex Inc. p. 108. ISBN0-89588-094-6. LCCN 80-5468. ark:/13960/t4qk4vs4c. Retrieved 2022-01-08 . (NB. The Zilog Z80 DAA instructions differs in subtle details from the Intel 8080 DAA instruction.)
- ^ Cloutier, FĂ©lix, ed. (2019-05-30). "DAA — Decimal Adapt AL subsequently Addition". Archived from the original on 2022-01-16. Retrieved 2022-01-sixteen . (NB. Based on Intel 64 and IA-32 Architectures Software Programmer's Transmission.)
- ^ Mathur, Aditya P. (1989). Introduction to Microprocessors (3 ed.). Tata McGraw-Colina Publishing Company Limited. ISBN978-0-07-460222-5.
- ^ 3GPP TS 29.002: Mobile Application Part (MAP) specification (Technical study). 2013. sec. 17.seven.8 Mutual data types.
- ^ "Signalling Protocols and Switching (SPS) Guidelines for using Abstract Syntax Notation One (ASN.1) in telecommunications awarding protocols" (PDF). p. 15.
- ^ "XOM Mobile Awarding Role (XMAP) Specification" (PDF). p. 93. Archived from the original (PDF) on 2015-02-21. Retrieved 2013-06-27 .
- ^ http://world wide web.se.ecu.edu.au/units/ens1242/lectures/ens_Notes_08.pdf [ permanent dead link ]
- ^ MC6818 datasheet
- ^ Gottschalk v. Benson, 409 U.Due south. 63, 72 (1972).
Farther reading [edit]
- Mackenzie, Charles E. (1980). Coded Character Sets, History and Evolution. The Systems Programming Series (1 ed.). Addison-Wesley Publishing Company, Inc. p. xii. ISBN0-201-14460-3. LCCN 77-90165. Retrieved 2016-05-22 . [14]
- Richards, Richard Kohler (1955). Arithmetic Operations in Digital Computers. New York, USA: van Nostrand. pp. 397–.
- Schmid, Hermann (1974). Decimal Ciphering (1 ed.). Binghamton, New York, USA: John Wiley & Sons. ISBN0-471-76180-X. and Schmid, Hermann (1983) [1974]. Decimal Computation (1 (reprint) ed.). Malabar, Florida, USA: Robert E. Krieger Publishing Company. ISBN0-89874-318-4. (NB. At to the lowest degree some batches of the Krieger reprint edition were misprints with defective pages 115–146.)
- Massalin, Henry (Oct 1987). Katz, Randy (ed.). "Superoptimizer: A Look at the Smallest Program" (PDF). Proceedings of the Second International Conference on Architectural Support for Programming Languages and Operating Systems ACM SIGOPS Operating Systems Review. 21 (iv): 122–126. doi:x.1145/36204.36194. ISBN0-8186-0805-6. Archived (PDF) from the original on 2017-07-04. Retrieved 2012-04-25 . (Likewise: ACM SIGPLAN Notices, Vol. 22 #10, IEEE Reckoner Society Printing #87CH2440-half-dozen, Oct 1987)
- "GNU Superoptimizer". HP-UX.
- Shirazi, Behrooz; Yun, David Y. Y.; Zhang, Chang Northward. (March 1988). VLSI designs for redundant binary-coded decimal addition. IEEE Seventh Annual International Phoenix Conference on Computers and Communications, 1988. IEEE. pp. 52–56.
- Brown; Vranesic (2003). Fundamentals of Digital Logic.
- Thapliyal, Himanshu; Arabnia, Hamid R. (November 2006). Modified Carry Look Ahead BCD Adder With CMOS and Reversible Logic Implementation. Proceedings of the 2006 International Briefing on Figurer Blueprint (CDES'06). CSREA Press. pp. 64–69. ISBN1-60132-009-4.
- Kaivani, A.; Alhosseini, A. Zaker; Gorgin, Southward.; Fazlali, Grand. (Dec 2006). Reversible Implementation of Densely-Packed-Decimal Converter to and from Binary-Coded-Decimal Format Using in IEEE-754R. 9th International Conference on Information Engineering science (ICIT'06). IEEE. pp. 273–276.
- Cowlishaw, Mike F. (2009) [2002, 2008]. "Bibliography of material on Decimal Arithmetic – by category". General Decimal Arithmetics. IBM. Retrieved 2016-01-02 .
External links [edit]
- Cowlishaw, Mike F. (2014) [2000]. "A Summary of Chen-Ho Decimal Information encoding". General Decimal Arithmetic. IBM. Retrieved 2016-01-02 .
- Cowlishaw, Mike F. (2007) [2000]. "A Summary of Densely Packed Decimal encoding". General Decimal Arithmetic. IBM. Retrieved 2016-01-02 .
- Convert BCD to decimal, binary and hexadecimal and vice versa
- BCD for Java
Source: https://en.wikipedia.org/wiki/Binary-coded_decimal
Posted by: withrowgovers.blogspot.com
0 Response to "How To Set Bcd To A Register Computer"
Post a Comment