8
\$\begingroup\$

I noticed while scanning the datasheet for a 23K256 SRAM chip that it has 32768 bytes (+262Kbit.)

The manufacturer clearly identifies this chip as 256Kbit.

Reading through the datasheet it clearly says "32768 x 8" which confirms my scan result - but it doesn't say what those extra 6Kbit are for.

Anyone can shed some light on this:

  1. Why 262 while its rated 256 and the actual documented maximum address is 0x7FFF (32767)?
  2. Can I use this extra space? Is it safe?
  3. Can bits on the SRAM (or maybe bytes) get damaged over time?
\$\endgroup\$
2
  • 3
    \$\begingroup\$ Note that "kilo" is shortened to "k", not "K". \$\endgroup\$ May 12, 2022 at 6:38
  • \$\begingroup\$ perhaps damaged sure from static or other, but single event upsets can flip bits and sometimes there may be parity or ecc. but I think folks have clearly covered the extra bits question (base 10 not 2), and you dont have extra bits....but if you did it would probably be parity or ecc not spares. \$\endgroup\$
    – old_timer
    May 13, 2022 at 1:39

4 Answers 4

15
\$\begingroup\$

There are two kinds of memory: memory where the structure and addressing and continuity clearly demands a number of cells that is a power of two (or at best a small multiple of such), and "bulk" memory where it doesn't. Flash memory is in the middle since the raw cell counts clearly are powers of two but wear management requires setting some of that aside and at least some consumer SSDs routinely store non-binary values in a cell.

The primordial bulk memory are hard disks. Long before prefixes "Ki" and "Mi" were introduced for referring to 1024 and 1048576, respectively (\$2^{10}\$ and \$2^{20}\$, respectively), memory sizes in binary computers were measured in terms of powers of two. This is still the case for RAM: nobody states having a computer having 17GB of RAM even when the exact number are 17179869184 bytes. Flash memory capacities are similarly advertised with powers-of-two based units of raw capacity since "32GB" (actually GiB) as the power-of-two number sounds better than a net bulk size after level wear management of "30GB" or similar.

Hard disk manufacturers were the first to realize that stuff looked better in powers-of-ten based unit multipliers, leading to a long intermediate period where some manufacturers boosted their sizes by diverging from what was in common use (annoying if you try allocating enough sectors to swap out 16GB of RAM).

Now of all current and historical perversions of units, probably the most insulting one is the 1.44MB floppy disk which has an actual size of 1440KiB.

To return to your original question: RAM is consistently specified in terms of unit multipliers based on powers of two as of now, even if the ostensibly more correct "Ki", "Mi", and "Gi" prefixes are not at all consistently employed in marketing and documentation instead of the historic "k", "M" and "G" prefixes.

\$\endgroup\$
22
  • 12
    \$\begingroup\$ Stop spreading that lie that hard disk manufacturers started switching to powers-of-ten for marketing purposes. They have always used the standard prefix. The ones confusing the customers are the operating system manufacturers who can't get their units straight. \$\endgroup\$
    – pipe
    May 11, 2022 at 14:33
  • 4
    \$\begingroup\$ The lawsuit that really made this an issue was against flash drive manufacturers. Look at the fine print on the package and you will see that they explicitly define 1GB = 1,000,000,000 bytes. \$\endgroup\$ May 11, 2022 at 15:33
  • 11
    \$\begingroup\$ @pipe Not "always". I remember 40MB Manchester drives that was actually 40MiB \$\endgroup\$
    – slebetman
    May 11, 2022 at 23:01
  • 3
    \$\begingroup\$ @pipe: The so-called "1.44MB" drive holds 2,880 sectors of 512 bytes each. As for flash devices, a "16MB" flash chip would hold 32,768 sectors of 528 bytes each, but flash devices require a certain amount of "slack space" to operate efficiently. While a drive with the right firmware could store 512 bytes of useful data for each sector, efficient and reliable operation requires that drives have a certain amount of "slack space", so a drive with smaller reported capacity would generally be more useful. \$\endgroup\$
    – supercat
    May 12, 2022 at 7:59
  • 4
    \$\begingroup\$ @pipe: The notion that kb=1024 dates back to literally the first commercial DRAM chip, the Intel 1103 which was one kilobit = 1024 bits back in 1970. I would be rather weird for Operating System vendors back then to use a different definition. \$\endgroup\$
    – MSalters
    May 12, 2022 at 11:35
19
\$\begingroup\$

256 Kbit is referring to the binary power prefix, sometimes referred to as Kib (kilo-binary bits) which is common for memory specification.

So that means it is referring to 256 * 2^10 bits = 262144 bits = 32768 x 8.

\$\endgroup\$
12
  • 3
    \$\begingroup\$ K (originally Ki) should mean 1024 and k should mean 1000 but they are often misused, e.g. a 10K resistor isn't 10,240 Ohms. \$\endgroup\$
    – Finbarr
    May 11, 2022 at 13:06
  • 4
    \$\begingroup\$ @Finbarr: Can you point me to any evidence to back up the "originally Ki" claim? I never saw that prefix until decades after I bought my first computer with "5K" of RAM. \$\endgroup\$
    – supercat
    May 12, 2022 at 8:00
  • 2
    \$\begingroup\$ @supercat "first proposed ... in 1995". I would consider "originally" to be what was used before that, which was definitely not "Ki". \$\endgroup\$
    – mow
    May 12, 2022 at 8:26
  • 3
    \$\begingroup\$ @Finbarr: Since I bought my first "5K" computer in 1980 and the Ki prefix was proposed in 1996, where do you get "originally Ki" from? \$\endgroup\$
    – supercat
    May 12, 2022 at 8:28
  • 3
    \$\begingroup\$ k (lowercase) is an SI standard, as are M and G. But that's for SI units like meters and seconds. The SI standard for information is actually the Joule, which is inconveniently big. Bits are not an SI unit. Memory chips (which are the subject of this question) are standardized by JEDEC, not ISO or IEC, and they define the kilobit as 1024 bits. \$\endgroup\$
    – MSalters
    May 12, 2022 at 11:41
4
\$\begingroup\$

It's the difference between powers of 2 and powers of 10.

RAM chips are always addressed by an integer number of address lines, which makes it natural for them to have capacities that are a power of 2. Early on, someone noticed that 210 (1024) was conveniently close to 1000, so they started using K to represent 1024 instead of the traditional 1000.

As capacities go up, the difference between binary powers and decimal powers gets larger. 1024 vs. 1000 is a 2.4% difference. 1099511627776 (240) vs. 1000000000000 (1012) is a 10% difference. Since RAMs are still constrained to be powers of 2 by the addressing, they're still specified using binary powers. Hard disk makers switched to decimal powers early on, but confusingly the operating systems (such as Windows) report capacities in binary powers leading to much confusion.

\$\endgroup\$
3
\$\begingroup\$

Tom already addressed the first part of your question - regarding the wear and tear you refer in point 3, this is not a failure mode that I am aware of for SRAM (or DRAM for that matter).

You are probably thinking of flash memory, where each write cycle wears the floating gate structure ever so slightly - but in SRAM the memory cell is basically a flop and is not subject to such damage.

Of course it is still silicon, so I guess that over long periods of time the chip can get damaged, for electromigration as an example, but not for reason specific for it being an SRAM chip.

\$\endgroup\$
10
  • \$\begingroup\$ Interesting... So is it a good assumption to say that with SRAM we can assume all the address space is "safe" to use? \$\endgroup\$ May 11, 2022 at 12:39
  • \$\begingroup\$ @ShlomiHassid SRAM does not have a failure mechanism from repeated use. No type of RAM does, as it would defeat the purpose of RAM as something a computer can use as working memory, writing to it every few clock cycles if it wants. If it had the failure mode of EEPROM/flash, normal computer operation would wear out the memory in seconds. \$\endgroup\$
    – Hearth
    May 11, 2022 at 12:54
  • \$\begingroup\$ Thank you for the clarification. \$\endgroup\$ May 11, 2022 at 13:05
  • 2
    \$\begingroup\$ And to protect against other failure modes of D- or SRAM, you can add extra bits for ECC. Usually one extra bit for every eight. Memory modules would still be labeled with their net capacity though, e.g. 1Gbitx72 and the non-ECC 1GBitx64 are both labeled 8GByte even though they technically have 9. \$\endgroup\$
    – mow
    May 12, 2022 at 8:37
  • 1
    \$\begingroup\$ @supercat: But that's really a subcase of the known failure mode of not refreshing often enough, combined with a deficiency in the memory controller that it doesn't map an operation to the correct full set of rows that are degraded and need to refresh. \$\endgroup\$
    – Ben Voigt
    May 12, 2022 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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