Upcoming SlideShare
×

# Endianness

2,504 views

Published on

Lecture slides

Published in: Technology
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
2,504
On SlideShare
0
From Embeds
0
Number of Embeds
15
Actions
Shares
0
53
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Endianness

1. 1. Endianness A Lecture to FW and VLSI Engineers
2. 2. CONVENTION Binary Numbers Presentation Notation Each binary digit represents only a single bit of binary number – N- digit binary number means the same as N-bit binary number Binary digit weight The most left positioned bit is called The Most Significant Bit – MSB The most right positioned bit is called The Least Significant Bit – LSB Each bit has its own weight • LSB – the lowest • MSB – the highest For N-bit binary number each bit has a weight equal to 2i-1, where i∈[1,N] Presenting N-bit binary numbers, it is acceptable to reference each bit by its index – else it is called a bit order The indices are incrementally growing from 0 to N-1 When indices grow from left to right the MSB is 0th bit and the LSB is (N- 1)th bit When indices grow from right to left the MSB is (N-1)th bit and the LSB is 0th bit © Georgiy Shenderovich, 2006-2009 Shenderovich, 2006- Email: georgiysh@gmail.com Mbl.: +972-544-491911 +972- 544- 2
3. 3. CONVENTION Storage Units Byte – 8 bits Half Word – 2 bytes MSB LSB Word – 4 bytes 231...20 Word Double Word – 8 bytes Register Storage Presentation – either CPU internal, standalone or functional blocks internal registers © Georgiy Shenderovich, 2006-2009 Shenderovich, 2006- Email: georgiysh@gmail.com Mbl.: +972-544-491911 +972- 544- 3
5. 5. 1st station Some conclusions so far about binary numbers presentation convention Writing, printing, showing the binary numbers use the same convention as any other Number System – the higher significant digits are located at the left of the number and have higher weights, when the lower significant digits are located at the right of the number and have lower weights Binary digits or bits in binary numbers are referencing by their indices growing from left to right or vice versa having at the same time no any relation to weight of each bit Some conclusions so far about storage resources Register may be a standalone storage resource or internal storage resource of CPU or resource of any other functional block in the system. Register completely represents the binary numbers presentation convention and bits in the register may be indexed in any direction Memory is a storage resource representing an array of bytes sequentially addressed depending on access width – byte, half word, word or double word © Georgiy Shenderovich, 2006-2009 Shenderovich, 2006- Email: georgiysh@gmail.com Mbl.: +972-544-491911 +972- 544- 5
6. 6. Endianness Introduction In computing, endianness is the byte (and sometimes bit) ordering used to represent some kind of data. Typical cases are the order in which integer values are stored as bytes in computer memory (relative to a given memory addressing scheme) and the transmission order over a network or other medium. When specifically talking about bytes, endianness is also referred to simply as byte order More Definitions Increasing numeric significance with increasing memory addresses, is known as little-endian Opposite of the above, most-significant byte first, is called big- endian All the definitions look simple, clear and unambiguous – however a lot of questions appear when HW implementation starts, especially when systems with mixed endianeess are created or integrated © Georgiy Shenderovich, 2006-2009 Shenderovich, 2006- Email: georgiysh@gmail.com Mbl.: +972-544-491911 +972- 544- 6
7. 7. Basic But Necessary Statements Memory doesn’t have endianness – memory just stores the bytes of data Registers don’t have endianness – registers represent the data on their way from or to the memory for further processing The LSB of Register contains the LSB of data after read from the memory or before write to the memory The MSB of Register contains the MSB of data after read from the memory or before write to the memory The main questions of endianness How the data are transferred from the memory to the register and back Which byte of the register and which addressable byte of the memory correspond to each other during the read/write operation Fortunately there is a very simple answer – it depends on the interpretation of the CPU, functional block or any other operating unit in the system And Finally – Endianness is not less and not more than INTERPRETATION. Only operating unit decides about order and weight of bytes and bits during byte, half word, word, duble word or any other transaction size © Georgiy Shenderovich, 2006-2009 Shenderovich, 2006- Email: georgiysh@gmail.com Mbl.: +972-544-491911 +972- 544- 7
8. 8. 2nd Station Memory doesn’t have endianness – it’s only a data storage Register doesn’t have endianness – it’s another kind of data storage Endianness is interpretation of data on its way between memory and register © Georgiy Shenderovich, 2006-2009 Shenderovich, 2006- Email: georgiysh@gmail.com Mbl.: +972-544-491911 +972- 544- 8
9. 9. Byte Access Each byte of register may be exchanged with any single byte of memory There is not a place for endianness interpretation – so particularly a byte memory access doesn’t have endianness © Georgiy Shenderovich, 2006-2009 Shenderovich, 2006- Email: georgiysh@gmail.com Mbl.: +972-544-491911 +972- 544- 9
10. 10. Half Word Access Little-endian data exchange – more significant data byte corresponds to higher address Big-endian data exchange – more significant data byte corresponds to lower address © Georgiy Shenderovich, 2006-2009 Shenderovich, 2006- Email: georgiysh@gmail.com Mbl.: +972-544-491911 +972- 544- 10
11. 11. Word Access Little-endian data exchange – more significant data byte corresponds to higher address, similar to half word © Georgiy Shenderovich, 2006-2009 Shenderovich, 2006- Email: georgiysh@gmail.com Mbl.: +972-544-491911 +972- 544- 11