9

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"?

user6039980
  • 271
  • 3
  • 8
  • 1
    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. – Transistor Jul 08 '18 at 16:55
  • 1
    Bios is ROM while settings are RAM – Tony Stewart EE75 Jul 08 '18 at 16:57
  • @Transistor Ah, I understood. thanks. I have just made an edit - does the second question make more sense now? – user6039980 Jul 08 '18 at 17:04
  • You've answered it yourself. "*And why the BIOS configuration information can't be stored in its own **ROM** chip ...*" You can't write to a **read-only** memory (ROM) chip so you can't save the configuration. – Transistor Jul 08 '18 at 17:06
  • @Transistor I mean writing the informations such as boot sequence to a particular address space within the ROM (that is physically writable). – user6039980 Jul 08 '18 at 17:09
  • 1
    @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. – Chris Stratton Jul 08 '18 at 17:14
  • @ChrisStratton I understood that a second part is needed for saving the clock information. But I don't understand why you said that "no part of a ROM is writeable", while BIOS flashing exists today? – user6039980 Jul 08 '18 at 17:23
  • 2
    "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. – Chris Stratton Jul 08 '18 at 17:26
  • 1
    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. – Chris Stratton Jul 08 '18 at 17:31
  • @ChrisStratton So you mean that the flash memory storing the BIOS cannot be called ROM? And rather must be considered as flash memory device? – user6039980 Jul 08 '18 at 17:35
  • 1
    If I take a flash chip and break off the write enable pin and hand it to you, what do you call it? If I put it on a board where that pin is wired disabled, or can only be enabled via a jumper that is not installed, what do you call it then? Re-writeable memories can impersonate permanent ones until their captured charge leaks, or someone wires up the write pin or uses a suitable variety of ray gun on them. If you specify a ROM inside an FPGA design, what you get is a RAM with the write signal disabled - then impersonation only holds as long as it is powered and you don't violate timing (!) – Chris Stratton Jul 08 '18 at 17:40

5 Answers5

35

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.

Chris Stratton
  • 33,282
  • 3
  • 43
  • 89
  • 1
    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 https://wiki.osdev.org/System_Initialization_(x86) for more details. – forest Jul 10 '18 at 03:54
  • 1
    @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. – Chris Stratton Jul 11 '18 at 04:07
  • 1
    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). – forest Jul 12 '18 at 02:25
  • 1
    Please see https://stackoverflow.com/questions/5300527/do-normal-x86-or-amd-pcs-run-startup-bios-code-directly-from-rom-or-do-they-cop 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. – forest Jul 12 '18 at 02:30
  • 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? – Ale..chenski Jul 13 '18 at 23:24
  • @AliChen - on embedded systems, the initial transfer is typically a built-in function of the chip, presumably either a state machine or a small fixed boot routine in on-chip ROM. Typically this would transfer a fixed sized block which should contain a custom loader stub, which would typically configure DRAM and then transfer the rest of a full-capability bootloader or bios or the operating system kernel. Many modern FPGAs can do this too, automatically operating an SPI flash to read their configuration bitstream. – Chris Stratton Jul 13 '18 at 23:35
14

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.

Dave Tweed
  • 168,369
  • 17
  • 228
  • 393
  • 1
    "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. – user6039980 Jul 08 '18 at 17:45
  • "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. – user6039980 Jul 08 '18 at 17:46
  • 3
    @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*. – rackandboneman Jul 09 '18 at 15:11
  • 1
    ... 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. – Jules Jul 10 '18 at 01:14
9

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.

Michael Karas
  • 56,889
  • 3
  • 70
  • 138
3

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.

pjc50
  • 46,540
  • 4
  • 64
  • 126
1

You're confusing the BIOS ROM chip technology with the CMOS non-volatile user configuration data.

PCs traditionally use EPROMS for the BIOS (now often stored in Flash memory instead and far easier to upgrade). Whether they are fabricated using CMOS or NMOS technology only affects their power usage.

Whilst a CMOS EPROM may have lower operating current than an NMOS type, it's still significant. I recall testing some EPROMS back in 1985 when CMOS was first rearing its head in microproceesor technology. A CMOS 27C64 had operating current of ~20mA whereas as NMOS 2764 typically used 50mA.

The 'CMOS user data' is entirely unrelated to the BIOS chip itself although your confusion is somewhat understandable as the data is presented at the setup level. This data is stored quite separately from the BIOS chip itself in a dedicated battery backed-up chip, usually incorporating the Real Time Clock which is indeed fabricated in CMOS for very low power consumption.

Even the RTC didn't exist in early PCs. You needed to input the time of day at boot time !