What Is Firmware (hint: it's not embedded software!)

Firstly, the word “firmware” is been widely misused over the last couple of decades. What most people think is “firmware” is actually embedded software, for example: your broadband W-Fi router which contains a microprocessor and 99% likely runs some flavour of Linux… Linux is software which is embedded into the device. When you upgrade it, you are changing the embedded software. The abused “firm” part of this is because you can’t simply double click on the router application to launch it from Windows (for example).

Firmware is actually a static configuration of programmable logic. The programmable device (FPGA / CPLD / PLD / PAL) contains 10s, 100s, 1000s or even millions of hardware components, with an even larger number of possible connections between them, and ways to configure each bit of hardware. The Firmware programming file simply defines the state of every individual bit of hardware and all of the connections in between them.

To give a visual example (a picture tells a thousand words) here is a breadboard:

Breadboard

(Source: Cornell University)

Imagine that all of the components on the breadboard are the hardware components of the FPGA (registers / look-up tables / multipliers etc.)... the Firmware is simply a definition of where each of the wires is placed to turn a breadboard with a few components on into a working design.

Of course, confusion then sets in as the source code for the firmware looks a bit like software! A previous head of hardware engineering at a well know mil/aerospace company where I used to work had a brilliant definition of firmware and software (not sure they got it from, but probably some MIL-SPEC doc):

  • Software: is a series of instructions processed sequentially.
  • Firmware: is a series of instructions processed in parallel (as in 100% parallel processing).

If you ignore all the multithreaded / pre-fetch / pre-processing capabilities of modern CPUs, they still basically fetch, decode and execute instructions; however every single one of those components and wires on that breadboard is active, or “processing” 100% of the time. Note that a lot of the times, signals may not change, but that is because their function does not require a change, but the "processing" still takes place to work that out.

For example, take the following VHDL code (just one of many ways of describing this specific hardware function):

do_output: PROCESS(reset, clk)
BEGIN
 IF (reset = '1') THEN
  s_output <= '0';
 ELSIF (RISING_EDGE(clk)) THEN
  s_output <= '0'; -- Default assignment
  IF (enable = '1') THEN
   IF ((input_a = '1') AND (input_b = '1')) THEN
    s_output <= (NOT s_output);
   END IF;
  END IF;
 END IF;
END PROCESS do_output;

In terms of software, this will take many clock cycles with instruction fectches, instruction decodes, instruction executions, variable reads and logical comparisons. However, in terms of firmware, this translates to a D-type flip-flop with a logic gate (or more realistically inside an FPGA would be a 4-input look-up table, which is a common FPGA block).

Firmware Logic

The "code" is simply a language to describe hardware:

  • VHDL = (VHSIC) Hardware Description Language
    • (where VHSIC = Very High Speed Integrated Circuit)

On each and every clock cycle, the entire chunk of code detailed above is "executed" on that clock edge.




Del.ico.us Digg Facebook Google LinkedIn LiveJournal NewsVine reddit StumbleUpon Twitter
Valid XHTML 1.0 Transitional Valid CSS! [Valid Atom 1.0] [Valid RSS 2.0]
[ Page last updated Sun 13th Dec 2020 | viewed 1107 times ]