TOP 11 knowledge points How to get started with FPGA

Who is FPGA for? At present, many institutions for training FPGA programs are for students majoring in microelectronics or integrated circuit design. In fact, many schools are limited by funds and can not afford to buy professional integrated circuit design tools but use FPGA tools instead. In fact, FPGA is for engineers who design electronic systems.
These engineers usually use existing chips together to complete an electronic device, such as a base station, set-top box, video monitoring equipment, etc. When the existing chips can not meet the requirements of the system, we need to use FPGA to quickly define a usable chip.

1、 To get started, you need to master HDL (HDL=verilog+VHDL)

The full English name of HDL language is Hardware Deion Language. Note that Deion is not Design. Why do foreigners use the word Deion instead of Design? Because HDL is really not used to design hardware, but only to describe hardware.
The term "description" accurately reflects the essence of HDL language. HDL language is just a text representation of known hardware circuits, and only describes the future circuits in the form of text. Before writing the language, the hardware circuit should have been designed. Language is nothing more than the translation of this design into a written form of expression.
The first sentence is: those who haven't learned how to count electricity should learn how to count electricity first. Then you can choose verilog or VHDL. For those with C language foundation, VHDL is recommended. Because verilog is too similar to C, it is easy to confuse. Finally, you will find that you spend a lot of time to distinguish the two languages, rather than learning how to use it. Of course, if you can change your mind, you can also choose verilog. After all, verilog is widely used in China.
Next, first find this example to copy code. The significance of code copying lies in being familiar with syntax rules and compilers (also called integrators). Common integrated development environments include Intel's Quartus, Xilinx's ISE and Vivado, Design Compiler, Synopsys's VCS, Linux's iverilog, Lattice's Diamond, Microchip's Libero, and Synplify pro. Then they can write by imitation without reading. After compiling the code, open the RTL diagram to see what kind of circuit is synthesized.
HDL is a hardware description language, highlighting the characteristics of hardware, so we should use digital thinking to think about HDL, not C language or other high-level languages. If you can't understand this sentence, you can see What is Hardware and What is Software. At this stage, the recommended textbook is Verilog HDL Advanced Digital Design or VHDL for Logic Synthesis. If you can write a three segment state machine without reading, you can enter the next stage.
In addition, you must prepare official Verilog or VHDL documents, Verilog_IEEE Official Standard Manual-2005_IEEE_P1364 and IEEE Standard VHDL Language_2008, so that you can check them when you encounter some syntax problems.

2、 Independent completion of small and medium-sized digital circuit design

Now you can design some digital circuits, such as traffic lights, electronic organs, DDS, etc. The recommended textbook is Verilog HDL Application Design Example Lecture. At this stage, what you need to do is to give you a target requirement or sequence diagram, and you can use HDL to design circuits to achieve it. Here you need a development board. You can choose the Cyclone IV series of Altera or the Spantan 6 of Xilinx. Never buy a development board before you master HDL, because it's useless if you buy it back. You don't need to download the code every time the compilation passes. We use modelsim simulation (in addition to QuestaSim, NC verilog, Diamond's Active HDL, VCS, Debussy/Verdi and other simulation tools). If the simulation fails, you don't need to download it. Here you can master the simple testbench first. The recommended textbook is WRITING TESTBENCHES Functional Verification of HDL Models.

3、 Master design methods and principles

You may find that the circuit you synthesized is correct, but there are many warnings. At this time, you have to learn the synchronous design principle, optimize the circuit, whether speed is priority or area is priority, how to design the clock tree, how to synchronize two hetero frequency clocks, and so on. The recommended teaching materials are the FPGA Authoritative Guide and the basic and advanced sections of the second edition of Altera FPGA/CPLD Design. Learn to speed up compilation (incremental compilation, LogicLock), static timing analysis, and embedded logic analyzer (signaltap). If there is something you don't understand, you can skip it temporarily, because this part requires sufficient practice to have a deeper understanding.

4、 Learn to improve development efficiency

The editor function of Quartus and ISE is too weak, which affects the development efficiency. Therefore, it is recommended to use the function of code fragments in the Sublime text editor to reduce repetitive work. Modelsim is also a commonly used simulation tool. Learn TCL/TK to write your own DO files to automate the simulation. The recommended textbook is TCL/TK Introduction Classic. You may manually back up code, but professionals use version controller Git to improve work efficiency. Beyond Compare, a file comparator, is also a commonly used tool. Git also has a comparison function. In addition, you can also use System Verilog to replace testbench, which will be more efficient. If you are doing IC verification, you must master System Verilog and Verification Methodology (UVM). The recommended textbooks are Writing Testbenches using SystemVerilog, The UVM Primer, and System Verilog 1800-2012 Grammar Manual.

After mastering TCL/TK, you can learn virtual Jtag (ISE also has similar tools) to make your own debugging tools. In addition, if you have time, you'd better learn Python again. Script means once and for all.

5、 Strengthen theoretical basis

At this time, you can already use FPGA, but there are still many things you can't do (such as FIR filter, PID algorithm, OFDM, etc.), because you haven't learned the theory well. I will give you a few directions for your reference, followed by the theoretical lessons to be mastered.

①. Signal processing - signal and system, digital signal processing, multi sampling rate signal processing, digital image processing, modern digital signal processing, blind signal processing, adaptive filter principle, radar signal processing

②. Interface applications - such as UART, SPI, IIC, USB, CAN, PCIE, Rapid IO, DDR, TCP/IP, SPI4.2 (10G Ethernet interface), SATA, optical fiber, DisplayPort, HDMI

③. Wireless communication - signal and system, digital signal processing, communication principle, mobile communication foundation, random process, information theory and coding

④. CPU design - computer composition principle, single chip microcomputer, computer architecture, compilation principle, RISC-V

⑤. Instruments and meters - analog electronic technology, high-frequency electronic circuit, electronic measurement technology, principle and application of intelligent instruments

⑥. Control system - automatic control principle, modern control theory, process control engineering, fuzzy controller theory and application

⑦. Compression, coding, encryption -- number theory, abstract algebra, modern coding technology, information theory and coding, introduction to data compression, applied cryptography, audio information processing technology, principle of digital video coding technology, H.265
Now you find that FPGA involves so much knowledge that you can choose one direction you are interested in, but you are likely to use knowledge in several directions in your work, so the more you learn, the better. If you want to go further, mathematics and English are inevitable.

6、 Learn to use MATLAB simulation

When designing FPGA algorithm, MATLAB will be used more or less, such as CRC coefficient matrix, FFT, digital filter coefficients, various tables and text processing. In addition, MATLAB can also be used to debug HDL (by comparing the results calculated with MATLAB with those calculated with HDL step by step, you can know where the problem is). The recommended textbooks are MATLAB and Du Yong's MATLAB and FPGA Implementation of Digital Filters.

7、 Sufficient practice

At this time, you have read the chip manual at least several times (available on the official website), and then you can do a certain amount of practice in your own direction (during this period, you should maintain a good code style, increase the readability of component example statements, draw flow charts/sequence diagrams, and write documents). For example, the communication class can be used as the modulation and demodulation algorithm, and the instrument class can be used as the bus analyzer. However, these algorithms are just a formula and a block diagram in the book, which is far from the reality. You may even think that everything in the book is superficial. Then, you can find some relevant information on HowNet, Baidu Library, EETOP Forum, opencores, ChinaAET, SCI-HUB, Q group sharing, and blogs (friends outside school can buy a HowNet account on Taobao). In fact, when you reach this stage, you have reached a professional level. If you have time, learn more about cutting-edge technologies, which will help you plan your career.

In your work, you may need to pay attention to many protocols and industry standards. The protocols can be found on EETOP, while standards (such as national standards GB and GB/T, international standards ISO) recommend the Standards Network and the Standards Sharing Network.

8、 Image processing

1、Photoshop。 Spend one or two weeks learning PS, get a general understanding of image processing, know various image formats, histograms, hue, channels, filters, splicing and other basic concepts, and be able to use it. This part is the basis of 0, which aims to give you a perceptual understanding of image processing, rather than deriving various formulas at the beginning. Photoshop CS6 Full Self study Tutorial is recommended.

2. Image processing based on MATLAB or OpenCV. Those with C/C++foundation can learn OpenCV, otherwise, it is recommended to learn MATLAB. At this stage, you only need to learn how to call simple functions, and don't need to go into the details of implementation for the time being. Digital Image Processing (matlab) and Learning OpenCV are recommended.

3. The basic theory of image processing. The theory of this part requires the foundation of high number, complex variable, linear algebra, signal and system, digital signal processing, etc. If the foundation is not good, it is recommended to supplement the foundation first. You can also put down the theory that you cannot understand for a while, and perhaps you will naturally get enlightened after learning it. Digital Image Processing is recommended.

4. Image processing based on FPGA. Apply the theory learned above to FPGA. If you are at the level of the seventh stage, you will easily complete the image algorithm design independently (image processing is inseparable from the interface, and the fifth stage is described above). If you do not have a development board, please refer to Verilog Read bmp Pictures. The Design of Embedded Image Processing System Based on FPGA and the Principle and Application of Digital Image Processing Based on FPGA are recommended.

5. Further study mathematics. In order to improve the algorithm, more mathematics is necessary. Therefore, it is recommended to learn real analysis, universal analysis, wavelet analysis, etc.The following two stages are introduced to interested friends.

9、 The end of digital electricity is analog electricity

Now, things inside the FPGA are not difficult for you, but when the signal goes out of the FPGA, you can't control it. At this time, we must learn analog electricity well. For example, circuit analysis, analog electronic technology, high-frequency electronic circuit, PCB design, EMC, SI, PI, etc., if you can design an FPGA development board with two DDR3 chips, you will be cleared. For specific learning routes, please refer to How to Learn Hardware Design - Theory and How to Learn Hardware Design - Practice in this blog.

10、 There is no end to learning

To reach this level, you are already very good, but there are still many things to learn. Because FPGA often has to interact with CPU, that is, you have to often communicate with software engineers, so you also need to know something about software. For example, ARM (Xilinx's ZYNQ and Altera's SOC will use ARM's hard core. Please refer to How to Learn Embedded Software in this blog), DSP, Linux, Android, and upper computers (QT, C #, JAVA) can all be learned. Anyway, there is no end to learning.

11、 Other problems

a. Why not recommend learning soft cores such as NIOS II and MicroBlaze?
1. The cost performance ratio is not high. The performance of the general soft core is about the same as that of the Cortex M3 or M4. It is very uneconomical to use something as expensive as FPGA to build a CPU with general performance. Better add another M3.
2. With soft core, other logic functions may be affected. This is due to the insufficient resources and the soft core, which makes the layout and routing very difficult.
3. The soft core is not open source. When a bug occurs, it is not easy to debug.
4. It is seldom used in engineering and may not be useful.
b. Why not recommend 0 basic learning ZYNQ or SOC?
1. It is easy to make people have the same mentality. Similarity psychology refers to a person who covers up and makes up for his own shortcomings in this regard by exaggerating the outstanding of people who are close to him, so as to obtain psychological balance. I am learning something very powerful, and then I feel that I am very powerful, but this is just an illusion.
2. The beginner should learn something as simple as possible, either concentrate on ARM or FPGA. This makes it easier to have a sense of achievement and enhance confidence.
3. The application fields of ZYNQ and SOC are not wide, and many people have never heard of such things, which leads to the disadvantage of job hunting.
4. Development tools take a long time to compile and waste a lot of time.
5. Most of the work is just responsible for the one hand, that is, on the other hand, it may not be useful.
c. Why do so many IP cores still need to write HDL?
1. It is usually students who ask such questions. They have never made products or encountered engineering problems.
2. IP core is not omnipotent and cannot meet all requirements.
3. Try to minimize the use of closed source IP cores. Once a problem occurs, this black box may make the product difficult to produce.
4. Deeply understanding the lower level can better use the higher level. This rule can be applied to all programming languages.