Synthesis Techniques 2005 Xilinx Inc All Rights This

  • Slides: 32
Download presentation
Synthesis Techniques © 2005 Xilinx, Inc. All Rights This material exempt per. Reserved Department

Synthesis Techniques © 2005 Xilinx, Inc. All Rights This material exempt per. Reserved Department of Commerce license exception TSU

Objectives After completing this module, you will be able t • Select a proper

Objectives After completing this module, you will be able t • Select a proper coding style to create efficient FPGA designs • Specify Xilinx resources that need to be instantiated for various FPGA synthesis tools • Identify synthesis tool options that can be used to increase performance • Describe an approach to using your synthesis tool to obtain higher performance Synthesis 3 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Timing Closure Synthesis 4 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use

Timing Closure Synthesis 4 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Outline • • • Coding Tips Instantiating Resources Synthesis Options Summary Appendix – Inferring

Outline • • • Coding Tips Instantiating Resources Synthesis Options Summary Appendix – Inferring Logic and Flip-Flop Resources – Inferring Memory – Inferring I/Os and Global Resources Synthesis 5 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Simple Coding Steps Yield 3 x Performance • • Use pipeline stages—more bandwidth Use

Simple Coding Steps Yield 3 x Performance • • Use pipeline stages—more bandwidth Use synchronous reset—better system control Use Finite State Machine optimizations Use inferable resources – – Multiplexer Shift Register LUT (SRL) Block RAM, LUT RAM Cascade DSP • Avoid high-level constructs (loops, for example) in code – Many synthesis tool produce slow implementations See the Synthesis and Verification Design Guide: toolbox. xilinx. com/docsan/xilinx 8/books/docs/sim. pdf Synthesis 6 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Synthesis Guidelines • Use timing constraints – Define tight but realistic individual clock constraints

Synthesis Guidelines • Use timing constraints – Define tight but realistic individual clock constraints – Put unrelated clocks into different clock groups • Use proper options and attributes – – Turn off resource sharing Move flip-flops from IOBs closer to logic Turn on FSM optimization Use the retiming option Synthesis 7 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Basic Performance Tips • Avoid high-level loop constructs – Synthesis tools may not produce

Basic Performance Tips • Avoid high-level loop constructs – Synthesis tools may not produce optimal results • Avoid nested if-then-else statements – Most tools implement these in parallel; however, multiple nested if-then-else statements can result in priority encoded logic • Use case statements for large decoding – Rather than if-then-else • Order and group arithmetic and logical functions and operators – A <= B + C + D + E; should be: A <= (B + C) + (D + E) • Avoid inadvertent latch inference – Cover all possible outputs in every possible branch • Easily done by making default assignments before if-then- Synthesis 8 else and case © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Targeting Xilinx • Some resources must be instantiated or create an IP core (Architecture

Targeting Xilinx • Some resources must be instantiated or create an IP core (Architecture Wizard and CORE Generator™ software) – FIFO 16, ISERDES, OSERDES, and clock resources • Certain resources require specific coding – DSP 48 registers have synchronous set/reset only – Distributed RAM/ROM and SRL do not have set or reset functionality after configuration • Synchronous resets are preferred over asynchronous reset – Xilinx FPGAs have a configuration reset (GSR) that is used during the configuration stage to bring up the FPGA in a known state • GSR is also accessible to designers after configuration Synthesis through the STARTUP block 9 • No need for asynchronous initialization power-on reset © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

State Machine Design • Put the next-state Inputs to FSM logic in one CASE

State Machine Design • Put the next-state Inputs to FSM logic in one CASE statement S 2 S 1 S 3 State Machine Module S 5 S 4 – The state register can also be included here or in a separate process block or always block • Put the state machine outputs in a separate process or always block HDL Code Next-state logic State register State machine outputs – Prevents resource sharing, which can hurt © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

The Perfect State Machine • The perfect state machine has: – Inputs: Input signals

The Perfect State Machine • The perfect state machine has: – Inputs: Input signals and state jumps – Outputs: Output states and control and enable signals to the rest of the design – NO arithmetic logic, datapaths, or combinatorial functions inside the state machine Current State Feedback to Drive State Jumps Next State Register State Jumps Input Signals Only! Output State and Enables Synthesis 11 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

State Machine Encoding • Use enumerated types to define state vectors (VHDL) – Most

State Machine Encoding • Use enumerated types to define state vectors (VHDL) – Most synthesis tools have commands to extract and reencode state machines described in this way • Use one-hot encoding for high-performance state machines – Uses more registers, but simplifies next-state logic – Experiment to discover how your synthesis tool chooses the default encoding scheme • Register state machine outputs for higher performance © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Coding Flip-Flops • Control signal precedence: Clear, Preset, Clock Enable VHDL Verilog FF_AR_CE: process(CLK)

Coding Flip-Flops • Control signal precedence: Clear, Preset, Clock Enable VHDL Verilog FF_AR_CE: process(CLK) begin if (CLK’event and CLK = ‘ 1’) then if (RST = ‘ 1’) then Q <= ‘ 0’; elsif (SET = ‘ 1’) then Q <= ‘ 1’; elsif (CE = ‘ 1’) then Q <= D_IN; end if; end process always @(posedge CLK) if (RST) Q <= 1’b 0; else if (SET) Q <= 1’b 1; else if (CE) Q <= D_IN; Synthesis 13 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Outline • • • Coding Tips Instantiating Resources Synthesis Options Summary Appendix – Inferring

Outline • • • Coding Tips Instantiating Resources Synthesis Options Summary Appendix – Inferring Logic and Flip-Flop Resources – Inferring Memory – Inferring I/Os and Global Resources Synthesis 14 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Instantiation versus Inference • Instantiate a component when you must dictate exactly which resource

Instantiation versus Inference • Instantiate a component when you must dictate exactly which resource is needed – The synthesis tool is unable to infer the resource – The synthesis tool fails to infer the resource • Xilinx recommends inference whenever possible – Inference makes your code more portable • Xilinx recommends using the CORE Generator™ software system to create functions such as Arithmetic Logic Units (ALUs), fast multipliers, and Finite Impulse Response (FIR) filters for instantiation Synthesis 15 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Instantiation Tips • Use instantiation only when accessing device features, increasing performance, or decreasing

Instantiation Tips • Use instantiation only when accessing device features, increasing performance, or decreasing area is necessary – Exceptions are noted at the end of this section • Limit the location of instantiated components to a few source files to make locating these components easier when porting the code Synthesis 16 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

FPGA Resources • Can be inferred by all synthesis tools: • – Shift register

FPGA Resources • Can be inferred by all synthesis tools: • – Shift register LUT (SRL 16/ SRLC 16) – F 5, F 6, F 7, and F 8 multiplexers – Carry logic – MULT_AND – MULT 18 x 18/MULT 18 x 18 S – Global clock buffers (BUFG) – Select. IO™ (single-ended) standard – I/O registers (single data rate) – Input DDR registers Synthesis 17 Can be inferred by some synthesis tools: – – • Memories (ROM/RAM) Global clock buffers (BUFGCE, BUFGMUX, BUFGDLL) Cannot be inferred by any synthesis tools: – – – Select. IO (differential) standard Output DDR registers DCM © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Suggested Instantiation • Xilinx recommends that you instantiate the following elements: – Memory resources

Suggested Instantiation • Xilinx recommends that you instantiate the following elements: – Memory resources • Block RAMs specifically (use the CORE Generator™ software system to build large memories) – Select. IO standard resources – Clock management resources • DCM (use the Architecture Wizard) • IBUFG, BUFGMUX, and BUFGCE Synthesis 18 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Suggested Instantiation • Why does Xilinx suggest this? Xilinx “wrapper” top_xlnx STARTUP – Easier

Suggested Instantiation • Why does Xilinx suggest this? Xilinx “wrapper” top_xlnx STARTUP – Easier to change (port) to other and newer technologies – Fewer synthesis constraints and attributes to pass on • Keeping most of the IBUFG DCM BUFG IBUF_SSTL 2_I OBUF_GTL Top-Level Block OBUF_GTL attributes and constraints in the Xilinx User Constraints File (UCF) keeps it simple—one file contains critical information • Create a separate hierarchical block for instantiating these resources – Above the top-level block, create a Xilinx “wrapper” with Xilinxspecific instantiations Synthesis 19 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Outline • • • Coding Tips Instantiating Resources Synthesis Options Summary Appendix – Inferring

Outline • • • Coding Tips Instantiating Resources Synthesis Options Summary Appendix – Inferring Logic and Flip-Flop Resources – Inferring Memory – Inferring I/Os and Global Resources Synthesis 20 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Synthesis Options • There are many synthesis options that can help you obtain your

Synthesis Options • There are many synthesis options that can help you obtain your performance and area objectives: – – – – Timing-Driven Synthesis FSM Extraction Retiming Register Duplication Hierarchy Management Resource Sharing Physical Optimization • XST Constraints are entered in a. xcf file Synthesis 21 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Timing-Driven Synthesis • Synplify, Precision, and XST software • Timing-driven synthesis uses performance objectives

Timing-Driven Synthesis • Synplify, Precision, and XST software • Timing-driven synthesis uses performance objectives to drive the optimization of the design – Based on your performance objectives, the tools will try several algorithms to attempt to meet performance while keeping the amount of resources in mind – Performance objectives are provided to the synthesis tool via timing constraints Synthesis 22 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

FSM Extraction • Finite State Machine (FSM) extraction optimizes your state machine by re-encoding

FSM Extraction • Finite State Machine (FSM) extraction optimizes your state machine by re-encoding and optimizing your design based on the number of states and inputs – By default, the tools will use FSM extraction • Safe state machines – Be default, the synthesis tools will remove all decoding for illegal states • Even if you include VHDL “when others” or Verilog “default” cases – Must be turned on to use “safe” FSM implementation • See Notes for more information Synthesis 23 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Retiming • Synplify, Precision, and XST software • Retiming: The synthesis tool automatically tries

Retiming • Synplify, Precision, and XST software • Retiming: The synthesis tool automatically tries to move register stages to balance combinatorial delay on each side of the registers Before Retiming D Q D Q After Retiming D Q D Synthesis 24 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only Q

Register Duplication • Synplify, Precision, and XST software • Register duplication is used to

Register Duplication • Synplify, Precision, and XST software • Register duplication is used to reduce fanout on registers (to improve delays) • Register duplication of the output 3 -state register is used so that the IOB 3 -state register can be moved inside the IOB to reduce clk-to-output delays • Xilinx recommends manual register duplication – Most synthesis vendors create signals <signal_name>_rep 0, _rep 1, etc. • Implementation tools pack these signals into the same slice • This can prohibit a register from being moved closer to its destination – When manually duplicating registers, do not use a Synthesis 25 number at the end © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Hierarchy Management • The basic settings are: – Flatten the design: Allows total combinatorial

Hierarchy Management • The basic settings are: – Flatten the design: Allows total combinatorial optimization across all boundaries – Maintain hierarchy: Preserves hierarchy without allowing optimization of combinatorial logic across boundaries • If you have followed the synchronous design guidelines, use the setting -maintain hierarchy • If you have not followed the synchronous design guidelines, use the setting -flatten the design • Your synthesis tool may have additional settings – Refer to your synthesis documentation for details on these settings Synthesis 26 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Hierarchy Preservation Benefits • Easily locate problems in the code based on the hierarchical

Hierarchy Preservation Benefits • Easily locate problems in the code based on the hierarchical instance names contained within static timing analysis reports • Enables floorplanning and incremental design flow • The primary advantage of flattening is to optimize combinatorial logic across hierarchical boundaries – If the outputs of leaf-level blocks are registered, there is no need to flatten Synthesis 27 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Schematic Viewers • Allows you to view synthesis results graphically – Check the number

Schematic Viewers • Allows you to view synthesis results graphically – Check the number of logic levels between flip-flops – Locate net and instance names quickly – View the design as generic RTL or technology-specific components • Works best when hierarchy has been preserved during synthesis Synthesis 28 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Physical Optimization • Synplicity Amplify FPGA Physical Optimizer or Mentor Precision Physical software (addon

Physical Optimization • Synplicity Amplify FPGA Physical Optimizer or Mentor Precision Physical software (addon tools) • Based on the critical paths in the design, the tools will attempt to optimize and physically locate the associated logic closely together to minimize the routing delays • Essentially, this is a way to provide critical path information to the synthesis tool so that it can attempt to further optimize those paths For Academic Use Only Synthesis 29 © 2005 Xilinx, Inc. All Rights Reserved

Increasing Productivity • Use synchronous design techniques • Preserve hierarchy during synthesis – Aids

Increasing Productivity • Use synchronous design techniques • Preserve hierarchy during synthesis – Aids in debugging and cross-referencing to report files • Use timing-driven synthesis if your tool supports it – Check the synthesis report for performance estimates • After implementation, look at timing reports and identify critical paths – Double-check the HDL coding style for these paths – Try some of the synthesis options discussed earlier • For paths that continually fail to meet timing, add Synthesis 30 path-specific constraints during synthesis © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Outline • • • Coding Tips Instantiating Resources Synthesis Options Summary Appendix – Inferring

Outline • • • Coding Tips Instantiating Resources Synthesis Options Summary Appendix – Inferring Logic and Flip-Flop Resources – Inferring Memory – Inferring I/Os and Global Resources Synthesis 31 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only

Summary • Your HDL coding style can affect synthesis results • Infer functions whenever

Summary • Your HDL coding style can affect synthesis results • Infer functions whenever possible • Use one-hot encoding to improve design performance • When coding a state machine, separate the next- state logic from the state machine output equations • Most resources are inferable, either directly or with an attribute • Take advantage of the synthesis options provided to help you meet your timing objectives • Use synchronous design techniques and timing. Synthesis 32 driven synthesis to achieve higher. Forperformance Academic Use Only © 2005 Xilinx, Inc. All Rights Reserved

Where Can I Learn More? • Synthesis & Simulation Design Guide – www. xilinx.

Where Can I Learn More? • Synthesis & Simulation Design Guide – www. xilinx. com Documentation Software Manuals • User Guides – www. xilinx. com Documentation User Guides • Technical Tips – www. xilinx. com Support Tech Tips – Click Xilinx Synthesis Technology, Synopsys FPGA and Design Compiler, or Synplicity • Synthesis documentation or online help Synthesis 33 © 2005 Xilinx, Inc. All Rights Reserved For Academic Use Only