9
\$\begingroup\$

After reading a computer hardware course on BIOS/CMOS, I'm still unable to determine the reason why the BIOS' ROM chip isn't built using CMOS technology, and why it is connected to a separate chip called "CMOS" for storing the configuration information.

This is from the lecture note:

Programs are stored on the system BIOS chip, while the changeable data is stored on a CMOS chip

CMOS Group of Hardware: Hardware that is common, necessary but may change – RAM, hard drives, floppy drives, serial and parallel ports

I know that the BIOS is stored in a flash memory, and that CMOS MOSFET technology dissipates less power compared to other implementations.

Why is it only the BIOS ROM that doesn't use CMOS, like other storage devices - what exactly is the advantage? And why can't the BIOS configuration information be stored in its own ROM chip instead of the "CMOS chip"?

\$\endgroup\$
  • 1
    \$\begingroup\$ Doesn't the CMOS require a battery to retain the data? It's one thing losing the config and clock settings when the battery dies but it would be a disaster if the BIOS was lost. You might edit your last sentence. I can't figure out what you're asking. \$\endgroup\$ – Transistor Jul 8 '18 at 16:55
  • 1
    \$\begingroup\$ Bios is ROM while settings are RAM \$\endgroup\$ – Sunnyskyguy EE75 Jul 8 '18 at 16:57
  • 1
    \$\begingroup\$ @Kais no part of a ROM is writeable. It's contrary to the very meaning of the term. In between technologies - Eraseble Programmable ROM's started to make what you are proposing possible, and now that in circuit programming is simple, this in fact is often done. But at the same time, keeping a low power corner of a chip alive on battery to be a clock and retain some settings has also become possible, so that is also an option utilized in some systems. \$\endgroup\$ – Chris Stratton Jul 8 '18 at 17:14
  • 2
    \$\begingroup\$ "ROM" means "Read Only Memory". It is by definition not writeable. Typically an actual ROM involves customizing the metallization layers or even the actual constituent transistors. In contrast there are many sorts of "Read Mostly" memories (PROM, EPROM, EEPROM, Flash, etc) which can have their contents altered, but with more limitations to speed and number of times than a RAM. Typically today you only find a true ROM inside a processor (and even then it might just be something you are locked out of writing), while an external device is going to be writeable with the right connections. \$\endgroup\$ – Chris Stratton Jul 8 '18 at 17:26
  • 1
    \$\begingroup\$ For example, in a modern system you may have a small ROM inside the processor which knows how to read the contents of a serial NOR flash into memory, and start executing them. The BIOS in the NOR flash is then exposed to upgrade, while the small boot stub that copies it from flash to RAM and jumps into it is permanently fixed at the time of chip manufacture. \$\endgroup\$ – Chris Stratton Jul 8 '18 at 17:31
33
\$\begingroup\$

You're mixing up implementation technology with colloquial terms for functionality.

CMOS - Complementary Metal Oxide Semiconductor - is a method of making logic and related circuitry using both N-Channel and P-Channel field effect transistors. One of its defining characteristics is extremely low static power consumption - power is almost only used when changing state. As a result, a CMOS static memory chip can retain its contents for years on a battery, and is a handy place to store semi-permanent information.

BIOS and related startup code has traditionally been stored in PROM or EPROM devices. EPROMs in the era of the IBM PC were typically made in pre-CMOS technologies like NMOS, but the critical distinction is that these were not typically writeable when installed in the computer, but only in a special programmer. Further while many contemporary systems and clones used EPROMs, the actual production versions of the IBM-PC used cheaper non-reprogrammable PROMs (pinouts were typically compatible in use).

The PC-AT design then added a battery backed CMOS memory for storing customizable settings, and also (perhaps in the same device) a persistent real time clock. This came to be colloquially referred to by end-users as CMOS, though it was of course only a particular usage enabled by a then rapidly spreading chip technology.

Today of course we no longer use parallel E/PROMs for BIOS, but rather use serial NOR flash and transfer the contents into faster RAM for execution. Modern FLASH chips are in fact made of CMOS-derived technologies. And they typically can be reprogrammed in circuit. It's really up to the system designer if they want to put semi-permanent configuration information in a battery backed RAM, or in reprogrammable flash - the end user or post-boot operating system may have little actual visibility into a distinction.

But even if flash is used for settings, there's still typically going to be a low power real time clock that keeps running on battery.

\$\endgroup\$
  • 1
    \$\begingroup\$ When the CPU is first starting up, the RAM isn't even initialized (DRAM init is complex). All it does is execute code at a specific location (usually it's the BIOS chip over SPI, but supposedly you can program subsequent boots to look for the BIOS over legacy PCI or LPC for debugging reasons). The only thing that is put into RAM is stuff like the IVT (Interrupt Vector Table) and related code that's only useful before switching out of real mode. The actual BIOS execution when the CPU is booting does not happen in memory. See wiki.osdev.org/System_Initialization_(x86) for more details. \$\endgroup\$ – forest Jul 10 '18 at 3:54
  • 1
    \$\begingroup\$ @forest - that's unlikely to be true, and is not actually supported by the rather broad description at your link. It may end up executing out of some repurposed cache ram or something, but execution directly from SPI just doesn't work very well, and it's extremely likely to be avoided. It's then quite obvious that once the main system RAM is up the bios is going to execute out of that - such shadowing was common even in the days of parallel EPROM bios. \$\endgroup\$ – Chris Stratton Jul 11 '18 at 4:07
  • 1
    \$\begingroup\$ Yes, once the main memory is initialized, the IVT, BDA, EBDA, etc are copied over there. Before that however, it is executed directly. It is not executed in cache (that would be CAR mode, Cache-As-RAM, which requires explicit initialization by the BIOS). \$\endgroup\$ – forest Jul 12 '18 at 2:25
  • 1
    \$\begingroup\$ Please see stackoverflow.com/questions/5300527/… which explains this in more detail. In particular, how the BIOS boot block is executed directly over SPI. This is possible by mapping that area of the BIOS to memory (of course, before memory is actually initialized, so it's just like MMIO). So it's not just likely to be true, it is true. \$\endgroup\$ – forest Jul 12 '18 at 2:30
  • \$\begingroup\$ Chris Stratton, "but rather use serial NOR flash and transfer the contents into faster RAM for execution" And how exactly do you envision this "transfer of content" other than executing some initial "data move" code directly from SPI? \$\endgroup\$ – Ale..chenski Jul 13 '18 at 23:24
12
\$\begingroup\$

Back when the PC was first invented, most of the logic on it was power-hungry NMOS and TTL chips. CMOS was very new and the only circuits in the PC that used it were associated with things that needed to run on battery when the power was off, such as configuration RAM and the real-time clock.

Nowadays, nearly all of the logic is CMOS, including the power-hungry CPU and the flash EEPROM that holds the BIOS. So in a sense, your question is based on an invalid premise — the flash EEPROM is CMOS. However, for whatever reason, the term "CMOS" in a PC still refers to only the RAM and RTC functions.

If you're asking why the BIOS isn't stored in volatile RAM rather than nonvolatile flash, that's because batteries fail, and erasing the BIOS would effectively "brick" the computer, requiring specialized hardware to get it going again.

\$\endgroup\$
  • 1
    \$\begingroup\$ "So in a sense, your question is based on an invalid premise — the flash EEPROM is CMOS" - The phrase "Programs are stored on the system BIOS chip, while the changeable data is stored on a CMOS" confused me a bit, now I have understood. \$\endgroup\$ – Kais Jul 8 '18 at 17:45
  • \$\begingroup\$ "If you're asking why the BIOS isn't stored in volatile RAM rather than nonvolatile flash, that's because batteries fail" No, I mean the opposite - why the information on CMOS chip isn't stored in the BIOS flash. \$\endgroup\$ – Kais Jul 8 '18 at 17:46
  • 3
    \$\begingroup\$ @Kais because a flash memory cannot be arbitrarily overwritten, and managing rewriting whole pages of flash memory complicates things in an error-prone way. Also, there are things like event logs stored by some BIOSen, this comes with the hazard of wearing out your flash and/or ending up with corrupted data if the power fails in the wrong moment. True EEPROM memory would be possible - but a) it is SLOW to write, and b) you have a low-power battery for the clock anyway. \$\endgroup\$ – rackandboneman Jul 9 '18 at 15:11
  • 1
    \$\begingroup\$ ... also because the entire system was designed before flash was commonly available, so the BIOS was stored in either PROM (which uses fuses to determine whether each bit is a 1 or 0, and can only be changed from 1 to 0 but not back again) or masked ROM (which uses a layer of metal wires overlaid over the chip to program it and can't be modified at all after manufacture), so a separate device was necessary, and everything has needed to retain backwards compatibility since then. \$\endgroup\$ – Jules Jul 10 '18 at 1:14
8
\$\begingroup\$

I think you are confusing two usages of the "CMOS" acronym. There are chips built entirely of the complementary MOS transistor technology. In fact almost all chips these days are built this way including much of the digital control circuitry on a Flash chip.

The other usage of CMOS has persisted in the PC industry since the earliest days to refer to the chip that stored some settings and the real time clock with an attached battery. Back in those days (early '80s) the bulk of the large chips in a PC were NMOS technology and the miscellaneous logic chips were bipolar transistor logic (TTL, LSTTL etc). The only CMOS chip used was the RTC chip and so became known as "the CMOS".

These days the RTC is no longer a separate chip on a PC architecture device. Instead it is built right into the motherboard chipset (which incidentally is produced with complementary MOS circuitry). It is rare that any BIOS these days uses the legacy battery backed RAM in the RTC part of the chipset to store settings. Instead the BIOS uses a few pages of the SPI Flash storage device to save its settings in a non-volatile way. As such there are minimal settings that get lost in a PC when the battery runs down or is disconnected. The minimal settings that are lost on battery power removal are certain ones that control the power up and reset behavior of the chipset and are in fact not even stored in battery powered RAM cells but instead in special low power flipflop latches that are powered from the coin cell battery.

\$\endgroup\$
2
\$\begingroup\$

See also https://superuser.com/questions/989499/what-does-a-cmos-chip-look-like : this provides us with a handy link to the original MC146818 datasheet.

This chip was memory-mapped in and provided 64 byte locations. 14 of these were for the clock, leaving the rest as general-purpose RAM. The whole chip was kept powered by the battery while the PC was off, in order to keep the real-time clock ticking.

\$\endgroup\$

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.