Knowledge

Word addressing

Source ๐Ÿ“

201:. A single sign can be stored in 4 bits. If a sign is stored in its own MAU, then 4 bits will be wasted with byte addressing (50% efficiency), while 28 bits will be wasted with 32-bit word addressing (12.5% efficiency). If a sign is "packed" into a MAU with other data, then it may be relatively more expensive to read and write. For example, to write a new sign into a MAU that other data has been packed into, the computer must read the current value of the MAU, overwrite just the appropriate bits, and then store the new value back. This will be especially expensive if it is necessary for the program to allow other threads to concurrently modify the other data in the MAU. 217:
programs that work with large amounts of text. Packing adjacent code points into a single word avoids this cost. However, many algorithms for working with text prefer to be able to independently address code points; to do this with packed code points, the algorithm must use a "wide" address which also stores the offset of the character within the word. If this wide address needs to be stored elsewhere within the program's memory, it may require more memory than an ordinary address.
237:
addresses for most important purposes, and the browser will fit comfortably within the maximum addressable range of 16 Gigabytes. However, there may be a significant runtime overhead due to the widespread use of packed data for images and text. More importantly, 16 Gigabytes is a relatively low limit, and if the web page grows significantly, this computer will exhaust its address space and begin to have some of the same difficulties as the byte-addressed computer.
149: 25: 342:). (This should not be confused with other uses of wide addresses for storing other kinds of supplemental data, such as the bounds of an array.) The stored offset may be either a bit offset or a byte offset. The code sequences above benefit from the offset being denominated in bits because they use it as a shift count; an architecture with direct support for selecting bytes might prefer to just store a byte offset. 221:
the same amount of memory regardless of the size of the MAU. Other memory will represent the browser's model of various objects on the page, and these objects will include many references: to each other, to the image and text data, and so on. The amount of memory needed to store these object will depend greatly on the address width of the computer.
233:
references, but a figure of 40% is not implausible, for a total of 14 Gigabytes required. This is, of course, well within the capabilities of a 64-bit address space. However, the browser will generally exhibit worse locality and make worse use of the computer's memory caches within the computer, assuming equal resources with the alternatives.
459:) which ignore those bits and simply load and store the containing aligned word. The later byte-word extensions to the architecture (BWX) added 8-bit and 16-bit loads and stores, starting with the Alpha 21164a. Again, this extension was possible without serious software incompatibilities because the Alpha had always used byte addressing. 241:
of working with extensive packing of text and image data. Word addressing means that the program can theoretically address up to 64 Exabytes of memory instead of only 16 Exabytes, but since the program is nowhere near needing this much memory (and in practice no real computer is capable of providing it), this provides no benefit.
375:
states that a pointer is expected to have the usual representation of an address. C also allows a pointer to be formed to any object except a bit-field; this includes each individual element of an array of bytes. C compilers for computers that use word addressing often use different representations
320:
sllv $ r1, $ r1, $ r3 # Shift the new value left by the bit offset llo $ r5, 0x00FF # Construct a constant mask to select a byte sllv $ r5, $ r5, $ r3 # Shift the mask left by the bit offset nor $ r5, $ r5, $ zero # Flip the mask so that it clears the selected byte ldw
270:
assembly. In reality, MIPS is a byte-addressed architecture with direct support for loading and storing 8-bit and 16-bit values, but the example will pretend that it only provides 32-bit loads and stores and that offsets within a 32-bit word must be stored separately from an address. MIPS has been
220:
To evaluate these effects on a complete program, consider a web browser displaying a large and complex page. Some of the browser's memory will be used to store simple data such as images and text; the browser will likely choose to store this data as efficiently as possible, and it will occupy about
165:
More generally, the minimum addressable unit (MAU) is a property of a specific memory abstraction. Different abstractions within a computer may use different MAUs, even when they are representing the same underlying memory. For example, a computer might use 32-bit addresses with byte addressing in
350:
uses 64-bit words, but addresses are only 32 bits; when an address is stored in memory, it is stored in its own word, and so the byte offset can be placed in the upper 32 bits of the word. The inefficiency of using wide addresses on that system is just all the extra logic to manipulate this offset
240:
If the web browser is running on a computer with 64-bit addresses and 32-bit-word-addressable memory, it will suffer from both of the above runtime overheads: it require substantially more memory to accommodate the larger 64-bit addresses, hurting locality, while also incurring the runtime overhead
228:
If the web browser is running on a computer with 32-bit addresses and byte-addressable memory, the address space will cover 4 Gigabytes of memory, which is insufficient. The browser will either be unable to display this page, or it will need to be able to opportunistically move some of the data to
236:
If the web browser is running on a computer with 32-bit addresses and 32-bit-word-addressable memory, it will likely require extra memory because of suboptimal packing and the need for a few wide addresses. This impact is likely to be relatively small, as the browser will use packing and non-wide
232:
If the web browser is running on a computer with 64-bit addresses and byte-addressable memory, it will require substantially more memory in order to store the larger addresses. The exact overhead will depend on how much of the 10 Gigabytes is simple data and how much is object-like and dense with
216:
store strings as a sequence of 8-bit code points. With byte addressing, each code point can be placed in its own independently-addressable MAU with no overhead. With 32-bit word addressing, placing each code point in a separate MAU would increase the memory usage by 300%, which is not viable for
245:
Thus, word addressing allows a computer to address substantially more memory without increasing its address width and incurring the corresponding large increase in memory usage. However, this is valuable only within a relatively narrow range of working set sizes, and it can introduce substantial
359:
The minimum addressable unit of a computer isn't necessarily the same as the minimum memory access size of the computer's instruction set. For example, a computer might use byte addressing without providing any instructions to directly read or write a single byte. Programs would be expected to
324:
This code sequence assumes that another thread cannot modify other bytes in the word concurrently. If concurrent modification is possible, then one of the modifications might be lost. To solve this problem, the last few instructions must be turned into an atomic compare-exchange loop so that a
309:
sll $ r1, $ r1, 16 # Shift the new value left by 16 lhi $ r5, 0x00FF # Construct a constant mask to select the third byte nor $ r5, $ r5, $ zero # Flip the mask so that it clears the third byte ldw $ r4, 0($ r2) # Load the full word and $ r4, $ r5, $ r4 #
193:
The size of the minimum addressable unit of memory can have complex trade-offs. Using a larger MAU allows the same amount of memory to be covered with a smaller address, which can substantially decrease the memory requirements of a program. However, using a smaller MAU makes it easier to work
345:
In these code sequences, the additional offset would have to be stored alongside the base address, effectively doubling the overall storage requirements of an address. This is not always true on word machines, primarily because addresses themselves are often not packed with other data to make
450:
uses byte addressing with 64-bit addresses. Early Alpha processors do not provide any direct support for 8-bit and 16-bit memory accesses, and programs are required to e.g. load a byte by loading the containing 64-bit word and then separately extracting the byte. Because the Alpha uses byte
254:
A program running on a computer that uses word addressing can still work with smaller units of memory by emulating an access to the smaller unit. For a load, this requires loading the enclosing word and then extracting the desired bits. For a store, this requires loading the enclosing word,
161:
Consider a computer which provides 524,288 (2) bits of memory. If that memory is arranged in a byte-addressable flat address space using 8-bit bytes, then there are 65,536 (2) valid addresses, from 0 to 65,535, each denoting an independent 8 bits of memory. If instead it is arranged in a
258:
Suppose that four consecutive code points from a UTF-8 string need to be packed into a 32-bit word. The first code point might occupy bits 0โ€“7, the second 8โ€“15, the third 16โ€“23, and the fourth 24โ€“31. (If the memory were byte-addressable, this would be a
442:
uses byte addressing with 64-bit addresses. It does not directly support memory accesses smaller than 64 bits, and such accesses must be emulated in software. The C compiler for the X1 was the first Cray compiler to support emulating 16-bit
360:
emulate those operations in software with bit-manipulations, just like the example code sequences above do. This is relatively common in 64-bit computer architectures designed as successors to 32-bit supercomputers or minicomputers, such the
321:$ r4, 0($ r2) # Load the full word and $ r4, $ r5, $ r4 # Clear the selected byte from the word or $ r4, $ r4, $ r1 # Merge the new value into the word stw $ r4, 0($ r2) # Store the result as the full word 384:
will be a wide pointer: a pair of the address of a word and the offset of a byte within that word. Converting between pointer types is therefore not necessarily a trivial operation and can lose information if done incorrectly.
306:. In the absence of any other support from the instruction set, the program must load the full word, mask off the old value of that code point, shift the new value into place, merge the values, and store the full word back: 451:
addressing, this offset is still represented in the least significant bits of the address (rather than separately as a wide address), and the Alpha conveniently provides load and store unaligned instructions (
282:. In the absence of any other support from the instruction set, the program must load the full word, right-shift by 16 to drop the first two code points, and then mask off the fourth code point: 246:
runtime overheads depending on the application. Programs which do relatively little work with byte-oriented data like images, text, files, and network traffic may be able to benefit most.
266:
In order to clearly elucidate the code necessary for sub-word accesses without tying the example too closely to any particular word-addressed architecture, the following examples use
295:
ldw $ r1, 0($ r2) # Load the full word srlv $ r1, $ r1, $ r3 # Shift right by the bit offset andi $ r1, $ r1, 0xFF # Mask off other code points
376:
for pointers to different types depending on their size. A pointer to a type that's large enough to fill a word will be a simple address, while a pointer such as
310:
Clear the third byte from the word or $ r4, $ r4, $ r1 # Merge the new value into the word stw $ r4, 0($ r2) # Store the result as the full word
162:
word-addressable flat address space using 32-bit words, then there are 16,384 (2) valid addresses, from 0 to 16,383, each denoting an independent 32 bits.
285:
ldw $ r1, 0($ r2) # Load the full word srl $ r1, $ r1, 16 # Shift right by 16 andi $ r1, $ r1, 0xFF # Mask off other code points
413:
uses word addressing with 36-bit words. Only addresses 0-1023 refer to random-access memory; others are either unmapped or refer to drum memory.
325:
concurrent modification will simply cause it to repeat the operation with the new value. No memory barriers are required in this case.
271:
chosen because it is a simple assembly language with no specialized facilities that would make these operations more convenient.
89: 61: 178:, allowing any particular cache line to be identified with only a 26-bit address and decreasing the overhead of the cache. 224:
Suppose that, if all the addresses in the program were 32-bit, this web page would occupy about 10 Gigabytes of memory.
68: 108: 42: 75: 46: 57: 126: 255:
shifting the new value into place, overwriting the desired bits, and then storing the enclosing word.
205: 512: 141:
is largely only of historical interest. A computer that uses word addressing is sometimes called a
532: 396:, it is not possible to reliably apply the rule above. Compilers may need to align the start of a 372: 498: 35: 16:
Support by a hardware architecture of accessing memory only in units of words larger than a byte
513:"Alpha: The History in Facts and Comments - Alpha 21164 (EV5, EV56) and 21164PC (PCA56, PCA57)" 82: 185:
often affects the structure and width of the address space, but it does not change the MAU.
288:
If the offset is not known statically, but instead a bit-offset is stored in the register
8: 267: 198: 427:
supercomputers from the 1980s and 1990s use word addressing with 64-bit words. The
499:"The Alpha AXP, part 8: Memory access, storing bytes and words and unaligned data" 469: 171: 167: 130: 182: 526: 488:
Terry Greyzck, Cray Inc. Cray X1 Compiler Challenges (And How We Solved Them)
298:
Suppose instead that the program wishes to assign the code point in register
260: 148: 392:
is not always known when deciding the representation of a pointer to that
338: 274:
Suppose that a program wishes to read the third code point into register
351:
and extract and insert bytes within words; it has no memory-use impact.
175: 447: 432: 361: 152:
Tables showing the same data organized under byte and word addressing
137:. Almost all modern computer architectures use byte addressing, and 188: 24: 410: 328:
A pair of a word address and an offset within the word is called a
439: 365: 347: 428: 417: 174:
system might work with memory only at a granularity of 64-byte
125:
means that addresses of memory on a computer uniquely identify
229:
slower storage, which will substantially hurt its performance.
435:
use 24-bit addresses, while most others use 32-bit addresses.
213: 209: 420:
uses word addressing with 36-bit words and 18-bit addresses.
400:
so that it can use a more efficient pointer representation.
424: 134: 249: 302:
to the third code point in the word at the address in
49:. Unsourced material may be challenged and removed. 189:Trade-offs of different minimum addressable units 524: 292:, a slightly more complex approach is required: 129:of memory. It is usually used in contrast with 197:Suppose a program wishes to store one of the 346:accesses more efficient. For example, the 313:Again, if the offset is instead stored in 199:12 traditional signs of Western astrology 109:Learn how and when to remove this message 278:from the word at an address in register 147: 317:, a more complex approach is required: 525: 194:efficiently with small items of data. 250:Sub-word accesses and wide addresses 133:, where addresses uniquely identify 47:adding citations to reliable sources 18: 354: 13: 14: 544: 208:. Common string formats such as 181:The address translation done by 23: 34:needs additional citations for 505: 491: 482: 1: 475: 7: 463: 403: 204:A more common example is a 10: 549: 121:In computer architecture, 156: 388:Because the size of a C 153: 151: 43:improve this article 154: 501:. 16 August 2017. 332:(also known as a 119: 118: 111: 93: 58:"Word addressing" 540: 517: 516: 509: 503: 502: 495: 489: 486: 458: 454: 399: 395: 391: 383: 379: 355:Related concepts 316: 305: 301: 291: 281: 277: 170:, but the CPU's 114: 107: 103: 100: 94: 92: 51: 27: 19: 548: 547: 543: 542: 541: 539: 538: 537: 533:Computer memory 523: 522: 521: 520: 511: 510: 506: 497: 496: 492: 487: 483: 478: 470:Byte addressing 466: 456: 452: 406: 397: 393: 389: 381: 377: 357: 322: 314: 311: 303: 299: 296: 289: 286: 279: 275: 252: 191: 172:cache coherence 168:instruction set 159: 139:word addressing 131:byte addressing 123:word addressing 115: 104: 98: 95: 52: 50: 40: 28: 17: 12: 11: 5: 546: 536: 535: 519: 518: 504: 490: 480: 479: 477: 474: 473: 472: 465: 462: 461: 460: 444: 436: 421: 414: 405: 402: 356: 353: 319: 308: 294: 284: 251: 248: 243: 242: 238: 234: 230: 206:string of text 190: 187: 183:virtual memory 158: 155: 117: 116: 99:September 2022 31: 29: 22: 15: 9: 6: 4: 3: 2: 545: 534: 531: 530: 528: 514: 508: 500: 494: 485: 481: 471: 468: 467: 449: 445: 441: 437: 434: 430: 426: 422: 419: 415: 412: 408: 407: 401: 386: 374: 369: 367: 363: 352: 349: 343: 341: 340: 335: 331: 326: 318: 307: 293: 283: 272: 269: 264: 263:byte order.) 262: 261:little endian 256: 247: 239: 235: 231: 227: 226: 225: 222: 218: 215: 211: 207: 202: 200: 195: 186: 184: 179: 177: 173: 169: 163: 150: 146: 144: 140: 136: 132: 128: 124: 113: 110: 102: 91: 88: 84: 81: 77: 74: 70: 67: 63: 60: โ€“  59: 55: 54:Find sources: 48: 44: 38: 37: 32:This article 30: 26: 21: 20: 507: 493: 484: 387: 370: 358: 344: 337: 333: 330:wide address 329: 327: 323: 312: 297: 287: 273: 265: 257: 253: 244: 223: 219: 203: 196: 192: 180: 164: 160: 143:word machine 142: 138: 122: 120: 105: 96: 86: 79: 72: 65: 53: 41:Please help 36:verification 33: 339:fat pointer 334:fat address 176:cache lines 476:References 373:C standard 69:newspapers 448:DEC Alpha 443:accesses. 433:Cray X-MP 362:DEC Alpha 527:Category 464:See also 411:ERA 1103 404:Examples 364:and the 440:Cray X1 366:Cray X1 348:Cray X1 83:scholar 429:Cray-1 418:PDP-10 398:struct 394:struct 390:struct 157:Basics 85:  78:  71:  64:  56:  457:stq_u 453:ldq_u 423:Most 382:void* 378:char* 214:ASCII 210:UTF-8 135:bytes 127:words 90:JSTOR 76:books 455:and 446:The 438:The 431:and 425:Cray 416:The 409:The 371:The 268:MIPS 212:and 166:its 62:news 380:or 336:or 145:. 45:by 529:: 368:. 315:r3 304:r2 300:r1 290:r3 280:r2 276:r1 515:. 112:) 106:( 101:) 97:( 87:ยท 80:ยท 73:ยท 66:ยท 39:.

Index


verification
improve this article
adding citations to reliable sources
"Word addressing"
news
newspapers
books
scholar
JSTOR
Learn how and when to remove this message
words
byte addressing
bytes

instruction set
cache coherence
cache lines
virtual memory
12 traditional signs of Western astrology
string of text
UTF-8
ASCII
little endian
MIPS
fat pointer
Cray X1
DEC Alpha
Cray X1
C standard

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

โ†‘