I'm working with a Fujitsu microcontroller and I think I'm a bit rusty on the following details, that's why I'm asking this question. I have the following specs:

  • 4M-bit flash memory
  • Built-in product: MB90F345E(S), MB90F345CE(S)
  • volume: 512 Kbytes/256 Kwords
  • Sector configuration: 64K × 6 + 32K × 2 + 16K × 2 + 8 K × 4
  • Allocated bank: F8H to FFH bank

They seem to magically create 12K bytes of extra ROM memory? What quirk am I missing here?

  • 7
    \$\begingroup\$ 512 Kbytes = 512 * 8 Kbits = 4096 Kbits = 4 Mbits \$\endgroup\$ – John Dvorak Nov 14 '14 at 13:55
  • \$\begingroup\$ Googling: "512 kb to megabit" gives me 512 kb = 4.096 Mbits. And that's getting rounded off to 4 Mbits? \$\endgroup\$ – Evert Nov 14 '14 at 14:00
  • 4
    \$\begingroup\$ Try googling "512 kib to mibit" instead. \$\endgroup\$ – fgb Nov 14 '14 at 17:48
  • 3
    \$\begingroup\$ In technical context, Kbytes and M-bit usually refer to what is to avoid ambiguity refered to as Kibibytes and Mebibits \$\endgroup\$ – njzk2 Nov 14 '14 at 19:25
  • 3
    \$\begingroup\$ Also note that in a technical context, there is a very big difference between B and b. What the title says is really "4 megabit != 512 kilobit?", which of course doesn't make sense. What you wanted is 4 Mbit != 512 KB? which makes more sense, depending on whether you are using binary or decimal prefixes. \$\endgroup\$ – a CVn Nov 15 '14 at 17:10

If you look at the memory map, there are actually 524,288 bytes of ROM, which is 512K (where 'K' refers to 1024, not 1000)- btw, I got that by subtracting the start address 0xF8000 from the end address 0xFFFFFF and adding one.


That's 4M (where 'M' is 1024 * 1024 = 1,048,576, not \$10^6\$ = 1,000,000).

It's usually pretty clear what's going on from context, so this seldom causes confusion (especially when there appears to be more memory than you expected), however consumer disk drive capacity is a notorious example of using 'marketing' units that make the product look more favorable by around 5-10%.

Edit: As various prescriptivists here have mentioned there are "official" units like MiB that ought to get rid of the ambiguity, however since virtually nobody uses them I think they would likely cause more confusion in most cases (and obviously the data sheet authors felt that way). The question is about correctly interpreting what was written in a data sheet, not what terminology you should use when writing a datasheet yourself.

| improve this answer | |
  • 2
    \$\begingroup\$ +1, always look at the memory map (or find a stat without "k" or "M") if you need to know exactly what's going on (memory options are not sized 10% apart, but rather by factors of 2). "60k" in many micros is not 60 * 1024, but often somewhere between 60000 and 61440 because some of that 1440 is taken up by HW registers. \$\endgroup\$ – Nick T Nov 14 '14 at 19:51
  • \$\begingroup\$ @NickT Yup, and sometimes there might be a "hole" where there is memory-mapped I/O, RAM or something else. \$\endgroup\$ – Spehro Pefhany Nov 14 '14 at 20:42

The early computer engineers chose to adopt, and adapt, SI prefix units to their data counts. These are the same prefixes, but counting using binary rather than metric. Since 2^10 is close to 10^3, then each SI prefix normally increasing an amount by 10^3 instead refers to an increase of 2^10:

Prefix  Metric prefix        Binary prefix       Difference
k kilo  10^3=1,000           2^10=1,024           2.4%
M mega  10^6=1,000,000       2^20=1,048,576       4.9%
G giga  10^9=1,000,000,000   2^30=1,073,741,824   7.4%
T tera  10^12                2^40                10.0%
P peta  10^15                2^50                12.6%

These were adopted as part of the JEDEC standards.

This has a number of benefits since a lot of work in this field happens in powers of 2. However as you can see they diverge from metric, and since we are now dealing with larger amounts of storage where the difference between the two diverges significantly the problem has been dealt with by IEC and NIST. These differentiate the two systems by changing the binary prefix:

Prefix  Binary prefix
ki kibi  2^10
Mi mebi  2^20
Gi gibi  2^30
Ti tebi  2^40
Pi pebi  2^50

These were first standardized in 1998, and adopted into the International System of Quantities in 2008, but adoption is slow, and there are still companies creating new documents using the old standard. Where companies have switched, they've found users confused and some have switched back to the older style.

Thus, using the older standard, 4Mb is 4 * 2^20 bits, which is equivalent to 512 * 2^10 bytes.

Represented in the newer standard, it would instead be 4Mib = 512 kiB, assuming 'b' is bits and 'B' is bytes.

| improve this answer | |
  • \$\begingroup\$ According to this, it was standardized in 1998. \$\endgroup\$ – glglgl Nov 15 '14 at 10:46
  • 1
    \$\begingroup\$ It may be a standard, but everybody likes it. As noted, there is plenty of older documentation which, in theory, the companies should change (you could compare this to the cost of the USA converting to the Metric system). This question, and answers, become a good reminder of what terminology we SHOULD be using. \$\endgroup\$ – Alan Campbell Nov 16 '14 at 0:49
  • \$\begingroup\$ @glglgl The IEC and otheres defined them in 1998, but it wasn't until 2008 that the IEC prefixes were incorporated into the International System of Quantities. I've updated the answer slightly. \$\endgroup\$ – Adam Davis Nov 17 '14 at 12:47

In context of memory capacities MB often means 1024KB (instead of 1000K). You can use MiB in order to avoid ambiguity.

| improve this answer | |
  • \$\begingroup\$ That said, I've heard some hard drive manufacturers use 1000. It's really muddy sometimes but really should be 1024. \$\endgroup\$ – DKNguyen Feb 19 '19 at 15:17

The age old powers of 2 vs powers of 10 debate. Companies have lost millions in lawsuits over it. Binary vs decimal prefixes causing you to lose 24 bits per kilo really adds up in giga bits and bytes. Which is why my 120 gb hard drive (manufacturer rating) only has 115.8 gb or so (computer display)

http://en.m.wikipedia.org/wiki/Binary_prefix has a full explication.

| improve this answer | |
  • 2
    \$\begingroup\$ Don't forget the old workhorse "1.44 MB" floppy disks. Which were 1.44 times 1000 times 1024 bytes (1,474,560 bytes). Double confusion! \$\endgroup\$ – a CVn Nov 15 '14 at 17:15

When talking about RAM, ROM, or anything connected in any way to the buses of a CPU:

  • One kilobit is 1024 bits.

  • One megabit is 1024 kilobits.

  • 4 megabits is 4096 kilobits.

  • 4096 kilobits is 4194304 bits.

  • One byte is 8 bits.

  • 4194304 bits is 524288 bytes

  • One kilobyte is 1024 bytes

  • 524288 bytes is 512 kilobytes.

It's all because of \$2^n\$.

| improve this answer | |
  • 2
    \$\begingroup\$ Googling "4 megabits to kbit" gives me 4000 kilobits? I think this wiki page explains the ambiguity: en.wikipedia.org/wiki/Binary_prefix \$\endgroup\$ – Evert Nov 14 '14 at 14:27
  • 5
    \$\begingroup\$ The difference stems from hard drive manufacturers using 1000 for kilo/mega etc (to make the drives look bigger), whereas everything else digital storage wise uses 1024. It's purely to combat this confusion that the Mibibyte etc (MIllion BInary BYTEs) was invented. \$\endgroup\$ – Majenko Nov 14 '14 at 14:35
  • 2
    \$\begingroup\$ -1: strictly speaking, I wouldn't say so far as to say "one kilobyte is 1024 bytes" - it can be as well 1000 bytes (ISO/IEC80000 being one of the contexts) or 1024 bytes (common usage, binary SI); as such, I can't agree with this answer unless you include the information from Your comment (kibibyte etc) in the answer itself. Also, 1000 for kilo is not from HD OEMs (although it's most common for them) - it's from SI prefix table, which predates today's CS and computers by at least half a century (ca. 1950-1960) \$\endgroup\$ – user20088 Nov 14 '14 at 16:06
  • 3
    \$\begingroup\$ @vaxquis: Half a century is an understatement. 'Kilo' derives from the Ancient Greek word for thousand, predating SI by millenia. \$\endgroup\$ – Marcks Thomas Nov 14 '14 at 16:32
  • 3
    \$\begingroup\$ @vaxquis SI doesn't define a byte nor a bit, thus usage of kilo with them is not defined by it. It's instead defined by JEDEC Standard 100B.01. \$\endgroup\$ – Ruslan Nov 14 '14 at 18:47

Unfortunately the computer industry uses the kilo and mega prefixes inconsistently.

Semiconductor memory tends to come in power of two sizes, because it makes the address mapping simpler. 1024 is close to 1000 so those working with semiconductor memory started to use kilo to mean 1024. As memory sizes got larger they also started using mega to mean 10242=1048576 giga to mean 10243=1073741824 and so-on.

Under these definitions of kilobyte and megabyte your manufacturers statement matches up. 4 binary megabits equals 4096 binary kilobits equals 512 binary kilobytes.

However other parts of the computer industry, in particular hard drive manufacturers and designers of communication interfaces used the SI prefixes in their original meanings. Manufacturers of disk-like flash media also tended to follow this convention.

Some parts of the industry even mixed the two, for example a "1.44MB floppy" is actually 1.44*1000*1024=1474560 bytes

The IEC tried to fix the mess in 1998 by introducing specific names and symbology for the binary prefixes, the names are formed by taking the first two letters of the name of the SI unit and appending "bi", so kilo becomes kibi, mega becomes mebi and so-on. For the symbols an "i" is added so k becomes ki, M becomes Mi and so-on.

However, just because a standards organization introduces terminology doesn't mean people actually use it. At least in my experience it is still far more common to see kilo, mega etc used in a binary sense than it is to see kibi, mebi etc.

| improve this answer | |

As everybody else has already explained, you're probably suffering from a halfcentury-old hack by IEC et al, which continues to generate massive confusion. Rather than introduce a new unit of the same dimensionality (or a prefix), they redefined the meaning of another widely used unit (prefix), at the same time failing to clearly establish which definition applies in which context.

In case of your specific problem, just inspect the memory maps as mentioned.

However, I urge you guys to recognise a far more general problem.
The problem is that saying 123 kB doesn't reliably lead to crystal-clear understanding on the recipient side.

This is a linguistic legacy, and a major API deficiency of the CS vocabulary.

What can we do to solve that?

Well, guess what: use binary prefixes.
Meaning of 123 kiB is 100% reliably crystal clear.
Meaning of 123 kiB (126.0 kB) is even better.
You don't have to be a CS historian just to convey some big numbers to someone.
Nobody cares about companies, hard drives, standartization bodies, deprecation statements, and so on and so forth.
It's not worth it. Just use the binary mebibytes. They are unambigous.

There are people who've been successfully saying 32 kibihertz in 2002. They have been heard. Amazingly convenient, huh?

Finally, if you refuse to embrace binary prefixes — you make the problem worse.
The only strategy we all can cooperate with in order to deescalate and fix that damn linguistic bug is deprecating ambiguity and switching over to kibi...seconds (why not?) and other bi-units.

| improve this answer | |
  • 1
    \$\begingroup\$ Wow! I must remember to use kibihertz more! \$\endgroup\$ – pipe Feb 19 '19 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.