FPGA stands for Field-Programmable Gate Array, which is a type of programmable logic device.
1. Comparison with Microcontrollers
Different Structures:
1.1 The number of pins, resources, and internal multipliers in a microcontroller is fixed, meaning its hardware is predetermined. Its functions can be achieved through software programming.
1.2 In contrast, the internal circuitry of an FPGA is not fixed; it can be reconfigured through programming to change the internal structure of the chip. The number of internal multipliers, dividers, and registers can all be altered via programming.
Summary:
A. Microcontrollers do not alter their hardware structure but achieve required functionalities by changing the order of instruction execution (instructions include read, write, or jump instructions).
B. FPGA programming and design are aimed at altering the internal hardware circuit structure of the chip to achieve required functionalities.
Different Considerations:
1.3 When programming a microcontroller or computer, timing considerations are not necessary; as long as there is a function, the programming code can achieve the desired functionality. Writing a function and repeatedly calling it can accomplish many tasks.
For example, a function might take an hour on a microcontroller, but an FPGA could take a day or even months. This is because FPGA design requires not only functional consideration but also circuit and timing considerations. It involves a meticulous design method that requires careful attention to detail with each clock cycle.
Thus, FPGA development is significantly more challenging than microcontroller development.
Difficulty Comparison from High to Low: ASIC Integrated Circuits > FPGA > Microcontrollers
FPGA is specifically designed for low-level development and optimization, making it a challenging yet distinctive feature.
2. FPGA Applications
2.1 FPGA has powerful functionalities and high experimental difficulty, typically used in communication interface design and digital signal processing in high-end applications (large data volumes, fast data transfer, high precision requirements).
In everyday applications, microcontrollers are widely used in scenarios where requirements are not particularly high.
2.2 FPGA also has a special application scenario, namely ASIC prototype validation.
How to understand this? Integrated circuit development processes are lengthy and risky. When developing an integrated circuit, it requires a long time cycle from code writing to simulation verification, PCB layout, and finally to production.
To ensure success and aim for a first-pass yield, it is beneficial to run the design on an FPGA before production to verify functionality.
2.3 FPGA’s non-standard applications (in low-volume scenarios, commonly used in military applications).
For instance, USB and other interface standards are fixed. However, in some special scenarios where market demand is low, there might be uniquely defined interfaces that are hard to find corresponding chips for. In such cases, FPGAs can be utilized to design internal circuit structures to interface with these unique interfaces.
2.4 New technologies and new applications.
When a new technology’s market potential is unclear, it is unlikely to produce a specific chip in bulk. Instead, FPGAs can be used for experimentation, and once market demand increases, mass production can commence.
Summary:
Compared to dedicated ASICs, FPGA tools significantly reduce development difficulty and shorten development cycles. Moreover, since FPGAs are reprogrammable, their R&D costs and risks are much lower than those of ASICs, making them more suitable for complex and variable data applications.
3. Disadvantages of FPGA
The disadvantage of FPGA is its high cost, why is that? Dedicated circuits utilize all components to achieve the required functionality. An FPGA must meet functionalities A, B, and C simultaneously. However, certain functionalities required for A may not be used in B or C, resulting in lower utilization rates and, consequently, higher costs.
Thus, FPGAs are only suitable for high-end, low-volume applications. When a promising market is identified, and cost reduction is desired, the FPGA code can be translated into an integrated circuit for production.
4. Basic Structure of FPGA
Unlike dedicated ASICs that use fixed logic gates, FPGAs employ a reconfigurable structure to implement functions, with Look-Up Tables (LUTs) effectively serving this purpose.
What is a Look-Up Table (LUT)? Essentially, it is a RAM memory.
For example, for the digital logic Y=A&B&C, in dedicated ASICs, the logic gates are predetermined, as shown below:
Implementation structure of Y=A&B&C
In an FPGA, however, A, B, and C can be any relationship through programming. The design process is as follows:
First, write the code for Y=A&B&C and then use EDA tools (like QUARTUS or other development tools) to analyze this line of code to determine the values of Y for different input combinations (8 in total). The truth table is as follows:
Then, the software tool writes all results to the Look-Up Table (LUT), thus implementing the functionality of the code.
Basic structure of FPGA implementation for Y=A&B&C
This illustrates the principle of FPGA implementation.
5. Additional Knowledge
5.1 In FPGA, there are soft cores and hard cores.
Soft core: A circuit that can be constructed using logic gates to achieve a specific function. For example, if a counter logic is implemented inside the chip, the functionalities used in constructing the counter logic can be termed as “soft functionalities”.
Hard core: Chips that implement fixed functionalities. The circuitry is predetermined and implemented through hardware. For example, a PLL clock unit has a fixed circuit since the clock is generated by an external crystal oscillator and needs to be multiplied internally through analog circuitry. AD and DA chips are also analog chips that require fixed resources.
5.2 A new type of SOC FPGA (with embedded processors)
FPGAs contain internal RAM blocks for data storage, and the operating state is set by programming the RAM. If the FPGA needs to operate, the RAM must be programmed, and in cases where large amounts of data are exchanged externally, additional peripherals like SDRAM or DDR3 memory may be required for temporary storage, with the final data processed through the FPGA’s internal RAM.
Currently, mainstream FPGAs are based on SRAM technology, most development boards use a serial configuration mode. Due to SRAM losing internal data upon power-off, an external memory that retains data during power loss is often connected to save the program. Thus, when powered on, the FPGA reads data from the external memory into its internal RAM to complete configuration and enter operational mode.
Some FPGA chips now include not only interfaces and logic gates but also ARM and other CPUs, bringing embedded processor functionality.
We find functionalities on circuit boards such as ARM + FPGA or DSP + FPGA cooperating together, implementing processor + FPGA functionality on a single chip, which enhances the capabilities of embedded processors.
Advantages:
1. More favorable for PCB layout, smaller area, and more powerful functionalities.
2. ARM embedded within the chip allows for more buses and communication methods between ARM and FPGA, resulting in faster speeds.
5.3 Data Storage and Configuration Methods
After completing the program design in EDA tools, the software program must be burned into the internal FPGA. Different configuration modes allow for various programming methods; below are some common configuration modes:
1. Parallel mode: Configure the FPGA via parallel PROM or Flash. This means writing the FPGA program to PROM or Flash first, which automatically reads the values during power-up to configure the FPGA.
2. Master-slave mode: Use one PROM to configure multiple FPGAs.
3. Serial mode: Configure the FPGA via serial PROM.
4. Peripheral mode: Use the FPGA as a peripheral to a microprocessor CPU, programmed by the microprocessor.
One is the FPGA, and the other is the CPU. The CPU writes to the FPGA through an interface, and then the FPGA implements the required functionality. But where does the CPU get the data to configure the FPGA parameters?
One can add a RAM or FLASH; the CPU reads the contents and writes them to the FPGA, allowing it to function as required. This is a common approach.
How does this differ from the CPU directly controlling the FPGA? After powering up, the FPGA could just read data from the PROM; why introduce a CPU?
One reason is that some FPGA programs are encrypted; the CPU reads the data, decrypts it, and sends it to the FPGA, which then implements the functionality.
Source: Hardware Notebook
Copyright belongs to the original author, if there is any infringement, please contact for deletion.
Linux China announces cessation of operations!
Sharing an embedded data visualization tool
Hacking software on the subway, surrounded by a crowd!