Understand some misunderstandings about FPGA learning[Copy link]
1. Not familiar with the internal structure of FPGA and the basic principles of programmable logic devices. Why is FPGA programmable? I am afraid that many novices do not know, and they do not want to know. Because they think it is irrelevant. They subconsciously think that programming must be like writing software. The idea of software programming is deeply rooted. Seeing Verilog or VHDL is like seeing C language or other software programming languages. Read and analyze one by one. If these novices always refuse to understand why FPGA is programmable and do not understand the internal structure of FPGA, it may be a fantasy to learn FPGA. Although EDA software is now very advanced, it can synthesize something by copying like writing software, but perhaps only God knows what the EDA software finally synthesizes. Maybe it is okay to light a lamp or run a horse. This is why many novices are still novices after learning for a long time. So why is FPGA "programmable"? First, let's understand what "program" means. In fact, "program" is just a bunch of 01 codes with certain meanings. Programming is actually writing these 01 codes. However, we now have a lot of development tools, and usually these 01 codes are not written directly, but written in the form of high-level languages, and finally converted into this 01 code by the development tools. For software programming, the processor will have a special decoding circuit to translate these 01 codes into various control signals one by one, and then control its internal circuits to complete one calculation or other operations. Therefore, the software is read one by one, because the operation of the software is completed step by step. The programmability of FPGA is essentially based on these 01 codes to achieve the change of its function, but the difference is that the reason why FPGA can complete different functions is not to rely on translating 01 codes like software to control an operation circuit. There are no such things in FPGA. There are three main parts inside FPGA: programmable logic unit, programmable connection and programmable IO module. What is a programmable logic unit? Its basic structure is a 4-input or 6-input 1-output "truth table" made of a certain memory (SRAM, FLASH, etc.) plus a D flip-flop. Any 4-input 1-output combinational logic circuit has a corresponding "truth table". Similarly, if a 4-input 1-output "truth table" is made with such a memory, you only need to modify the internal value of its "truth table" to be equivalent to any 4-input 1-output combinational logic. What are the internal values of these "truth tables"? They are just those 01 codes. What if you want to implement a sequential logic circuit? Isn't there a D flip-flop? Any sequential logic can be converted into a combinational logic + D flip-flop to complete it. But after all, this only implements a 4-input 1-output logic circuit. Usually, the scale of the logic circuit is quite large. What should I do? At this time, programmable wires are needed. There are many connection points controlled by memory on these wires. By rewriting the values of the corresponding memory, you can determine which lines are connected and which lines are disconnected. This can combine many programmable logic units to form a large logic circuit. Finally, there is programmable IO, which is actually something that FPGA must pay attention to when used at the chip level. Any chip must have input pins and output pins. Programmable IO can arbitrarily define a non-dedicated pin (FPGA has special non-user-usable test and download pins) as input or output, and can also set the IO level standard. In a word, the reason why FPGA is programmable is that it can be made into a "truth table" through special 01 code, and these "truth tables" can be combined to realize large-scale logic functions. If you don't understand the internal structure of FPGA, you can't understand how the final code is changed into FPGA. It is impossible to have a deep understanding of how to make full use of FPGA. Today's FPGA not only has the three blocks mentioned above, but also many dedicated hardware functional units. How to make good use of these units to realize complex logic circuit design is an obstacle that must be overcome on the road from novice to expert. And all of this must start with understanding the internal logic of FPGA and its working principle. 2. Misunderstanding HDL language, you can't see the hardware structure no matter how you look at it. The full English name of HDL language is: Hardware DescriptionLanguage, pay attention to the word Description, not Design. Why do foreigners use the word Description instead of Design? Because HDL is not used to design hardware, but only to describe hardware. The word description accurately reflects the essence of HDL language. HDL language is just a textual representation of known hardware circuits, and it just describes the future circuits in textual form. Before writing the language, the hardware circuit should have been designed. The language is just to convert this design into a textual expression. But many people don’t understand. Since the hardware has been designed, it can be directly taken to the production department. Why do we have to convert it into a textual expression and then go through the troublesome process of EDA tools? In fact, this is the problem that many rookies do not understand the abstract level of design. Any design, including clothing, machinery, and advertising design, has an abstract level problem. Take advertising design as an example. The initial design may be just a concept. Designing this concept is just an idea, which is far from being made into an advertisement. Hardware design also has different levels of abstraction, and each level needs to be designed. The highest level of abstraction is the algorithm level, followed by the architecture level, register transfer level, gate level, and physical layout level. The advantage of using HDL is that we have already designed a register transfer level circuit. Then, after using HDL to describe it, it can be converted into text form. The remaining conversion to a lower level can be done by EDA tools, which greatly reduces the workload. This is the concept of synthesizability, that is, the description of the hardware unit at this abstract level can be understood by EDA tools and converted into the underlying gate-level circuit or other structure circuit. In FPGA design, this is to describe the opinions at the abstract level into HDL language, which can be converted into the FPGA internal logic function implementation form described in Question 1 through FPGA development software. HDL can also describe higher abstract levels such as algorithm level or architecture level, but currently limited by the development of EDA software, EDA software cannot understand such a high level of abstraction, so HDL descriptions of such abstract levels cannot be converted into lower abstract levels, which is the so-called non-synthesizable. Therefore, when reading or writing HDL language, especially synthesizable HDL, you should not see the language itself, but the hardware circuit structure corresponding to the language. If you always see HDL as lines of code, then such people will never get rid of the fate of being a rookie. If one day you see code that is no longer lines of code but hardware modules, then congratulations, you have left the level of a rookie and entered the level of a less rookie. 3. FPGA itself is nothing, everything is outside of FPGA. This is probably the most difficult thing for many rookies who learn FPGA to understand. Who is FPGA for? Many schools explain that it is for students majoring in microelectronics or integrated circuit design. In fact, this is just that many schools are limited by funds and cannot afford professional integrated circuit design tools and use FPGA tools instead. In fact, FPGA is used by engineers who design electronic systems. These engineers usually use existing chips together to complete an electronic device, such as base stations, set-top boxes, video surveillance equipment, etc. When the existing chips cannot meet the needs of the system, FPGA is needed to quickly define a usable chip. As mentioned above, FPGA contains only some "truth tables", triggers, various connections and some hardware resources. When electronic system engineers use FPGA for design, they just consider how to combine these resources to realize certain logical functions, instead of having to pay attention to whether the chip can be manufactured in the end like IC design engineers. In essence, it is no different from using existing chips to combine into different electronic systems, but it only needs to pay attention to the lower-level resources. It is still simple to use FPGA, because it is nothing more than those resources. After understanding the previous two points, you can make a test board, run experiments, and do some simple things. However, if you really want to use FPGA well, it is far from enough to just know some FPGA knowledge. Because in the end, how to combine the resources in FPGA and what functions to realize to meet the needs of the system requires more and more extensive knowledge. At present, the application of FPGA is mainly in three directions: the first direction, which is also the traditional direction, is mainly used for the design of high-speed interface circuits of communication equipment. This direction mainly uses FPGA to process the protocol of high-speed interface and complete high-speed data transmission and exchange. This type of application usually requires the use of FPGAs with high-speed transceiver interfaces. At the same time, it requires designers to understand high-speed interface circuit design and high-speed digital circuit board level design, have EMCEMI design knowledge, and a good foundation in analog circuits. It is necessary to solve the signal integrity problems generated during high-speed transceiver processing. The earliest and most widely used application of FPGA is in the field of communications. On the one hand, the communication field requires high-speed communication protocol processing methods, and on the other hand, the communication protocol is modified at any time, which is not suitable for making special chips. Therefore, FPGAs that can flexibly change functions have become the first choice. So far, more than half of FPGA applications are also in the communications industry. The second direction can be called digital signal processing or mathematical calculation, because to a large extent this direction has greatly exceeded the scope of signal processing. For example, as early as 2006, I heard that the Americans used FPGAs for financial data analysis, and later I saw cases of using FPGAs for medical data analysis. In this direction, FPGA designers are required to have a certain mathematical foundation, be able to understand and improve more complex mathematical algorithms, and use various resources inside the FPGA to turn them into actual operation circuits. At present, the real practical application is still in the fields of wireless signal processing, channel coding and decoding, and image signal processing in the field of communication. Research in other fields is underway. The main reason why there is not a lot of practical application is that those who study finance and medicine do not understand this thing. However, recently I have found that many doctors in electronic engineering and computer science in Europe and the United States have transferred to the financial industry to carry out financial signal processing. I believe that with the increase in the number of people transferring, the mathematical calculation function of FPGA in other fields will be better utilized, and I am also interested in doing some research in these areas. However, I am afraid that those who study finance and medicine in China rarely use mathematics, let alone use FPGA to help them complete mathematical operations. This issue can only be discussed later. The third direction is the so-called SOPC direction. In fact, strictly speaking, this is already within the scope of FPGA design. It is just the underlying hardware environment of an embedded system built using the FPGA platform, and then the designer mainly develops embedded software on it. The design of the FPGA itself is quite small. But if it involves the need to do special algorithm acceleration on FPGA, it actually requires the knowledge of the second direction, and if it is necessary to design a dedicated interface circuit, the knowledge of the first direction is required. At present, the development of SOPC is far inferior to the first and second directions. The main reason is that SOPC is mainly based on FPGA, or a "soft" processor is implemented in the resources inside the FPGA, or a processor core is embedded in the FPGA. However, most embedded designs are based on software. According to the current hardware development, the interfaces in most cases have been standardized, and it does not require such a large FPGA logic resource to design too complex interfaces. Moreover, at present, the development tools related to SOPC are still very imperfect, while various embedded processor development tools represented by ARM have long been deeply rooted in the hearts of the people. Most SOC chips with ARM as the core provide most standard interfaces, and a large number of series of single-chip embedded processors provide the hardware acceleration circuits required by related industries. There are indeed few occasions where customized hardware is needed. Usually, there is a very urgent demand in this regard in some special industries. Even if Xilinx adds ARM's hard core to FPGA, I believe that the current situation will not change much. Don't forget that many old 8-bit microcontrollers are still in the embedded field. The value of embedded is not mainly reflected by hardware differences but more by software differences. I used to be optimistic about the idea of cypress's Psoc. Unlike the SOPC series, the Psoc concept is to embed a small FPGA in the SOC chip. This can actually meet the tiny differences in embedded hardware interfaces. For example, if an application requires 4 USBs, and the usual processor does not provide so many, then an FPGA can be used to provide more USB interfaces. Another application requires 6 UARTs, which can also be completed in the same way. For embedded design companies, they only need to stock one chip to meet the various needs of these designs.Minor differences. Its main differentiation is still achieved through software. But at present, Cypress is too closed. If it adopts ARM as the processor core and uses its complete tool chain. At the same time, it opens IP cooperation and allows a large number of third parties to provide IP design for it, which is actually very promising. But at present, Cypress is afraid that it will not have a good time, and it is unknown when the idea of Psoc will shine. 4. Digital logic knowledge is the foundation. No matter which direction FPGA is in, it cannot be separated from the support of digital logic knowledge. FPGA is simply a way to realize digital logic. If even the most basic knowledge of digital logic is problematic, the desire to learn FPGA is just a castle in the air. And this is exactly the problem that many rookies are most reluctant to face. Digital logic is the professional basic knowledge of any electronic and electrical major, and it is also a course that must be learned well. Many people just learn, take an exam, and that's it. If you can't master the knowledge of digital logic and develop good design habits, learning FPGA will still be like looking at flowers in the fog and looking at the moon in the water in the end, and it will always be in vain. The above four points are just my summary of the most common mistakes that newbies make when learning FPGA. Learning FPGA is just like learning Go. It is easy to learn how to place pieces on the board, but it is extremely difficult to become a master. To become a god-like player like Lee Chang-ho, in addition to hard work and concentration, you probably need some talent.