It depends on what you are used to. I use both big-endian (68k, ppc) and little-endian (msp430, avr (little-endian by compiler convention more than architectural necessity, since it is 8-bit), Nios) processors. I find little-endian to be easier to work with, easier to view in hex dumps, and easier to work out which bit is in which place - even though I know that big-endian is more consistent and should be easier. It's just a matter of habit and familiarity.
This information would be immediately available on some little endian systems as well: the ARM instruction set, for example, can encode an immediate offset in the instruction.
--
Paul Black mailto:paul.black@oxsemi.com
Oxford Semiconductor Ltd http://www.oxsemi.com
Yes, but many of these have a prefererance for one mode. The PPC architecture, for example, perfers big-endian - some implementations (like the MPC56x) don't support little-endian at all, while those that do have certain restrictions - I believe the string instructions only function in big-endian mode, for example. This is because all cpus have are fixed-endian at heart (normally big- or little-endian, though there have historically been computers with all sorts of arrangements), and the non-native mode is handled using thunking - the bytes of multi-byte data are re-arranged on the fly as data is moved into and out of the cpu.
When dealing with bitstreams such as raster lines, big-endian is way better. The ultimate machine for these apps have large words and are big-endian.
Bulk operations such as applying masks are not affected, but some operations such as shifting, shearing, and bit-bending are way easier on a natural order machine when having to cast around types.
I say natural order - maybe that should be anthropic order. We read numbers LtoR, MSD to LSD.
--
------------------------------------------------------------
Creepy, Soulless Gigolo for President ? NOT !
The issue is so low down in the priority list that I can't imagine a situation where the endianness of the processor would make the difference, unless there was something in the application itself that made one choice or the other preferable for compatibility with other components of the system.
-Robert Scott Ypsilanti, Michigan (Reply through this forum, not by direct e-mail to me, as automatic reply address is fake.)
Do processors with high end at the lower address tend to have a more regular instruction set than the reverse persuasion? I'm thinking of the Motorola mindset (6800, 6803, 6809 of blessed memory, 68000) v the nightmares of 8085/Z80/80x86. In the days when I used to write a lot of assembler, I know which ones I preferred!
The only application we've found where endianness might matter is for a comms stack where the protocol defines data to be in a particular (usually big-endian) format. In practice, this has very little impact on performance. For example, in a TCP/IP stack, checksum generation is far more important than the impact of endianness.
Stephen
-- Stephen Pelc, snipped-for-privacy@INVALID.mpeltd.demon.co.uk MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691 web:
More than a compiler convention. Consider adiw, sbiw, [f]mul[s[u]], and spm. The X, Y, and Z registers are also defined with the higher-numbered register as the MSB.
However, the [r]call instruction pushes the lsb of the pc onto the stack first, resulting in a big-endian layout in memory. The 8051 is similarly of two minds here: the call instruction contains a little-endian destination address, but pushes the return address in big-endian order (or vice-versa -- it's been a while...)
Indeed.
It's like clasping your hands together in a double fist. Do you interlock your fingers so your left thumb is over the right, or the right is over the left? When you switch, it feels like you're holding someone else's hand.
There are two ways to do it. Neither is "better" than the other. One way feels comfortable, the other doesn't. But some do it one way, and some the other. And you're reluctant to switch just because someone else says it's the "right" way.
Except it does. If you look at the serial stream from a UART on a scope, the bits appear left to right, LSb to MSb. And depending on where you hook into the circuit, ones may be low and zeros high. Does take some getting used to.
OTOH, if the serial stream is an ASCII text string, it DOES tend to be transmitted leftmost character first...
And the latin-alphabet-using people who orignally borrowed arabic numerical notation for some reason neglected to flip them around to match the direction of the rest of the language.
--
Grant Edwards grante Yow! I'm not an
at Iranian!! I voted for
Be careful about arguments based on "naturalness". When Arabic numerals made their way into Western left-to-right writing, the original LSD to MSD ordering was reversed. In Arabic, which reads right-to-left, the ones digit is on the right. Apparently the Indian system from which the Arabic numerals came also had the LSD first, or little-endian.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.