[FFmpeg-user] FPGAs

Mark Filipak markfilipak.windows+ffmpeg at gmail.com
Wed Mar 4 17:13:07 EET 2020


I thought further and decided to redo my FPGA presentation with better 
analogies. I hope you enjoy it.

Starting with the basics: Logic gates come in 2 flavors: AND and OR; and 
it's from them, alone, that all other digital elements are made.

FSMs (finite state machines) are complex combinations of logic gates 
that execute (i.e., change state) sequentially. A particular FSM's 
sequence is determined by 2 things: 1, external input conditions, and 2, 
the FSM's current state.

CPU core units (code cracker, execution unit, cache controller, etc.) 
are special-purpose FSMs. You can visualize an FSM as a player piano and 
a CPU core as a group of player pianos.

Microcodes: Microcodes are 'piano roll' sequences that 'play' CPU core 
unit 'pianos'.

Machine codes: Machine codes cause the microcode 'piano rolls' to be 
switched en masse: As each particular machine code arrives at the CPU, 
all the microcode 'piano rolls' are switched to the rolls that, given 
the current state of the CPU's execution unit, are appropriate for 
'playing' that particular machine code's 'tune'. It's that switching 
that makes CPU core units different from ordinary FSMs.

The only CPU core unit 'piano' that doesn't change its 'tune' is the 
code cracker. The code cracker's microcode 'piano roll' never changes 
because the code cracker is the 'piano' that switches the 'piano rolls' 
of the other 'pianos', and how it accomplishes that never changes. What 
does change is the identification of the new, replacement 'piano roll' 
that's swapped in. That identification is embedded in the machine code.

Thusly, CPUs differ from fixed sequential machines: CPUs self-modify. 
Note that the self-modifying is not permanent but persists solely for 
the current machine code cycle, then changes for the next machine code. 
The code cracker can do this because of fields embedded in machine codes 
and the execution unit's current state.

Machine codes: All programs must be converted to machine codes prior to 
arriving at the CPU. They can be converted in advance (e.g., "compiled", 
such as written in 'C') or converted on the fly (e.g., "interpreted", 
such as written in Python).

Thusly, programs are layers removed from machine code and machine code 
is layers removed from microcode.

Returning to the basics, FPGAs are collections of uncommitted logic 
gates that can be configured to make anything that can be made with 
logic gates. In addition to a sea of gates, some FPGAs contain hand 
crafted (compact) peripherals (e.g., SPI, HDMI) and even CPUs (e.g., ARM).

SoS (software-on-silicon) vendors, such as NGCodec, design the 
particular configurations that turn FPGAs into dedicated chips that 
perform specific tasks such as processing video streams. The designs can 
be in the form of, 1, 'hard-wired' FSMs (difficult design, longer 
development, later to the market, but wicked fast), or 2, additions to 
an on-chip CPU (easier design, shorter development, sooner to the 
market, but slower).

Of course, processing video streams can be done in a computer's CPU. 
That's what ffmpeg does.


More information about the ffmpeg-user mailing list