GainControlWrapper.v 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. `timescale 1ns / 1ps
  2. // (* use_dsp48 = "yes"*)
  3. //////////////////////////////////////////////////////////////////////////////////
  4. // Company:
  5. // Engineer: Churbanov S.
  6. //
  7. // Create Date: 15:24:31 08/20/2019
  8. // Design Name:
  9. // Module Name: gain_master
  10. // Project Name:
  11. // Target Devices:
  12. // Tool versions:
  13. // Description:
  14. //
  15. // Dependencies:
  16. //
  17. // Revision:
  18. // Revision 0.02 - File Modified
  19. // Additional Comments: 16.09.2019 file modified in assotiate with task.
  20. //
  21. //////////////////////////////////////////////////////////////////////////////////
  22. module GainControlWrapper
  23. #(
  24. parameter AdcDataWidth = 14,
  25. parameter ThresholdWidth = 24,
  26. parameter PhIncWidth = 32,
  27. parameter IfNcoOutWidth = 18,
  28. parameter MeasPeriod = 32
  29. )
  30. (
  31. input Rst_i,
  32. input Clk_i,
  33. input StartMeas_i,
  34. input [IfNcoOutWidth-1:0] NcoSin_i,
  35. input [IfNcoOutWidth-1:0] NcoCos_i,
  36. input [AdcDataWidth-1:0] AdcData_i,
  37. input [ThresholdWidth-1:0] GainLowThreshold_i,
  38. input [ThresholdWidth-1:0] GainHighThreshold_i,
  39. input GainAutoEn_i,
  40. input GainManualState_i,
  41. output AmpEnNewState_o,
  42. output SensEn_o,
  43. output MeasStart_o
  44. );
  45. //================================================================================
  46. // LOCALPARAM
  47. localparam MultDataWidth = 36;
  48. //================================================================================
  49. wire [MultDataWidth-1:0] adcSin;
  50. wire [MultDataWidth-1:0] adcCos;
  51. wire [MultDataWidth-1:0] adcSinCut = adcSin [MultDataWidth-1:0];
  52. wire [MultDataWidth-1:0] adcCosCut = adcCos [MultDataWidth-1:0];
  53. wire gainNewState;
  54. //================================================================================
  55. // ASSIGNMENTS
  56. assign AmpEnNewState_o = (GainAutoEn_i)? gainNewState:GainManualState_i;
  57. //================================================================================
  58. // CODING
  59. MultModule
  60. #(
  61. .AdcDataWidth (AdcDataWidth),
  62. .IfNcoOutWidth (IfNcoOutWidth)
  63. )
  64. Adc1Mult
  65. (
  66. .Rst_i (Rst_i),
  67. .Clk_i (Clk_i),
  68. .AdcData_i (AdcData_i),
  69. .Sin_i (NcoSin_i),
  70. .Cos_i (NcoCos_i),
  71. .AdcSin_o (adcSin),
  72. .AdcCos_o (adcCos)
  73. );
  74. GainControl
  75. #(
  76. .AdcNcoMultWidth (MultDataWidth),
  77. .ThresholdWidth (ThresholdWidth),
  78. .AdcDataWidth (AdcDataWidth),
  79. .MeasPeriod (MeasPeriod)
  80. )
  81. GainMaster
  82. (
  83. .Rst_i (Rst_i),
  84. .StartMeas_i (StartMeas_i),
  85. .GainAutoEn_i (GainAutoEn_i),
  86. .Clk_i (Clk_i),
  87. .AdcCos_i (adcSin),
  88. .AdcSin_i (adcCos),
  89. .GainLowThreshold_i (GainLowThreshold_i),
  90. .GainHighThreshold_i (GainHighThreshold_i),
  91. .GainNewState_o (gainNewState),
  92. .SensEn_o (SensEn_o),
  93. .MeasStart_o (MeasStart_o)
  94. );
  95. endmodule