AN 584: Timing Closure Methodology for Advanced FPGA Designs

ID 683145
Date 10/08/2021
Public
Document Table of Contents

1.5.3. Follow Recommended Coding Styles

Your coding style has a significant impact on implementation in the FPGA because synthesis tools can optimize and interpret the design differently based on style. Therefore, you must decide how to code the design to assist the optimizations done by the synthesis tool.

FPGA devices are register rich, so pipelining your design can help you meet required performance, without adversely affecting resource use. Adding adequate pipeline registers can help you avoid a large amount of combinational logic between registers.

Another practice to avoid is unintended latch inference. Intel® Quartus® Prime Synthesis issues a warning message when unintended latch inference occurs. The FPGA architecture is not optimized for latch implementation. Latches generally have slower timing performance compared to equivalent registered circuitry.

Improper use of latch schemes can also cause glitches to pass from input to output when signals are enabled, putting latches in transparent mode. You must design such structures properly to avoid this unexpected circumstance. However, timing analysis cannot identify these safe applications.

Refer to HDL Design Guidelines in Intel® Quartus® Prime Pro Edition User Guide: Design Recommendations for information on how to avoid latches, combinational loops, and other styles that are not suitable for FPGA implementation.

If you use unsupported operations (such as asynchronously clearing of RAM content) with memory blocks, the Intel® Quartus® Prime software may implement the code with logic cells rather than more suitable RAM blocks.

If you are unaware of your hardware resources, you can easily underutilize some of the available resources. In general, do not use constructs that lack the equivalent hardware implementation available in the device. For example, if you infer RAM locations and use synchronous resets on RAM locations to clear the contents, or to initialize the values, your code might not be mapped to any of the available RAM blocks in the device.

This condition occurs because the RAM locations in the FPGA device do not have asynchronous or synchronous resets available for RAM cells. Instead, logic that models a memory with a reset is implemented in logic cells. Review your device specifications to confirm whether having a known initial value in the RAMs is necessary for proper design function. This condition is not typically required. If RAM cells must initialize to certain known values (such as all 0’s), you can perform write cycles to the RAM immediately after power up.

You must consider hardware mapping when writing your HDL. Changes in the HDL code can affect the number of logic levels and the corresponding timing. Although the Compiler optimizes your design, unnecessary optimizations can affect software performance. Modifying the HDL can improve the quality of results.

Improper coding of RAM blocks can also cause inference of the native RAM surrounded by an unnecessary cloud of logic cells and registers required to implement the equivalent functionality. This cloud of logic is barely noticeable, but can cause extra resource utilization and worsen timing closure in the area.

Refer to Recommended HDL Coding Styles in Intel® Quartus® Prime Pro Edition User Guide: Design Recommendations for information on inferring memories, multiplier blocks, DSP blocks, and how to use provided HDL RAM templates.