[OT] The Ramifications of Little-Endian Packed Decimal
jsavard_at_ecn.ab.ca
Date: 08/10/03
- Next message: Joe Peschel: "Re: Does encrypting same data with multiple algorithms increase security?"
- Previous message: Tom St Denis: "Re: new hash algorithm"
- Next in thread: Douglas A. Gwyn: "Re: [OT] The Ramifications of Little-Endian Packed Decimal"
- Reply: Douglas A. Gwyn: "Re: [OT] The Ramifications of Little-Endian Packed Decimal"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sun, 10 Aug 2003 14:17:42 GMT
This is posted to sci.crypt, as well as comp.arch, because it wasn't long
ago that we had a discussion there about the difference between big-endian
and little-endian computers.
On my web page, at
http://home.ecn.ab.ca/~jsavard/other/arc02.htm
you will see a big highlighted box in the description of packed decimal
instructions for a hypothetical computer architecture I have been
describing.
Some computers store binary data with the most significant portion first,
and some do so with the least significant portion first. The latter has
some arguments for it in efficiency of arithmetic; the former allows
magnitude comparisons to be more consistent, and is more easily understood
by people whose cultural background includes using Hindu-Arabic numerals
in conjunction with a left-to-right direction of writing.
Well, after adding multiple floating-point formats to the architecture, I
decided that if I was going to set up for compatibility with other
machines, I had better also allow little-endian operation, however much I
preferred big-endian operation (most significant part first, in the lower
address).
However, I was also supporting packed decimal data, like the System/360.
At first, I thought I could just make packed decimal big endian regardless
of whether binary data was little endian. This would make it consistent
with the character data into which ease of conversion was the entire
raison d'etre of packed decimal.
But I realized that if I was going to use the impolitely-named "bit
munging" as an implementation technique for little-endian operation, I
would then be forced at least to load packed decimal quantities into the
ALU serially by byte.
So I couldn't do that! So instead, I had to store them in little-endian
fashion... and address them by their byte at the highest address, unlike
all other data values, when in little-endian mode.
However, that would be perverse if the users of the computer were speakers
of Arabic or Hebrew, where the order of characters in numeric strings
relative to text is reversed, and in which little-endian operation makes
sense. Thus, I had to add a *second* bit to the program status word, to
describe the endianness of character, as opposed to computational, numeric
values.
This illustration of just how complicated endianness is (and a warning on
my main page,
http://home.ecn.ab.ca/~jsavard/other/arcint.htm
hinting at what happens when you don't have separate code and data
segments, and you turn on bit munging for all addresses, _including those
generated from the program counter contents_, in the middle of execution)
may possibly be of some relevance to the ongoing debate on this topic.
John Savard
- Next message: Joe Peschel: "Re: Does encrypting same data with multiple algorithms increase security?"
- Previous message: Tom St Denis: "Re: new hash algorithm"
- Next in thread: Douglas A. Gwyn: "Re: [OT] The Ramifications of Little-Endian Packed Decimal"
- Reply: Douglas A. Gwyn: "Re: [OT] The Ramifications of Little-Endian Packed Decimal"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|