BBK
【1楼】
Promotion points:
24
Posts:
83
Points: 427
|
(4) Delay method
Because glitches are ultimately caused by delays, the branch that produces the delay can be found. For branches with relatively small delays, adding a delay equal to the width of the glitch can eliminate the glitches. However, sometimes as the load increases, the glitches will continue to appear, so this method is also limited. Moreover, the delay line method used to generate delays will make the system unreliable due to changes in ambient temperature.
(5) Latch method
Glitches are generated when the output of the counter is ANDed or ORed. As the number of bits of the counter increases, the number and types of glitches will become more and more complex.
When the FPGA output has edge or level sensitive signals from other parts of the system, the combinational outputs that are sensitive to hazards should be registered at the output. For asynchronous inputs, the setup and hold times required by the state machine can be ensured by adding input registers. For glitches generated under normal circumstances, you can try to eliminate them with a D flip-flop. However, when using a D flip-flop to eliminate them, the timing is sometimes affected, and many issues need to be considered. Therefore, it is necessary to carefully analyze the source of the glitches and the nature of the glitches, and use circuit modification or other methods to completely eliminate them.
2.3 Delay Design in FPGA
When a signal in a circuit needs to be delayed for a period of time, some "not gates" or other gate circuits can be connected in series after the signal. However, in FPGA, the development software will remove these gates as redundant logic during the integrated design, and the delay effect cannot be achieved. When developing FPGA with ALTERA's MAXPLUSII, a certain delay can be generated by inserting LCELL primitives or calling delay line modules. However, the delay formed in this way is not stable in the FPGA chip and will change with changes in external environment such as temperature, which will affect the performance of the FPGA. Therefore, a high-frequency clock can be used to drive a shift register, and the signal to be delayed is used as the data input. The number of stages of the shift register is correctly set according to the required delay, and the output of the shift register is the delayed signal. The delay signal generated by this method has an error, and the error size is determined by the period of the high-frequency clock. For the delay of the data signal, the error can be eliminated by resampling the delayed signal with the data clock at the output end. Of course, when the required delay is long, this is a waste of resources. In addition, when using VHDL language for FPGA design, after statement cannot be used to implement delay, because the current synthesis tools cannot achieve such precise delay, that is, after statement in the program cannot be synthesized.
2.4 Synchronous Circuit Design in FPGA
2.4.1 Synchronous Circuit and Asynchronous Circuit
Asynchronous circuit is mainly a combinational logic circuit, which is used to generate read and write control signal pulses of address decoder, FIFO or RAM. Its logic output has nothing to do with any clock signal, and the burrs generated by the decoded output can usually be monitored. Synchronous circuit is a circuit composed of timing circuit (register and various triggers) and combinational logic circuit, and all its operations are completed under strict clock control. These timing circuits share the same clock CLK, and all state changes are completed on the rising edge (or falling edge) of the clock. For example, for D flip-flop, when the rising delay arrives, the register transfers the level of the D end to the Q output end. The following introduces the problem of setup and hold time. Setup time (tsu) refers to the time when the data is stable and unchanged before the rising edge of the trigger clock arrives. If the setup time is not enough, the data will not be entered into the trigger at this rising edge of the clock; the hold time (th) refers to the time that the data remains stable after the rising edge of the trigger clock arrives. If the hold time is not enough, the data cannot be entered into the trigger either. The stable transmission of data must meet the requirements of the setup time and the hold time, otherwise the circuit will have logic errors.
For example, when the Q output of a D flip-flop is directly fed to the D input of another flip-flop, the first D flip-flop can meet the setup and hold time, but the delay to the second D flip-flop may not be enough to meet the hold time requirement of the second flip-flop. At this time, a logic error will occur, and the error will be more serious when the clock is skewed. The solution is to add a buffer to the Q end of the first flip-flop, as shown in Figure 7. This can meet the timing requirements of the second flip-flop. Another solution is to use a low-drive source D-type flip-flop without a buffer. The high relative fan-out helps improve the hold time.
Synchronous digital circuit systems are absolutely dominant today. Engineers often use them to design all imaginable digital circuits, with frequencies ranging from DC to several GHz. Compared with asynchronous circuits, synchronous circuits have the following advantages:
(1) Synchronous circuits can maintain normal operation under the condition of temperature, voltage, process and other parameters, while the performance of asynchronous circuits is usually related to ambient temperature, operating voltage and production process.
(2) Synchronous circuits are portable and easy to adopt new or more advanced technologies, while asynchronous circuits are difficult to reuse and maintain.
(3) Synchronous circuits can simplify the interface between two modules, while asynchronous circuits require handshake signals or tokens to ensure signal integrity.
(4) Designing synchronous circuits with D flip-flops or registers can eliminate glitches and synchronize internal skewed data. Asynchronous circuits do not have this advantage and are difficult to simulate and debug, and cannot be well integrated.
Synchronous circuits also have disadvantages because they require timing devices, which will consume more logic gate resources than asynchronous circuits. Although asynchronous circuits are faster and consume less power, since current FPGA chips have millions of gates, this does not need to be too much of a concern. The author recommends avoiding asynchronous circuits as much as possible and using synchronous circuits for design.
2.4.2 Using pipeline technology to improve the speed of synchronous circuits
The speed of synchronous circuits refers to the speed of the synchronous system clock. The faster the synchronous clock, the shorter the time interval for the circuit to process data, and the greater the amount of data processed by the circuit per unit time.
Tco is the delay time from the input data of the trigger being clocked into the trigger to the data reaching the output of the trigger; Tdelay is the delay of the combinational logic; Tsetup is the setup time of the D trigger. Assuming that the data has been clocked into the D trigger, the delay time required for the data to reach the Q output of the first trigger is Tco, and the delay time after the combinational logic is Tdelay, and then it reaches the D end of the second trigger. If the clock is expected to be stably clocked into the trigger again in the second trigger, the clock delay must be greater than Tco+Tdelay+Tsetup, that is, the minimum clock cycle Tmin=Tco+Tdelay+Tsetup, that is, the fastest clock frequency Fmax=1/Tmin. FPGA development software also uses this method to calculate the maximum operating speed Fmax of the system. Because Tco and Tsetup are determined by the specific device process, only the delay time Tdelay of the combinational logic can be changed when designing the circuit. Therefore, shortening the delay time of the combinational logic between triggers is the key to improving the speed of the synchronous circuit. Since the general synchronous circuit is larger than the first-level latch, the clock cycle must meet the maximum delay requirement to make the circuit work stably. Therefore, only by shortening the longest delay path can the operating frequency of the circuit be increased. The larger combinational logic can be decomposed into N smaller blocks, and the combinational logic can be evenly distributed through appropriate methods. Then, a trigger is inserted in the middle and the same clock as the original trigger is used. This can avoid excessive delay between the two triggers and eliminate the speed bottleneck, so that the operating frequency of the circuit can be increased. This is the basic design idea of the so-called "pipeline" technology, that is, the speed-limited part of the original design is realized with one clock cycle. After inserting the trigger using pipeline technology, it can be realized with N clock cycles, so the system can work faster and the throughput can be increased. Note that the pipeline design will add delay to the original data path, and the hardware area will also increase slightly.
3 Other issues that should be noted in FPGA design
(1) All state machine inputs, including reset and set signals, must use synchronous signals. All state machine outputs must be stored in registers. Be careful not to have a deadlock state in the state machine design.
(2) Use registers and triggers to design circuits, and try not to use latches, because they are too sensitive to input signal glitches. If you insist on using latches, you must ensure that the input signal is absolutely glitch-free and meets the hold time.
(3) Be very careful when designing decoding logic circuits, because decoders and comparators themselves will generate spikes and are prone to glitches. Connecting the output of the decoder or comparator directly to the clock input or asynchronous clear terminal will cause serious consequences.
(4) Try to avoid the appearance of implicit RS triggers. Generally, the control output is directly fed back to the input. Using a feedback loop will result in an implicit RS trigger, which is very sensitive to input spikes and false signals. Any change in the input may cause the output value to change immediately. At this time, it is easy to cause glitches, resulting in serious timing confusion. Once there is an implicit RS trigger, adding a latch to eliminate glitches will not solve the problem. At this time, the only way to fundamentally solve the problem is to modify the circuit comprehensively.
(5) Use only one clock in each module to avoid using multiple clock designs. At the same time, avoid using the secondary clock after the main clock is divided as the clock input of the timing device, because the secondary clock may have too much clock skew relative to the primary clock. The input clock, input signal, and output signal of all modules are synchronized using D flip-flops or registers, that is, the output signal comes directly from the output end of the flip-flop or register. This can eliminate spikes and glitches. Whether it is a control signal or an address bus signal or a data bus signal, another register must be used to turn the internal skewed data into synchronized data. These seemingly useless operations can greatly improve the performance of the circuit system.
(6) Delay lines should be avoided as much as possible, because they are extremely sensitive to changes in the process, which will greatly reduce the stability and reliability of the circuit and will cause trouble for testing.
(7) Most FPGA devices provide special global routing resources for clock, reset, preset and other signals. Make full use of these resources. This can reduce glitches in the circuit and greatly improve the performance of the designed circuit.
(8) Do not try to use HDL language to synthesize RAM, ROM or FIFO and other storage modules. Current synthesis tools are mainly used to generate logic circuits. If you need to use these modules, you can directly call or instantiate the corresponding macro units.
(9) Pay attention to the inconsistency between the simulation results and the actual synthesized circuits. Whether it is a sequential circuit or an asynchronous logic circuit, its behavior is not exactly the same as its simulator result. Especially for asynchronous logic circuits, the simulation results will hide competition risks and burrs, which are far from the actual behavior. Therefore, in FPGA design, every logic gate and every line of VHDL (Verilog) language must be fully understood. Don't expect the simulator to find errors for you. A good design engineer should know how to improve circuit performance by modifying the design, rather than blaming the software used.
Using FPGA to develop digital circuits can greatly shorten the design time, reduce PCB area, and improve system reliability. These advantages have led to the rapid development of FPGA technology, which has been widely used in communications, electronics, signal processing, industrial control and other fields. With the increase of FPGA capacity, the application era of SOPC (signal processing and control of the entire system) is coming. SOPC has both embedded processors, I/O circuits and large-scale embedded memories, as well as CPLD/FPGA, which users can choose. At the same time, you can also choose FPGA IP cores provided by PLD companies. The use of IP cores can ensure the development efficiency and quality of system-level chips and greatly shorten product development time. Therefore, FPGA has become one of the important options for solving system-level design. This article studies the key issues in FPGA design, and proposes the main problems and solutions that affect system reliability in design, hoping to provide a certain reference for FPGA designers.
|