FPGA back-engineering application example - checking code
[Copy link]
FPGA reverse deduction method application example - check code For IT-related practitioners, reading other people's code is an indispensable ordeal. During the learning stage, we often need to read other people's code from books to learn valuable experience. This is a very boring process, and we often cannot understand the author's intention. In actual work, it is inevitable that we need to take over half-finished projects or team projects. At this time, we must read the code of previous engineers. If reading the code in the book is painful, then it is simply unbearable to encounter code that is not standardized or unreasonable in design. There are also some god-like players. The designer "has a flash of inspiration" when writing the code, and the result can only be understood by himself and God. These codes can make you feel worse than death, and even start to doubt life: Is the code written in a mess or my level is not good enough? ! Do you think this is the most painful? NO! There is another situation that is enough to make you feel worse than death, and even start to doubt life. That is, when you encounter code that does not run properly, the time and energy spent on troubleshooting the problem is not as good as rewriting it. At this time, your heart is completely broken! There is one thing that is very helpless. We cannot require other people's code to be very standardized. Therefore, the correct learning method and thinking method are particularly important. What is the correct way to read other people's code? What preparations should be made before reading the code? Use forward thinking or reverse thinking when reading the code? How to judge which parts of the code are worth learning from? Therefore, it is very important to master a general skill to understand other people's code. Let's talk about this aspect below. We know that there may be many ways to implement a function, so different people write different codes. It is very difficult to know what function it is going to achieve by looking at the code. Some beginners may think of taking simulation, looking at circuit diagrams, flow charts, timing diagrams, annotations and other methods, which are not advisable. You still cannot know its function and whether there are any errors through these. So what is the correct method? We take a method that can be called "reverse method" or "reverse method", and this problem is solved. You must know that the purpose of the code is to realize the function. No matter what kind of code you use, one thing that is exactly the same is the final result of "realizing the function". Knowing this, we can reverse the process (code) through the result (function), and the idea, process, and purpose of the code will be clearly revealed. Okay, let's take an example to illustrate how to understand other people's code step by step through the reverse deduction method.
|