mezda
mezda

Reputation: 3637

in what cases memory is byte or word addressable and why

Memory may be byte addressable or word (2 bytes, 4 bytes, etc.) addressable (please correct me if I am wrong here).

Does this (being byte addressable or word addressable) depend on the processor architecture? If yes, in what cases we go for byte addressable memory and in what cases we go for word addressable memory?

And what are the reasons for that? In other words, why is memory byte addressable (in cases it is so) and why word addressable (in case it is so) and the reasons thereof. I saw few questions on byte addressable memory in this site, but none provided answer on these questions.

Upvotes: 5

Views: 1732

Answers (1)

Alexey Frunze
Alexey Frunze

Reputation: 62048

Obviously, different software needs to operate with data/variables of different types and sizes and often times there's a need to operate with several different ones in the same code.

Being able to access those variables directly and as whole, irrespective of the size, simplifies programming as you don't need to glue together, say, 4 8-bit bytes to form a 32-bit value or similarly extract individual 8-bit values from a 32-bit memory location.

There exist processors that aren't very flexible in terms of the natively supported data sizes. For example, fixed-point digital signal processors. Some can only directly access memory as 16-bit words and 32-bit double words. I think the absence of 8-bit byte addressing in them isn't a big problem because they are expected to be doing lots of signal processing instead of being versatile and be suited for general-purpose computing, and signal samples are rarely 8-bit (that's too coarse), most often they're 16-bit.

Supporting fewer data sizes and other features in hardware makes this hardware simpler and cheaper (including in terms of consumed energy), which becomes important if we're talking about thousands and millions of devices.

Different problems need different solutions, hence the variety.

Upvotes: 4

Related Questions