Ground Embedded KO Subscribe

Notes / Digital Logic

A taste of FPGAs: designing hardware in code

An MCU executes instructions in order; an FPGA changes the circuit itself. How the two differ and when an FPGA is needed.

GROUND EMBEDDED · NOTEDigital Logic 08A taste of FPGAANDABY

Inside an FPGA (Field Programmable Gate Array) are tens of thousands of small logic blocks and the routing switches that connect them. Load a configuration file and the digital circuit you want is formed inside the chip.

How it differs from an MCU

MCUinstructions 1 → 2 → 3 in turnFPGAcircuits A · B · C at once
An MCU runs instructions in order; in an FPGA several circuits work at the same time.
MCU FPGA
Operation Instructions one at a time, in order Every circuit at the same time
Language C Verilog, VHDL
Strength Easy and cheap to develop Nanosecond response, massive parallelism
Weakness Only the peripherals it comes with Design difficulty and price

What one line of Verilog means

always @(posedge clk) count <= count + 1;

It looks like count++ in C, but this code creates a circuit: "an adder and a register that add 1 on every clock". The biggest shift in thinking is that the code is not executed; a circuit comes into being.

When to use an FPGA

When processing fast ADC data in real time, when synchronising tens of PWM channels precisely, or when an MCU simply has no time, as in pre-processing camera video. Recently, products with an ARM core and an FPGA in one chip (Zynq and others) are also widely used.

FREE PDFGet the 3 free ebooksIf you want to keep reading this topic as one book: BLDC motor control, serial communication and sensors at book length. PDFs are in Korean.Get them free →