Download presentation
Presentation is loading. Please wait.
Published byAusten Burns Modified over 8 years ago
1
© 2003 Xilinx, Inc. All Rights Reserved Synchronous Design Techniques
2
Synchronous Design Techniques 11- 3 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Objectives After completing this module, you will be able to: Use hierarchy effectively Increase circuit reliability and performance by applying synchronous design techniques
3
Synchronous Design Techniques 11- 4 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Outline Hierarchical Design Synchronous Design for Xilinx FPGAs Summary
4
Synchronous Design Techniques 11- 5 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Using Hierarchy leads to greater design readability, re-use, and debug State Machines One-hot Binary Enumerated Counters Adders/Subtractors Bit Shifters Accumulators Building Blocks Standard widths Pipeline RAMs Data Paths Pipelining Muxing/De-muxing Arithmetic Coregen Parametizable functions FIFOs FIR Filters RAM Technology-Specific Functions Specific Functions Logiblox RAM Other IP/Cores Top Level of Design Infer or instantiate I/O here Hierarchical Design
5
Synchronous Design Techniques 11- 6 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Benefits of Using Hierarchy Design readability – Easier to understand design functionality and data flow – Easier to debug Easy to reuse parts of a design
6
Synchronous Design Techniques 11- 7 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Design Readability Tips Choose hierarchical blocks that have: – Minimum of routing between blocks – Logical data flow between blocks Choose descriptive labels for blocks and signals Keep clock domains separated – Makes the interaction between clocks very clear Keep the length of each source file manageable – Easier to read, synthesize, and debug
7
Synchronous Design Techniques 11- 8 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Design Reuse Tips Build a set of blocks that are available to all designers – Register banks – FIFOs – Other standard functions – Custom functions commonly used in your applications Name blocks by function and target Xilinx family – Easy to locate the block you want – Example: REG_4X8_S3 (bank of four 8-bit registers targeting Spartan-3) Store in a separate directory from the Xilinx tools – Prevents accidental deletion when updating tools
8
Synchronous Design Techniques 11- 9 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Outline Hierarchical Design Synchronous Design for Xilinx FPGAs Summary
9
Synchronous Design Techniques 11- 10 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Why Synchronous Design? Synchronous circuits are more reliable – Events are triggered by clock edges that occur at well-defined intervals – Outputs from one logic stage have a full clock cycle to propagate to the next stage Skew between data arrival times is tolerated within the same clock period Asynchronous circuits are less reliable – Delay may need to be a specific amount (for example, 12 ns) – Multiple delays may need to hold a specific relationship (for example, DATA arrives 5 ns before SELECT)
10
Synchronous Design Techniques 11- 11 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Asynchronous Design: Case Studies The design I created two years ago no longer works. What did Xilinx change in their FPGAs? – SRAM process improvements and geometry shrinks increase speed – Normal variations between wafer lots My design passes a timing simulation test but fails in-circuit. Is the timing simulation accurate? YES – Timing simulation uses worst-case delays – Actual board-level conditions are usually better
11
Synchronous Design Techniques 11- 12 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Clock Skew This shift register will not work because of clock skew! Expected operation Clock Q_A Q_B Q_C 3 cycles Clock skewed version A & C Clock Q_A Q_B Q_C B Clock 2 cycles D Q_B Q_C INPUT CLOCK D DQ_A 3.1 3.0 3.1 3.3 12.5 3.0 ABC
12
Synchronous Design Techniques 11- 13 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Use Global Buffers to Reduce Clock Skew Global buffers are connected to dedicated routing – This routing network is balanced to minimize skew All Xilinx FPGAs have global buffers – Virtex™-II, Virtex-II Pro devices have sixteen BUFGMUXes – Spartan-3 devices have eight BUFGMUXes – Virtex-E and Spartan™-II/E have four BUFGs You can always use a BUFG symbol, and the software will choose an appropriate buffer type – All major synthesis tools can infer global buffers onto clock signals that come from off-chip
13
Synchronous Design Techniques 11- 14 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Using Global Lines Most synthesis tools will automatically infer a BUFG on clocks – Clock signals must come from a top-level port – Internally generated clocks are not automatically placed on a BUFG Sample instantiation of BUFGMUX (Verilog) – VHDL declaration and instantiation in notes area BUFGMUX U_BUFGMUX (.I0( ), // insert clock input used when select(S) is Low.I1( ), // insert clock input used when select(S) is High.S( ), // insert Mux-Select input.O( ) // insert clock output); Note: These templates, and templates for other BUFGMUX configurations, are available in the ISE Language Templates
14
Synchronous Design Techniques 11- 15 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Traditional Clock Divider Introduces clock skew between CLK1 and CLK2 Uses an extra BUFG to reduce skew on CLK2 DQ CLK2 CLK1 BUFG DQ
15
Synchronous Design Techniques 11- 16 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Recommended Clock Divider No clock skew between flip-flops DQ CLK2_CE CLK1 D CE Q BUFG
16
Synchronous Design Techniques 11- 17 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Avoid Clock Glitches Because flip-flops in today’s FPGAs are very fast, they can respond to very narrow clock pulses Never source a clock signal from combinatorial logic – Also known as “gating the clock” Shorter routing Glitch may occur here MSB Binary Counter 0111 1000 transition can become 0111 1111 1000 due to faster MSB MSB FF LSB
17
Synchronous Design Techniques 11- 18 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Avoid Clock Glitches This circuit creates the same function, but it creates the function without glitches on the clock D Q3 INPUT CLOCK Counter Q2 Q1 Q0 CE Q D FF
18
Synchronous Design Techniques 11- 19 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Coding Clock Enables VHDL FF_AR_CE: process(CLK) begin if (CLK’event and CLK = ‘1’) then if (ENABLE = ‘1’) then Q <= D_IN; end if; end process Verilog always @(posedge CLOCK) if (ENABLE) Q = D_IN; If ENABLE is not a top-level port, write the code for ENABLE in another process – Makes code more readable – Helps synthesis tools create better netlists Control signal precedence: Reset, Set, Enable – Use this order in your code
19
Synchronous Design Techniques 11- 20 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only CLOCK Q[x] Binary Counter Q[0] INPUT RESET Q FF D CLR Asynchronous Reset Avoid Set/Reset Glitches Glitches on asynchronous set/reset inputs can lead to incorrect circuit behavior
20
Synchronous Design Techniques 11- 21 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only CLOCK Q[x] Counter Q[0] RESET INPUT Q FF D R Synchronous Reset Avoid Set/Reset Glitches Convert to synchronous set/reset when possible
21
Synchronous Design Techniques 11- 22 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Coding Synchronous FFs Asynchronous Reset always @(posedge CLOCK or posedge RESET) if (RESET) Q = 0; else Q = D_IN; Synchronous Reset always @(posedge CLOCK) if (RESET) Q = 0; else Q = D_IN;
22
Synchronous Design Techniques 11- 23 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Outline Hierarchical Design Synchronous Design for Xilinx FPGAs Summary
23
Synchronous Design Techniques 11- 24 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Skills Check
24
Synchronous Design Techniques 11- 25 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Review Questions List two benefits of hierarchical design Why should you use global buffers for your clock signals? What is an alternative to gating a clock?
25
Synchronous Design Techniques 11- 26 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Answers List two benefits of hierarchical design – Design readability – Design reuse Why should you use global buffers for your clock signals? – To reduce clock skew What is an alternative to gating a clock? – Use a clock enable
26
Synchronous Design Techniques 11- 27 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Summary Proper use of hierarchy aids design readability and debug Synchronous designs are more reliable than asynchronous designs FPGA design tips – Global clock buffers and DLLs eliminate skew – Avoid glitches on clocks and asynchronous set/resets
27
Synchronous Design Techniques 11- 28 © 2003 Xilinx, Inc. All Rights Reserved For Academic Use Only Where Can I Learn More? Application notes on http://support.xilinx.com – Under the Design tab, click App Notes Software documentation – Development System Reference Guide, Chapter 2: Design Flow, FPGA Design Techniques section – Libraries Guide – Documentation for your synthesis tool
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.