当前位置:   article > 正文

vivado IDELAY原语使用

idelay原语

介绍:vivado iodelay可以调整输入FPGA IO信号的延时,集成在芯片IOB内部以ps为单位。适用于外部输入信号时钟和数据由于走线延时不等长导致的不同步,可以通过给时钟或者数据加idelay单元,使得时钟能稳定的采集到数据。

在7系列的FPGA里,该原语名字为idelay2,用法如下所示。

CINVCTRL_SEL: 是否动态翻转时钟信号C的极性
DELAY_SRC:输入信号来源

        IDATAIN:输入信号来自于端口(管脚输入的信号),输入数据信号要接在IDATAIN端口

        DATAIN:输入信号来自于数据(内部的信号),用于级连延时链。输入信号要接在DATAIN    端口

IDELAY_TYPE有三种模式:

        fixed:固定延时模式,通过调整输入IDELAY_VALUE数值可以实现不同挡位的延时效果。但是每次编译完延时就固定了。

        VAR_LOADABLE:动态加载抽头值模式,可以在线调整延时大小,通过调整输入CNTVALUEIN的数值,可以实时的修改端口的延时状态。

SIGNAL_PATTERN:用于配置输入信号属性,不同类型信号路径上的抖动不同

        CLOCK:时钟信号;

        DATA:数据信号;

HIGH_PERFORMANCE_MODE:是否使用高性能模式减小抖动,会增加功耗。

IDELAYCTRL原语

IDELAYCTRL:使用IDELAY或者ODELAY,IDELAYCTRL必须被使用。因为IDELAY或者ODELAY的延迟精度是由IDELAYCTRL的输入时钟决定的,一般为200MHz。REFCLK输入时钟最好经过BUFG上全局时钟树。

用法如下所示:

  1. wire ref_clock_bufg;
  2. (* IODELAY_GROUP = "selectio_wiz_1_group" *)
  3. IDELAYCTRL delayctrl (
  4. .RDY (delay_locked),
  5. .REFCLK (ref_clock_bufg),
  6. .RST (!rst_n));
  7. BUFG ref_clk_bufg (
  8. .I (clk_200m),
  9. .O (ref_clock_bufg));
  10. /******************FIXED 模式*************************************/
  11. (* IODELAY_GROUP = "selectio_wiz_1_group" *)
  12. IDELAYE2
  13. # (
  14. .CINVCTRL_SEL ("FALSE"), // TRUE, FALSE
  15. .DELAY_SRC ("IDATAIN"), // IDATAIN, DATAIN
  16. .HIGH_PERFORMANCE_MODE ("TRUE"), // TRUE, FALSE
  17. .IDELAY_TYPE ("FIXED"), // FIXED, VARIABLE, or VAR_LOADABLE
  18. .IDELAY_VALUE (CLK0_TAPS), // 0 to 31
  19. .REFCLK_FREQUENCY (200.0),
  20. .PIPE_SEL ("FALSE"),
  21. .SIGNAL_PATTERN ("CLOCK")) // CLOCK, DATA
  22. idelaye2_clk0
  23. (
  24. .DATAOUT (dco_0_temp_delay), // Delayed clock
  25. .DATAIN (1'b0), // Data from FPGA logic
  26. .C (ref_clock_bufg),
  27. .CE (1'b0),
  28. .INC (1'b0),
  29. .IDATAIN (dco_0_temp),
  30. .LD (0),
  31. .LDPIPEEN (1'b0),
  32. .REGRST (1'b0),
  33. .CNTVALUEIN (5'b00000),
  34. .CNTVALUEOUT (),
  35. .CINVCTRL (1'b0)
  36. );
  37. // FIXED 模式下级联延时链
  38. wire dco_0_temp_delay1;
  39. (* IODELAY_GROUP = "selectio_wiz_1_group" *)
  40. IDELAYE2
  41. # (
  42. .CINVCTRL_SEL ("FALSE"), // TRUE, FALSE
  43. .DELAY_SRC ("DATAIN"), // IDATAIN, DATAIN
  44. .HIGH_PERFORMANCE_MODE ("TRUE"), // TRUE, FALSE
  45. .IDELAY_TYPE ("FIXED"), // FIXED, VARIABLE,orVAR_LOADABLE
  46. .IDELAY_VALUE (CLK1_TAPS), // 0 to 31
  47. .REFCLK_FREQUENCY (200.0),
  48. .PIPE_SEL ("FALSE"),
  49. .SIGNAL_PATTERN ("CLOCK")) // CLOCK, DATA
  50. idelaye2_clk2
  51. (
  52. .DATAOUT (dco_0_temp_delay1), // Delayed clock
  53. .DATAIN (dco_0_temp_delay), // Data from FPGA logic
  54. .C (ref_clock_bufg),
  55. .CE (1'b0),
  56. .INC (1'b0),
  57. .IDATAIN (1'b0),
  58. .LD (0),
  59. .LDPIPEEN (1'b0),
  60. .REGRST (1'b0),
  61. .CNTVALUEIN (5'b00000),
  62. .CNTVALUEOUT (),
  63. .CINVCTRL (1'b0)
  64. );
  65. /****************** VAR_LOADABLE 模式*************************************/
  66. genvar pin_count;
  67. generate
  68. for (pin_count = 0; pin_count < 5; pin_count = pin_count + 1) begin: pins
  69. (* IODELAY_GROUP = "selectio_wiz_1_group" *)
  70. IDELAYE2
  71. # (
  72. .CINVCTRL_SEL ("FALSE"), // TRUE, FALSE
  73. .DELAY_SRC ("IDATAIN"), // IDATAIN, DATAIN
  74. .HIGH_PERFORMANCE_MODE ("TRUE"), // TRUE, FALSE
  75. .IDELAY_TYPE ("VAR_LOAD"), // FIXED, VARIABLE, or VAR_LOADABLE
  76. .IDELAY_VALUE (DATA0_TAPS), // 0 to 31
  77. .REFCLK_FREQUENCY (200.0),
  78. .PIPE_SEL ("FALSE"),
  79. .SIGNAL_PATTERN ("DATA")) // CLOCK, DATA
  80. idelaye2_bus_adc0_l
  81. (
  82. .DATAOUT (data_in_p0_delay[pin_count]),
  83. .DATAIN (1'b0), // Data from FPGA logic
  84. .C (ref_clock_bufg),
  85. .CE (1'b0),
  86. .INC (1'b0),
  87. .IDATAIN (data_in_p0[pin_count]), // Driven by IOB
  88. .LD (1'b1),
  89. .REGRST (1'b0),
  90. .LDPIPEEN (1'b0),
  91. .CNTVALUEIN (FIRST_IMAGE_DATA_NUM),
  92. .CNTVALUEOUT (),
  93. .CINVCTRL (1'b0)
  94. );
  95. (* IODELAY_GROUP = "selectio_wiz_1_group" *)
  96. IDELAYE2
  97. # (
  98. .CINVCTRL_SEL ("FALSE"), // TRUE, FALSE
  99. .DELAY_SRC ("IDATAIN"), // IDATAIN, DATAIN
  100. .HIGH_PERFORMANCE_MODE ("TRUE"), // TRUE, FALSE
  101. .IDELAY_TYPE ("VAR_LOAD"), // FIXED, VARIABLE, or VAR_LOADABLE
  102. .IDELAY_VALUE (DATA1_TAPS), // 0 to 31
  103. .REFCLK_FREQUENCY (100.0),
  104. .PIPE_SEL ("FALSE"),
  105. .SIGNAL_PATTERN ("DATA")) // CLOCK, DATA
  106. idelaye2_bus_adc1_l
  107. (
  108. .DATAOUT (data_in_p1_delay[pin_count]),
  109. .DATAIN (1'b0), // Data from FPGA logic
  110. .C (ref_clock_bufg),
  111. .CE (1'b0),
  112. .INC (1'b0),
  113. .IDATAIN (data_in_p1[pin_count]), // Driven by IOB
  114. .LD (1'b1),
  115. .REGRST (1'b0),
  116. .LDPIPEEN (1'b0),
  117. .CNTVALUEIN (DATA_ADC2_DELAY),
  118. .CNTVALUEOUT (),
  119. .CINVCTRL (1'b0)
  120. );
  121. end
  122. endgenerate

在ultrascare+系列FPGA中,idelay原语改为idelay3

用法如下所示:

  1. wire delay_locked;
  2. wire ref_clock_bufg;
  3. (* IODELAY_GROUP = "selectio_wiz_1_group" *)
  4. IDELAYCTRL #(
  5. .SIM_DEVICE("ULTRASCALE") // Set the device version for simulation functionality (ULTRASCALE)
  6. )
  7. delayctrl (
  8. .RDY (delay_locked),
  9. .REFCLK (ref_clock_bufg),
  10. .RST (!rst_n));
  11. BUFG ref_clk_bufg (
  12. .I (clk_200m),
  13. .O (ref_clock_bufg));
  14. wire [8:0] cntvout;
  15. wire [8:0] cntvout_1;
  16. genvar pin_count;
  17. generate
  18. for (pin_count = 0; pin_count < 5; pin_count = pin_count + 1) begin: pins
  19. (* IODELAY_GROUP = "selectio_wiz_1_group" *)
  20. IDELAYE3 #(
  21. .CASCADE("NONE"), // Cascade setting (MASTER, NONE, SLAVE_END, SLAVE_MIDDLE)
  22. .DELAY_FORMAT("TIME"), // Units of the DELAY_VALUE (COUNT, TIME)
  23. .DELAY_SRC("IDATAIN"), // Delay input (DATAIN, IDATAIN)
  24. .DELAY_TYPE("VAR_LOAD"), // Set the type of tap delay line (FIXED, VARIABLE, VAR_LOAD)
  25. .DELAY_VALUE(1100), // Input delay value setting
  26. .IS_CLK_INVERTED(1'b0), // Optional inversion for CLK
  27. .IS_RST_INVERTED(1'b0), // Optional inversion for RST
  28. .REFCLK_FREQUENCY(300.0), // IDELAYCTRL clock input frequency in MHz (200.0-800.0)
  29. .SIM_DEVICE("ULTRASCALE_PLUS"), // Set the device version for simulation functionality (ULTRASCALE,
  30. // ULTRASCALE_PLUS, ULTRASCALE_PLUS_ES1, ULTRASCALE_PLUS_ES2)
  31. .UPDATE_MODE("ASYNC") // Determines when updates to the delay will take effect (ASYNC, MANUAL,
  32. // SYNC)
  33. )
  34. idelaye2_bus_adc0_l (
  35. .CASC_OUT(), // 1-bit output: Cascade delay output to ODELAY input cascade
  36. .CNTVALUEOUT(cntvout), // 9-bit output: Counter value output
  37. .DATAOUT(data_in_p0_delay[pin_count]), // 1-bit output: Delayed data output
  38. .CASC_IN(1'b0), // 1-bit input: Cascade delay input from slave ODELAY CASCADE_OUT
  39. .CASC_RETURN(1'b0), // 1-bit input: Cascade delay returning from slave ODELAY DATAOUT
  40. .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
  41. .CLK(ref_clock_bufg), // 1-bit input: Clock input
  42. .CNTVALUEIN(DATA_ADC2_DELAY), // 9-bit input: Counter value input
  43. .DATAIN(1'b0), // 1-bit input: Data input from the IOBUF
  44. .EN_VTC(1'b1), // 1-bit input: Keep delay constant over VT
  45. .IDATAIN(data_in_p0[pin_count]), // 1-bit input: Data input from the logic
  46. .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
  47. .LOAD(1'b0), // 1-bit input: Load DELAY_VALUE input
  48. .RST(1'b0) // 1-bit input: Asynchronous Reset to the DELAY_VALUE
  49. );
  50. (* IODELAY_GROUP = "selectio_wiz_1_group" *)
  51. IDELAYE3 #(
  52. .CASCADE("NONE"), // Cascade setting (MASTER, NONE, SLAVE_END, SLAVE_MIDDLE)
  53. .DELAY_FORMAT("TIME"), // Units of the DELAY_VALUE (COUNT, TIME)
  54. .DELAY_SRC("IDATAIN"), // Delay input (DATAIN, IDATAIN)
  55. .DELAY_TYPE("VAR_LOAD"), // Set the type of tap delay line (FIXED, VARIABLE, VAR_LOAD)
  56. .DELAY_VALUE(1100), // Input delay value setting
  57. .IS_CLK_INVERTED(1'b0), // Optional inversion for CLK
  58. .IS_RST_INVERTED(1'b0), // Optional inversion for RST
  59. .REFCLK_FREQUENCY(300.0), // IDELAYCTRL clock input frequency in MHz (200.0-800.0)
  60. .SIM_DEVICE("ULTRASCALE_PLUS"), // Set the device version for simulation functionality (ULTRASCALE,
  61. // ULTRASCALE_PLUS, ULTRASCALE_PLUS_ES1, ULTRASCALE_PLUS_ES2)
  62. .UPDATE_MODE("ASYNC") // Determines when updates to the delay will take effect (ASYNC, MANUAL,
  63. // SYNC)
  64. )
  65. idelaye2_bus_adc1_l (
  66. .CASC_OUT(), // 1-bit output: Cascade delay output to ODELAY input cascade
  67. .CNTVALUEOUT(cntvout_1), // 9-bit output: Counter value output
  68. .DATAOUT(data_in_p1_delay[pin_count]), // 1-bit output: Delayed data output
  69. .CASC_IN(1'b0), // 1-bit input: Cascade delay input from slave ODELAY CASCADE_OUT
  70. .CASC_RETURN(1'b0), // 1-bit input: Cascade delay returning from slave ODELAY DATAOUT
  71. .CE(1'b0), // 1-bit input: Active high enable increment/decrement input
  72. .CLK(ref_clock_bufg), // 1-bit input: Clock input
  73. .CNTVALUEIN(DATA_ADC2_DELAY), // 9-bit input: Counter value input
  74. .DATAIN(1'b0), // 1-bit input: Data input from the IOBUF
  75. .EN_VTC(1'b1), // 1-bit input: Keep delay constant over VT
  76. .IDATAIN(data_in_p1[pin_count]), // 1-bit input: Data input from the logic
  77. .INC(1'b0), // 1-bit input: Increment / Decrement tap delay input
  78. .LOAD(1'b0), // 1-bit input: Load DELAY_VALUE input
  79. .RST(1'b0) // 1-bit input: Asynchronous Reset to the DELAY_VALUE
  80. );
  81. end
  82. endgenerate

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/739108
推荐阅读
相关标签
  

闽ICP备14008679号