endianness
play

Endianness 2 Lab Schedule Ac=vi=es Assignments Due - PowerPoint PPT Presentation

Computer Systems and Networks ECPE 170 Jeff Shafer University of the Pacific Endianness 2 Lab Schedule Ac=vi=es Assignments Due


  1. ì ¡ Computer ¡Systems ¡and ¡Networks ¡ ECPE ¡170 ¡– ¡Jeff ¡Shafer ¡– ¡University ¡of ¡the ¡Pacific ¡ Endianness ¡

  2. 2 ¡ Lab ¡Schedule ¡ Ac=vi=es ¡ Assignments ¡Due ¡ ì This ¡Week ¡ ì Lab ¡9 ¡ Lab ¡9 ¡– ¡Network ¡ Due ¡by ¡NOV ¡9 th ¡5:00am ¡ ì ì Programming ¡ ì Next ¡Week ¡(THURS) ¡ Start ¡MIPS ¡Assembly ¡ ì Programming ¡ (lecture ¡for ¡1+ ¡day) ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2016 ¡

  3. 3 ¡ Endianness ¡ ì In ¡typical ¡computer ¡memory, ¡ ¡ each ¡address ¡(locaSon) ¡stores ¡one ¡byte ¡ ì If ¡we ¡have ¡a ¡one-­‑byte ¡integer, ¡how ¡is ¡that ¡stored ¡in ¡ memory? ¡ ì If ¡we ¡have ¡a ¡two-­‑byte ¡integer, ¡how ¡is ¡that ¡stored ¡in ¡ memory? ¡ ì If ¡we ¡have ¡a ¡four-­‑byte ¡integer, ¡how ¡is ¡that ¡stored ¡in ¡ memory? ¡ Endianness ¡= ¡Byte ¡Ordering ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2016 ¡

  4. 4 ¡ Endianness ¡Example ¡ Address ¡ “OpSon ¡A” ¡ “OpSon ¡B” ¡ ì 32-­‑bit ¡hexadecimal ¡number ¡ 0x12345678 0 ¡ 0x12 0x78 ì Composed ¡of ¡4 ¡bytes: ¡ 0x12 0x34 0x56 0x78 1 ¡ (MSB) (LSB) 0x34 0x56 ì Two ¡possible ¡arrangements: ¡ 2 ¡ 0x56 0x34 3 ¡ 0x78 0x12 Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2016 ¡

  5. 5 ¡ Endianness ¡Example ¡ Address ¡ Big ¡ ¡ LiZle ¡ ì 32-­‑bit ¡hexadecimal ¡number ¡ Endian ¡ Endian ¡ 0x12345678 0x12 0x78 0 ¡ (MSB) (LSB) ì Composed ¡of ¡4 ¡bytes: ¡ 0x12 0x34 0x56 0x78 1 ¡ (MSB) (LSB) 0x34 0x56 ì Two ¡possible ¡arrangements: ¡ 2 ¡ 0x56 0x34 Big ¡Endian ¡ ì LiZle ¡Endian ¡ ì 3 ¡ 0x78 0x12 Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2016 ¡

  6. 6 ¡ Endianness ¡ ì How ¡is ¡DEADBEEF 16 ¡stored ¡in ¡liZle ¡and ¡big ¡endian ¡ formats ¡at ¡address ¡21C 16 ? ¡ LiTle ¡endian ¡ ì ì 21C 16 =EF 16 ¡ ì 21D 16 =BE 16 ¡ ì 21E 16 ¡=AD 16 ¡ ì 21F 16 =DE 16 ¡ Big ¡endian ¡ ì ì 21C 16 =DE 16 ¡ ì 21D 16 =AD 16 ¡ ì 21E 16 ¡=BE 16 ¡ ì 21F 16 =EF 16 ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2016 ¡

  7. 7 ¡ Big ¡Endian ¡–vs– ¡Little ¡Endian ¡ Big-­‑Endian ¡CPU ¡ LiZle-­‑Endian ¡CPU ¡ ì Most ¡significant ¡byte ¡(MSB) ¡ ì Least ¡significant ¡byte ¡(LSB) ¡ comes ¡first ¡ (stored ¡in ¡lower ¡ comes ¡first ¡ ¡ (stored ¡in ¡lower ¡ memory ¡address) ¡ memory ¡addresses) ¡ ì Examples ¡ ì Examples ¡ Motorola ¡68000 ¡ Intel ¡x86/x86-­‑64 ¡ ì ì Java ¡virtual ¡machine ¡ DEC ¡Alpha ¡ ì ì IBM ¡PowerPC ¡(by ¡default, ¡ ARM ¡(by ¡default, ¡also ¡can ¡ ì ì can ¡also ¡be ¡liTle ¡endian) ¡ be ¡big ¡endian) ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2016 ¡

  8. 8 ¡ Do ¡I ¡Care? ¡ ì When ¡do ¡I ¡need ¡to ¡care ¡that ¡some ¡computers ¡are ¡ big-­‑endian ¡and ¡others ¡are ¡liZle ¡endian? ¡ ì What ¡happens ¡if ¡I ¡open ¡big-­‑endian ¡data ¡on ¡a ¡liTle-­‑ endian ¡computer? ¡ ì Endianness ¡must ¡be ¡considered ¡whenever ¡you ¡are ¡ sharing ¡data ¡between ¡different ¡computer ¡systems ¡ ì Reading/wri=ng ¡data ¡files ¡to ¡ disk ¡ ì Reading/wri=ng ¡data ¡files ¡to ¡ network ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2016 ¡

  9. 9 ¡ Best ¡Practices ¡ ì Pick ¡one ¡format ¡and ¡sSck ¡with ¡it! ¡ Example: ¡Data ¡sent ¡over ¡the ¡network ¡will ¡always ¡be ¡in ¡ ì big-­‑endian ¡ format ¡regardless ¡of ¡who ¡sends ¡it ¡ ì Networks ¡are ¡big-­‑endian ¡“by ¡tradi9on” ¡ Example: ¡Data ¡wriTen ¡to ¡disk ¡will ¡always ¡be ¡in ¡ li<le-­‑ ì endian ¡format ¡regardless ¡of ¡who ¡writes ¡it ¡ ì Convert ¡between ¡data ¡storage/transfer ¡format ¡and ¡ internal ¡representaSon ¡as ¡needed ¡ Example: ¡LiTle-­‑endian ¡machines ¡convert ¡to ¡big-­‑endian ¡ ì before ¡sending ¡data ¡onto ¡the ¡network ¡(and ¡convert ¡back ¡ upon ¡receiving ¡data ¡from ¡the ¡network) ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2016 ¡

  10. 10 ¡ Examples ¡in ¡Industry ¡ hTp://download.intel.com/design/intarch/papers/endian.pdf ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2016 ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend