If a CPU has a 16 bit address bus and 8 bit words, how much memory can it address?

23

5

I am studying for a end of semester exam and am confused with the following question. If a CPU has a 16bit address bus and 8 bit words, how much memory in KB's can it address? My understanding would tell me that it can address 64KB, however to do this I just used 2 ^ 16 = 65,536. That calculation never actually took into account 8 bit words so I am not sure if it is correct. Also what does 8 bit words mean?

Cheers

eZ_Harry

Posted 2017-06-06T08:32:32.927

Reputation: 349

16You used it indirectly: the total amount of addressable memory is 2 ^ 16 * 8 bits. Since one byte = 8 bits, that's 2 ^16 bytes, i.e. 65536 bytes, or 64 KiB. Note that K is the SI prefix for 1000. If you mean 1024, use Ki. – jcaron – 2017-06-06T09:31:20.747

2

Mind the difference between SI prefix kilobytes (1,000 bytes) and binary prefix kibibytes (1,024 bytes). 2^16 = 65,536 = 64 kibi ~ 65.5 kilo. The answer sought is probably one where kilo is taken to mean kibi, but there are times when the difference really matters. If you want to be completely certain, take the safe route and specify the number of bytes, and offer translation into more handy units such as kilobytes or kibibytes as a convenience for your teacher. Compare Wikipedia: Binary prefix. Memory chips typically specify eg 65,536x8 bits.

– a CVn – 2017-06-06T14:19:17.327

3

Possible duplicate of How many memory addresses can we get with a 32-bit processor and 1gb ram?

– gronostaj – 2017-06-06T19:30:54.100

You use "8 bit words" to understand that the machine is byte-addressed. – imallett – 2017-06-06T21:23:56.863

3I presume you assume no bank swapping. Most 16 bit CPUs use some form of bank swapping that makes this really hard to answer. – Joshua – 2017-06-06T21:34:38.563

1@MichaelKjörling The question say KB which has always meant 1024 bytes. – kasperd – 2017-06-07T05:32:01.043

@kasperd Except in the SI world, where a lone "k" is shorthand for "kilo" which means exactly 1000. – a CVn – 2017-06-07T06:13:12.650

1@MichaelKjörling The question never said kB. The question says KB, which means 1024 bytes and never had another meaning. KB is not an SI unit. – kasperd – 2017-06-07T06:20:47.793

@kasperd Of course kilobytes is not a SI unit; the SI system of units in this case specifies multiplier prefixes, of which kilo is one, and where it is specified to mean 10^3 or 1000. 2^10 is also a useful multiplier particularly in electronics (of which computers forms a part), but it's not what SI specifies. At least when I read something like "64 KB", I tend not to read this as "sixty-four kay-bee", but rather "sixty-four kilobytes" because that's what's meant by the abbreviation. You can argue about 10^3 ~ 2^10 all day, but that was the entire rationale for the prefix kibi and friends. – a CVn – 2017-06-07T06:26:12.610

Possible duplicate of How to find the largest size of memory?

– a CVn – 2017-06-07T08:28:23.707

1@jcaron ’K’ is the SI unit for kelvin. If you want a prefix for magnitude, be sure to use k – JDługosz – 2017-06-07T09:37:35.923

1@JDługosz oops indeed (slapping self). – jcaron – 2017-06-07T09:40:26.887

@jcaron I think they dropped the degree symbol just to kill the long-running proposal to make capital K a synonym for k. “There — it’s taken. Now are you happy?” – JDługosz – 2017-06-07T09:44:43.377

Actually prefixes and units are different namespaces, as evidenced by m (prefix: milli, unit: meter). There are probably others. – jcaron – 2017-06-07T10:07:20.037

1@kasperd, even though one could argue that KB is necessarily 1024 bytes due to the capital K, how many bytes would you say a MB, GB or TB is? Some people say they are respectively 2^20, 2^30 and 2^40 bytes (usually the case for RAM). Others say they are respectively 10^6, 10^9, 10^12 bytes (usually the case for hard disks). It's always best to avoid ambiguity. KiB, MiB, GiB and TiB are 100% unambiguous. – jcaron – 2017-06-07T10:13:10.080

I sure am glad this whole discussion is relevant to the question. Let's also discuss how he's pluralizing with an apostrophe. – J A Terroba – 2017-06-07T15:15:00.373

@MichaelKjörling Sure KB and kB are usually both pronounced the same even though they are written differently and have different meaning. As long as they are used in writing they are unambiguous. – kasperd – 2017-06-07T19:39:57.937

@jcaron Once you get to larger prefixes it is a mess I'd rather stay out of. When you are designing hardware or software it is more convenient to work with powers of two. And if you are doing marketing it is more convenient to work with powers of 10 as it makes your hardware sound bigger than the powers of tow. That's how MB came to mean 1000000, 1024000, or 1048576 depending on context. – kasperd – 2017-06-07T19:45:56.527

Answers

38

A word, in the majority architectures, is the largest piece of data that can be transferred to and from the working memory in a single operation.

The largest possible address size, used to designate a location in memory, is typically called a hardware word.

So, your CPU will be able to address 64KB (2^16) but will only be able to transfer in a single operation 8 bits.

Overmind

Posted 2017-06-06T08:32:32.927

Reputation: 8 562

3I'm sure this answer is the one the teacher is after, but is it actually correct? Could you not use something like PAE to allow a 3 level hierachy (or even more) to allow CPU's to access more then 64KB? I'm not a hardware expert, but didn't the Commodore 128 even manage to do something like this on an 8 bit word, 16 bit bus by allowing switching of RAM banks ? – davidgo – 2017-06-06T09:09:55.157

No such things as PAE existed at that time. Various tricks and bypasses of a CPU hardware design are certainly not the subject a professor would be interested in. – Overmind – 2017-06-06T09:25:52.613

5Not quite sure I understand your sentence "will only be able to transfer in a single operation is 256B (2^8)"? It can only ever transfer 1 word = 1 byte = 8 bits in a single operation. – jcaron – 2017-06-06T09:29:16.510

The word in the specified case is 8B not 1B. – Overmind – 2017-06-06T09:36:53.423

8@davidgo still PAE requires the address bus to be sized appropriately. Intel CPUs supporting PAE have an address bus of 36 bits. – Dmitry Grigoryev – 2017-06-06T09:46:48.540

6PAE is more or less a brand/feature name specific to modern x86 CPUs. Yes, schemes to indirectly address larger amounts of memory have been implemented for ages (eg XMS), these in the end treat the memory subsystem like a peripheral that can be reconfigured constantly to expose different memory into a smaller address space. Also, see the segmented memory model of old school x86... – rackandboneman – 2017-06-06T10:01:20.253

6@Overmind you should clarify your answer a bit. No-one really uses a single B as a unit and the reason is exactly what's happened here - you're confusing bits and bytes. The OP states "8-bit words* - each word therefore has 8 bits (1 byte) and can only transfer that in one operation. 256 is simply the number of possible values each word has, not how much is transferred. – adelphus – 2017-06-06T10:42:07.767

Correct, it's bits. I thought it somehow was 8B. Does not affect the issue, though. – Overmind – 2017-06-06T11:37:42.797

2@davigo Not just the C128 used banking to address more than 64KiB. That is a common technique in many home computers from that era. – BlackJack – 2017-06-06T15:07:06.387

2Actually, how much data is transferred via the CPU and the RAM in one go is also unrelated to the word size. That would be data bus width. Think of modern Intel CPUs with 64-bit words and 256 or 512-bit bus width. – Dmitry Grigoryev – 2017-06-06T15:16:40.163

1I'm not voting-up because you said 64KB instead of 64KiB. If you change it to the technically correct 64KiB, ping me and I'll up-vote. – Makyen – 2017-06-06T15:38:52.697

3Downvoting because the amount of memory that can be transferred in a single operation and the unit of address resolution are distinct concepts that you're conflating. It's quite common for those sizes not to match. The other answer is more accurate. – user2357112 supports Monica – 2017-06-06T17:33:23.307

So, in your case, word is a synonym of data bus width? 8 bit words = 8 lanes data bus? – Thomas Weller – 2017-06-07T05:18:19.103

Yes. Generally, a lane can carry one bit per cycle in each direction so an 8-lane data bus will carry 8 bits, like in the case of PCI-E. – Overmind – 2018-11-02T10:58:08.200

21

A machine word, or commonly just word is the largest unit of data that the CPU can manipulate as a whole using common instructions. This has nothing to do with memory addressing.

What matters is the unit of address resolution, which is commonly an 8-bit byte even on 16/32/64 bit architectures. It doesn't have to be equal to the machine word size, but it probably is in your case.

An 8-bit addressable unit combined with 16-bit address bus amounts to 64KiB of RAM that the CPU can address.

Dmitry Grigoryev

Posted 2017-06-06T08:32:32.927

Reputation: 7 505

3But I have used machines where the unit of address resolution was 16 bits. (So the concept is meaningful.) – Martin Bonner supports Monica – 2017-06-06T12:25:00.467

4@MartinBonner Nevertheless, it is not directly related to the CPU word size. – glglgl – 2017-06-06T15:10:04.880

1@glglgl - It's very related. I don't believe there are any architectures that don't have an address unit of either 8 bits or their word size. – Jules – 2017-06-07T01:07:00.083

1I disagree with the statement that a word is the largest unit that the CPU can manipulate as a whole. The Intel i7 has a 64 bit data bus and can still use 256 bit SIMD instructions. If Wikipedia is correct, then word refers to the data bus width and not to CPU internal stuff. – Thomas Weller – 2017-06-07T05:30:29.723

@ThomasWeller SIMD doesn't manipulate its registers as a whole, that MD part stands for multiple data. But I'll take your point. BTW, are you suggesting that i7 CPUs have a data bus which is only 64-bit wide? – Dmitry Grigoryev – 2017-06-07T08:32:14.763

@Jules Check out PDP-10 and IBM 1620. – Dmitry Grigoryev – 2017-06-07T08:59:15.163

1@ThomasWeller: 8088 has 8 bit data bus, but still a 16-bit instructions. In fact it is a 8086 with a smaller databus. Note: the width of databus and the actual transfer is also different (think misaligned data). – Giacomo Catenazzi – 2017-06-07T16:15:06.867

@ThomasWeller many "32 bit" CPUs had external busses wider than 32 bits. Afaict "word size" most commonly reffers to the size of the main core registers (excluding things like floating point and SIMD) – plugwash – 2017-06-13T10:36:27.790

TMS34020 can address individual bits: "The 4-gigabit (512-megabyte) physical address space is addressable on bit boundaries using variable-width datafields (1 to 32 bits)." – feos – 2019-05-05T10:11:13.583

1

Also what does 8 bit words mean?

In context, the word size goes with the address size to describe the memory bus. There are 16 bits gling out to the memory so it can choose 64ki locations. Then, each location contains 8 bits.

The word size here may or may not match the CPU computation unit size, and this may or may not match the logical granularity in addressing.

For example, a CPU may advertise a 16-bit bus (for this purpose). It uses 16-bit addresses in its instructions, and like your example has 64ki. But it has 15 bits of address bus and 16 bits of data bus. It only needs 32ki addresses and always gets 2 bytes with each location. (If an instruction wanted 1 byte, it would dispatch the address with the least bit missing, fetch both bytes in that step, then look at the least bit of the desired address to decide which half to use.)

Note that bank switching, PAE, etc. mentioned by others are not relevant here. A memory management unit might use 16-bit addresses and have 20-bit hardware address, so the CPU needs to switch and map things to make use of the actual 20-bit address range of RAM chips that can be addressed.

Be sure to specify units in your answers. “64ki”. Of what? 8-bit words, making it (still) 64ki bytes of addressable RAM. That step eliminates confusion and makes problems like this trivial.

JDługosz

Posted 2017-06-06T08:32:32.927

Reputation: 597

0

You have to use word size in calculations as well. The answer is 64 KB.

You can address 2^16 words and each word is 8 bit (= 1 byte). Therefore it is 64 KB.

If the word size was 16 bit. The answer would be 128 KB.

Nuri Tasdemir

Posted 2017-06-06T08:32:32.927

Reputation: 101

1Your calculation doesn't hold for common 32-bit CPUs which still can address 2^32 bytes of memory (4GB), not (2^32)*4 (16GB). – Dmitry Grigoryev – 2017-06-07T08:53:20.827

Modern CPUs address larger “rows” and have fewer address lines to match. The question speaks of address bus the physical side of things. So multiplying by the word size of that bus (not the CPU register size) is correct. – JDługosz – 2017-06-07T09:20:29.957

0

There are two sides to this, what your instructor probablly wants you to tell him and what the reality is.

First what your instructor probablly wants you to tell him.

"16 bits can address 2^16 memory locations, each location is 8 bits. So we can address a 524288 bit (65536 octet) memory."

This however reflects a rather oversimplified worldview. The reality is more complicated and to give a definitive answer requires more information. Some of the ways in which real systems can be more complicated than this include.

  • Many processors do not have a dedicated IO map, so parts of the memory address space may need to be used for things other than memory.
  • The "word size" of the processor is not nessacerally the same as the width of the memory data bus or the smallest addressable unit of memory.
  • Some busses allow the movement of varying size data units. This requires further addressing which may or may not be handled by bits of the main address bus.
  • Some busses multiplex different signals on the same lines. For example SDRAM uses the same address lines twice to send a "row address" and a "column address".
  • Many systems used bank switching approaches to allow programs to access more memory than the processor could natively address.

plugwash

Posted 2017-06-06T08:32:32.927

Reputation: 4 587