当前位置:   article > 正文

m基于FPGA的数字下变频verilog设计_fpga数字下变频

fpga数字下变频

目录

1.算法描述

2.仿真效果预览

3.verilog核心程序

4.完整FPGA


1.算法描述

整个数字下变频的基本结构如下所示

NCO使用CORDIC算法,CIC采用h结构的CIC滤波器,HBF采用复用结构的半带滤波器,而FIR则采用DA算法结构。

    这里,我们首先假设不考虑中频信号输入的载波频偏问题,即发送的中频频率和本地的载波频率是一致的。

为了验证系统的正确性,我们首先需要设计一个发送源,由于你要求的信号带宽为20M,

所以整个系统我们设计的系统参数为,中频为80M,A/D采样为60M。本地接收端的载波频率为20M。

即发送端通过80M的中频调制之后,信号的频谱会搬移到80M附近,然后接收端通过AD60M采样后,会将频谱搬移到20M附近,且不会发生混叠现象。

那么系统测试方案可以简化为,一个中心频率在20M附近的中频输入测试信号进行测试。

首先设计一个发送测试信号。

信号的基本结构如下所示:

      我们首先在FPGA中设计这么一个结构得到中频测试信号,然后使用这个测试信号进行下变频测试。

整个系统的原理框图如下所示:

RTL图:

综合资源占用:

2.仿真效果预览

本系统采用了2个FPGA平台开发,分别是

quartusii10.0,ModelSim-Altera 6.6d Starter Edition

vivaod2019.2

其中quartusii的仿真结果如下:

 

 

 

 

vivado的仿真版本如下:

3.verilog核心程序

  1. module tops2(
  2. reset,
  3. clk,
  4. clk0,
  5. rst0,
  6. clk1,
  7. rst1,
  8. I0,
  9. phase0,
  10. phase1,
  11. Q0,
  12. cosr,
  13. I_cic,
  14. I_d,
  15. I_hb,
  16. I_out,
  17. Q_d,
  18. Q_out,
  19. R,
  20. sinr
  21. );
  22. input wire reset;
  23. input wire clk;
  24. input wire clk0;
  25. input wire rst0;
  26. input wire clk1;
  27. input wire rst1;
  28. input wire [7:0] I0;
  29. input wire [7:0] phase0;
  30. input wire [7:0] phase1;
  31. input wire [7:0] Q0;
  32. output wire [7:0] cosr;
  33. output wire [47:0] I_cic;
  34. output wire [13:0] I_d;
  35. output wire [31:0] I_hb;
  36. output wire [15:0] I_out;
  37. output wire [13:0] Q_d;
  38. output wire [15:0] Q_out;
  39. output wire [13:0] R;
  40. output wire [7:0] sinr;
  41. wire [47:0] I_cic_ALTERA_SYNTHESIZED;
  42. wire [31:0] I_hb_ALTERA_SYNTHESIZED;
  43. wire [47:0] Q_cic;
  44. wire [31:0] Q_hb;
  45. wire [13:0] SYNTHESIZED_WIRE_0;
  46. wire [13:0] SYNTHESIZED_WIRE_1;
  47. wire [13:0] SYNTHESIZED_WIRE_2;
  48. wire SYNTHESIZED_WIRE_3;
  49. wire SYNTHESIZED_WIRE_4;
  50. wire SYNTHESIZED_WIRE_5;
  51. wire SYNTHESIZED_WIRE_6;
  52. assign I_d = SYNTHESIZED_WIRE_0;
  53. assign Q_d = SYNTHESIZED_WIRE_1;
  54. assign R = SYNTHESIZED_WIRE_2;
  55. cic_top b2v_inst(
  56. .i_clk(clk),
  57. .i_rst(reset),
  58. .i_din(SYNTHESIZED_WIRE_0),
  59. .o_clk16(SYNTHESIZED_WIRE_3),
  60. .o_dout(I_cic_ALTERA_SYNTHESIZED));
  61. defparam b2v_inst.WIDTH = 48;
  62. cic_top b2v_inst1(
  63. .i_clk(clk),
  64. .i_rst(reset),
  65. .i_din(SYNTHESIZED_WIRE_1),
  66. .o_clk16(SYNTHESIZED_WIRE_4),
  67. .o_dout(Q_cic));
  68. defparam b2v_inst1.WIDTH = 48;
  69. Rec b2v_inst12(
  70. .clk(clk1),
  71. .rst(rst1),
  72. .phase(phase1),
  73. .recs(SYNTHESIZED_WIRE_2),
  74. .Iss(SYNTHESIZED_WIRE_0),
  75. .Qss(SYNTHESIZED_WIRE_1));
  76. hb_filter_02 b2v_inst2(
  77. .i_clk(SYNTHESIZED_WIRE_3),
  78. .i_rst(reset),
  79. .i_din(I_cic_ALTERA_SYNTHESIZED[34:19]),
  80. .o_clk2(SYNTHESIZED_WIRE_5),
  81. .o_dout(I_hb_ALTERA_SYNTHESIZED));
  82. defparam b2v_inst2.h0 = 27316;
  83. defparam b2v_inst2.h1 = 20073;
  84. defparam b2v_inst2.h11 = 1238;
  85. defparam b2v_inst2.h13 = -1175;
  86. defparam b2v_inst2.h15 = -624;
  87. defparam b2v_inst2.h3 = -4745;
  88. defparam b2v_inst2.h5 = 965;
  89. defparam b2v_inst2.h7 = 667;
  90. defparam b2v_inst2.h9 = -1238;
  91. hb_filter_02 b2v_inst3(
  92. .i_clk(SYNTHESIZED_WIRE_4),
  93. .i_rst(reset),
  94. .i_din(Q_cic[34:19]),
  95. .o_clk2(SYNTHESIZED_WIRE_6),
  96. .o_dout(Q_hb));
  97. defparam b2v_inst3.h0 = 27316;
  98. defparam b2v_inst3.h1 = 20073;
  99. defparam b2v_inst3.h11 = 1238;
  100. defparam b2v_inst3.h13 = -1175;
  101. defparam b2v_inst3.h15 = -624;
  102. defparam b2v_inst3.h3 = -4745;
  103. defparam b2v_inst3.h5 = 965;
  104. defparam b2v_inst3.h7 = 667;
  105. defparam b2v_inst3.h9 = -1238;
  106. firfilter_da b2v_inst4(
  107. .CLK(SYNTHESIZED_WIRE_5),
  108. .Reset(reset),
  109. .DIN(I_hb_ALTERA_SYNTHESIZED[30:23]),
  110. .Dout(I_out));
  111. firfilter_da b2v_inst5(
  112. .CLK(SYNTHESIZED_WIRE_6),
  113. .Reset(reset),
  114. .DIN(Q_hb[30:23]),
  115. .Dout(Q_out));
  116. Trans b2v_inst6(
  117. .clock(clk0),
  118. .reset(rst0),
  119. .I(I0),
  120. .phase(phase0),
  121. .Q(Q0),
  122. .cosr(cosr),
  123. .r(SYNTHESIZED_WIRE_2),
  124. .sinr(sinr));
  125. assign I_cic = I_cic_ALTERA_SYNTHESIZED;
  126. assign I_hb = I_hb_ALTERA_SYNTHESIZED;
  127. endmodule
  128. 01-115m

4.完整FPGA

V

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号