当前位置:   article > 正文

questasim/modelsim独立仿真vivado ddr3控制器(mig)_questasim vivado2021.1

questasim vivado2021.1

1.使用场合介绍

当工程中使用DDR做数据缓存时,使用vivado默认仿真器进行功能仿真时速率特别慢,而使用vivado和questasim联合仿真选项虽然能加速仿真(相当于从vivado跳转到questasim进行仿真),但是调试过程中每次修改代码都需要在vivado工具上修改并编译后再跳转到questasim进行波形仿真,流程比较麻烦。本文通过将vivado仿真ddr3控制器所需要的仿真文件扣出来到questasim中进行独立编译仿真。

2.使用vivado联合questasim仿真

为了了解仿真DDR3所需要的文件以及编译流程,先通过vivado跳转到questasim仿真查看编译了哪些文件。

2.1搭建仿真环境

2.1.1导出mig仿真例程

根据自己板子的ddr3芯片型号和使用需求生成mig,本文将mig ip核生成名为ddr3,勾选AXI4 Interface选项,在source框右击ddr3,选择Open Ip Example Design...选项,创建仿真工程ddr3_ex。

仿真工程生成好后找到ddr3_ex文件夹路径下imports文件夹,导入ddr3_model.sv,ddr3_model_parameters.vh,wiredly.v到自己工程目录下,并将sim_tb_top.v中的example_top换成自己需要仿真的顶层文件。最终如下图所示

2.2.2设置vivado仿真工具

点击Tools->setting

修改如下设置

点击Run Simulation跳转到questasim进行仿真,如下图所示

 仿真波形

2.2.3 查看仿真流程

进入工程路径下XX.sim->sim_1->behav->questa,有三个脚本可执行文件compile.bat,elaborate.bat和simulate.bat。分别代表仿真的三个步骤:综合,优化,执行仿真。

compile.bat:综合脚本,对源文件进行综合。脚本调用了DDR_AXI_tb_compile.do

  1. @echo off
  2. REM ****************************************************************************
  3. REM Vivado (TM) v2021.1 (64-bit)
  4. REM
  5. REM Filename : compile.bat
  6. REM Simulator : Mentor Graphics Questa Advanced Simulator
  7. REM Description : Script for compiling the simulation design source files
  8. REM
  9. REM Generated by Vivado on Sun Mar 24 21:40:16 +0800 2024
  10. REM SW Build 3247384 on Thu Jun 10 19:36:33 MDT 2021
  11. REM
  12. REM IP Build 3246043 on Fri Jun 11 00:30:35 MDT 2021
  13. REM
  14. REM usage: compile.bat
  15. REM
  16. REM ****************************************************************************
  17. set bin_path=D:\\questa202101\\win64
  18. call %bin_path%/vsim -c -do "do {DDR_AXI_tb_compile.do}" -l compile.log
  19. if "%errorlevel%"=="1" goto END
  20. if "%errorlevel%"=="0" goto SUCCESS
  21. :END
  22. exit 1
  23. :SUCCESS
  24. exit 0

DDR_AXI_tb_compile.do

包含Mig控制器仿真需要的所有源文件路径,将所有路径下的源文件拷贝出来,后期使用questasim独立综合使用。

  1. ######################################################################
  2. #
  3. # File name : DDR_AXI_tb_compile.do
  4. # Created on: Sun Mar 24 21:40:16 +0800 2024
  5. #
  6. # Auto generated by Vivado for 'behavioral' simulation
  7. #
  8. ######################################################################
  9. D:\\questa202101\\win64\\vlib questa_lib/work
  10. D:\\questa202101\\win64\\vlib questa_lib/msim
  11. D:\\questa202101\\win64\\vlib questa_lib/msim/xil_defaultlib
  12. D:\\questa202101\\win64\\vmap xil_defaultlib questa_lib/msim/xil_defaultlib
  13. D:\\questa202101\\win64\\vlog -incr -mfcu -work xil_defaultlib "+incdir+../../../../../imports" \
  14. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_ctrl_addr_decode.v" \
  15. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_ctrl_read.v" \
  16. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_ctrl_reg.v" \
  17. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_ctrl_reg_bank.v" \
  18. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_ctrl_top.v" \
  19. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_ctrl_write.v" \
  20. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_mc.v" \
  21. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_mc_ar_channel.v" \
  22. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_mc_aw_channel.v" \
  23. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_mc_b_channel.v" \
  24. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_mc_cmd_arbiter.v" \
  25. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_mc_cmd_fsm.v" \
  26. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_mc_cmd_translator.v" \
  27. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_mc_fifo.v" \
  28. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_mc_incr_cmd.v" \
  29. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_mc_r_channel.v" \
  30. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_mc_simple_fifo.v" \
  31. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_mc_wrap_cmd.v" \
  32. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_mc_wr_cmd_fsm.v" \
  33. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_axi_mc_w_channel.v" \
  34. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_ddr_axic_register_slice.v" \
  35. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_ddr_axi_register_slice.v" \
  36. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_ddr_axi_upsizer.v" \
  37. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_ddr_a_upsizer.v" \
  38. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_ddr_carry_and.v" \
  39. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_ddr_carry_latch_and.v" \
  40. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_ddr_carry_latch_or.v" \
  41. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_ddr_carry_or.v" \
  42. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_ddr_command_fifo.v" \
  43. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_ddr_comparator.v" \
  44. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_ddr_comparator_sel.v" \
  45. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_ddr_comparator_sel_static.v" \
  46. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_ddr_r_upsizer.v" \
  47. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/axi/mig_7series_v4_2_ddr_w_upsizer.v" \
  48. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/clocking/mig_7series_v4_2_clk_ibuf.v" \
  49. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/clocking/mig_7series_v4_2_infrastructure.v" \
  50. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/clocking/mig_7series_v4_2_iodelay_ctrl.v" \
  51. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/clocking/mig_7series_v4_2_tempmon.v" \
  52. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/controller/mig_7series_v4_2_arb_mux.v" \
  53. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/controller/mig_7series_v4_2_arb_row_col.v" \
  54. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/controller/mig_7series_v4_2_arb_select.v" \
  55. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/controller/mig_7series_v4_2_bank_cntrl.v" \
  56. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/controller/mig_7series_v4_2_bank_common.v" \
  57. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/controller/mig_7series_v4_2_bank_compare.v" \
  58. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/controller/mig_7series_v4_2_bank_mach.v" \
  59. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/controller/mig_7series_v4_2_bank_queue.v" \
  60. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/controller/mig_7series_v4_2_bank_state.v" \
  61. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/controller/mig_7series_v4_2_col_mach.v" \
  62. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/controller/mig_7series_v4_2_mc.v" \
  63. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/controller/mig_7series_v4_2_rank_cntrl.v" \
  64. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/controller/mig_7series_v4_2_rank_common.v" \
  65. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/controller/mig_7series_v4_2_rank_mach.v" \
  66. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/controller/mig_7series_v4_2_round_robin_arb.v" \
  67. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/ecc/mig_7series_v4_2_ecc_buf.v" \
  68. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/ecc/mig_7series_v4_2_ecc_dec_fix.v" \
  69. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/ecc/mig_7series_v4_2_ecc_gen.v" \
  70. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/ecc/mig_7series_v4_2_ecc_merge_enc.v" \
  71. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/ecc/mig_7series_v4_2_fi_xor.v" \
  72. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/ip_top/mig_7series_v4_2_memc_ui_top_axi.v" \
  73. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/ip_top/mig_7series_v4_2_mem_intfc.v" \
  74. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_byte_group_io.v" \
  75. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_byte_lane.v" \
  76. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_calib_top.v" \
  77. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_if_post_fifo.v" \
  78. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_mc_phy.v" \
  79. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_mc_phy_wrapper.v" \
  80. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_of_pre_fifo.v" \
  81. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_4lanes.v" \
  82. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_ck_addr_cmd_delay.v" \
  83. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_dqs_found_cal.v" \
  84. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_dqs_found_cal_hr.v" \
  85. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_init.v" \
  86. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_ocd_cntlr.v" \
  87. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_ocd_data.v" \
  88. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_ocd_edge.v" \
  89. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_ocd_lim.v" \
  90. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_ocd_mux.v" \
  91. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_ocd_po_cntlr.v" \
  92. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_ocd_samp.v" \
  93. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_oclkdelay_cal.v" \
  94. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_prbs_rdlvl.v" \
  95. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_rdlvl.v" \
  96. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_tempmon.v" \
  97. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_top.v" \
  98. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_wrcal.v" \
  99. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_wrlvl.v" \
  100. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_phy_wrlvl_off_delay.v" \
  101. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_prbs_gen.v" \
  102. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_ddr_skip_calib_tap.v" \
  103. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_poc_cc.v" \
  104. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_poc_edge_store.v" \
  105. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_poc_meta.v" \
  106. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_poc_pd.v" \
  107. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_poc_tap_base.v" \
  108. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/phy/mig_7series_v4_2_poc_top.v" \
  109. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/ui/mig_7series_v4_2_ui_cmd.v" \
  110. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/ui/mig_7series_v4_2_ui_rd_data.v" \
  111. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/ui/mig_7series_v4_2_ui_top.v" \
  112. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/ui/mig_7series_v4_2_ui_wr_data.v" \
  113. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/ddr3_mig_sim.v" \
  114. "../../../../project_1.gen/sources_1/ip/ddr3/ddr3/user_design/rtl/ddr3.v" \
  115. "../../../../../src/fdma_test.v" \
  116. "../../../../../src/signal_sync.v" \
  117. "../../../../../src/uiFDMA.v" \
  118. "../../../../../imports/wiredly.v" \
  119. D:\\questa202101\\win64\\vlog -incr -mfcu -sv -work xil_defaultlib "+incdir+../../../../../imports" \
  120. "../../../../../imports/ddr3_model.sv" \
  121. D:\\questa202101\\win64\\vlog -incr -mfcu -work xil_defaultlib "+incdir+../../../../../imports" \
  122. "../../../../../tb/DDR_AXI_tb.v" \
  123. # compile glbl module
  124. D:\\questa202101\\win64\\vlog -work xil_defaultlib "glbl.v"
  125. quit -force

elaborate.bat:优化

  1. @echo off
  2. REM ****************************************************************************
  3. REM Vivado (TM) v2021.1 (64-bit)
  4. REM
  5. REM Filename : elaborate.bat
  6. REM Simulator : Mentor Graphics Questa Advanced Simulator
  7. REM Description : Script for elaborating the compiled design
  8. REM
  9. REM Generated by Vivado on Sun Mar 24 21:40:34 +0800 2024
  10. REM SW Build 3247384 on Thu Jun 10 19:36:33 MDT 2021
  11. REM
  12. REM IP Build 3246043 on Fri Jun 11 00:30:35 MDT 2021
  13. REM
  14. REM usage: elaborate.bat
  15. REM
  16. REM ****************************************************************************
  17. set bin_path=D:\\questa202101\\win64
  18. call %bin_path%/vsim -c -do "do {DDR_AXI_tb_elaborate.do}" -l elaborate.log
  19. if "%errorlevel%"=="1" goto END
  20. if "%errorlevel%"=="0" goto SUCCESS
  21. :END
  22. exit 1
  23. :SUCCESS
  24. exit 0

 DDR_AXI_tb_elaborate.do

  1. ######################################################################
  2. #
  3. # File name : DDR_AXI_tb_elaborate.do
  4. # Created on: Sun Mar 24 21:40:34 +0800 2024
  5. #
  6. # Auto generated by Vivado for 'behavioral' simulation
  7. #
  8. ######################################################################
  9. D:\\questa202101\\win64\\vopt +acc=npr -L xil_defaultlib -L unisims_ver -L unimacro_ver -L secureip -L xpm -work xil_defaultlib xil_defaultlib.DDR_AXI_tb xil_defaultlib.glbl -o DDR_AXI_tb_opt
  10. quit -force

simulate.bat:启动仿真

  1. @echo off
  2. REM ****************************************************************************
  3. REM Vivado (TM) v2021.1 (64-bit)
  4. REM
  5. REM Filename : simulate.bat
  6. REM Simulator : Mentor Graphics Questa Advanced Simulator
  7. REM Description : Script for simulating the design by launching the simulator
  8. REM
  9. REM Generated by Vivado on Sun Mar 24 21:40:47 +0800 2024
  10. REM SW Build 3247384 on Thu Jun 10 19:36:33 MDT 2021
  11. REM
  12. REM IP Build 3246043 on Fri Jun 11 00:30:35 MDT 2021
  13. REM
  14. REM usage: simulate.bat
  15. REM
  16. REM ****************************************************************************
  17. set bin_path=D:\\questa202101\\win64
  18. call %bin_path%/vsim -do "do {DDR_AXI_tb_simulate.do}" -l simulate.log
  19. if "%errorlevel%"=="1" goto END
  20. if "%errorlevel%"=="0" goto SUCCESS
  21. :END
  22. exit 1
  23. :SUCCESS
  24. exit 0

 DDR_AXI_tb_simulate.do

  1. ######################################################################
  2. #
  3. # File name : DDR_AXI_tb_simulate.do
  4. # Created on: Sun Mar 24 21:40:47 +0800 2024
  5. #
  6. # Auto generated by Vivado for 'behavioral' simulation
  7. #
  8. ######################################################################
  9. vsim -lib xil_defaultlib DDR_AXI_tb_opt
  10. set NumericStdNoWarnings 1
  11. set StdArithNoWarnings 1
  12. do {DDR_AXI_tb_wave.do}
  13. view wave
  14. view structure
  15. view signals
  16. do {DDR_AXI_tb.udo}
  17. run 1000ns

3.移植到questasim进行独立仿真

参照上面仿真步骤以及之前博文(使用tcl脚本在questasim中仿真vivado工程)中questasim脚本仿真流程,编写仿真脚本

sim_axi_ddr.tcl

  1. set system_name DDR_MIG
  2. set TOP_LEVEL_NAME DDR_AXI_tb
  3. vlib questa_lib
  4. vlib ./questa_lib/work
  5. vlib ./questa_lib/msim
  6. vlib ./questa_lib/msim/work
  7. # compile system, only need to run once (without IP and src changes)
  8. alias build {
  9. # compile ddr3 simulation model
  10. vlog -mfcu -work work -f filelist.f
  11. vlog -mfcu -work work ../../../src/axi_ddr/imports/wiredly.v
  12. vlog -mfcu -sv -work work ../../../src/axi_ddr/imports/ddr3_model.sv
  13. # compile glbl module
  14. vlog -work work "glbl.v"
  15. # compile user module
  16. vlog -incr -mfcu -work work ../../../src/axi_ddr/*.v
  17. vlog -incr -mfcu -work work DDR_AXI_tb.v
  18. }
  19. alias elab_ddr3 {
  20. vopt +acc=npr -L work -L unisims_ver -L unimacro_ver -L secureip -L xpm -work work work.DDR_AXI_tb work.glbl -o DDR_AXI_tb_opt
  21. vsim -lib work DDR_AXI_tb_opt
  22. set NumericStdNoWarnings 1
  23. set StdArithNoWarnings 1
  24. do {DDR_AXI_tb_wave.do}
  25. view wave
  26. view structure
  27. view signals
  28. }
  29. alias rerun {
  30. elab_ddr3
  31. log -rec /*
  32. run -all
  33. }

 源文件filelist.f

  1. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_ctrl_addr_decode.v
  2. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_ctrl_read.v
  3. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_ctrl_reg.v
  4. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_ctrl_reg_bank.v
  5. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_ctrl_top.v
  6. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_ctrl_write.v
  7. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_mc.v
  8. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_mc_ar_channel.v
  9. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_mc_aw_channel.v
  10. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_mc_b_channel.v
  11. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_mc_cmd_arbiter.v
  12. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_mc_cmd_fsm.v
  13. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_mc_cmd_translator.v
  14. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_mc_fifo.v
  15. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_mc_incr_cmd.v
  16. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_mc_r_channel.v
  17. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_mc_simple_fifo.v
  18. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_mc_wrap_cmd.v
  19. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_mc_wr_cmd_fsm.v
  20. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_axi_mc_w_channel.v
  21. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_ddr_axic_register_slice.v
  22. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_ddr_axi_register_slice.v
  23. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_ddr_axi_upsizer.v
  24. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_ddr_a_upsizer.v
  25. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_ddr_carry_and.v
  26. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_ddr_carry_latch_and.v
  27. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_ddr_carry_latch_or.v
  28. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_ddr_carry_or.v
  29. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_ddr_command_fifo.v
  30. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_ddr_comparator.v
  31. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_ddr_comparator_sel.v
  32. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_ddr_comparator_sel_static.v
  33. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_ddr_r_upsizer.v
  34. ../../../src/axi_ddr/rtl/axi/mig_7series_v4_2_ddr_w_upsizer.v
  35. ../../../src/axi_ddr/rtl/clocking/mig_7series_v4_2_clk_ibuf.v
  36. ../../../src/axi_ddr/rtl/clocking/mig_7series_v4_2_infrastructure.v
  37. ../../../src/axi_ddr/rtl/clocking/mig_7series_v4_2_iodelay_ctrl.v
  38. ../../../src/axi_ddr/rtl/clocking/mig_7series_v4_2_tempmon.v
  39. ../../../src/axi_ddr/rtl/controller/mig_7series_v4_2_arb_mux.v
  40. ../../../src/axi_ddr/rtl/controller/mig_7series_v4_2_arb_row_col.v
  41. ../../../src/axi_ddr/rtl/controller/mig_7series_v4_2_arb_select.v
  42. ../../../src/axi_ddr/rtl/controller/mig_7series_v4_2_bank_cntrl.v
  43. ../../../src/axi_ddr/rtl/controller/mig_7series_v4_2_bank_common.v
  44. ../../../src/axi_ddr/rtl/controller/mig_7series_v4_2_bank_compare.v
  45. ../../../src/axi_ddr/rtl/controller/mig_7series_v4_2_bank_mach.v
  46. ../../../src/axi_ddr/rtl/controller/mig_7series_v4_2_bank_queue.v
  47. ../../../src/axi_ddr/rtl/controller/mig_7series_v4_2_bank_state.v
  48. ../../../src/axi_ddr/rtl/controller/mig_7series_v4_2_col_mach.v
  49. ../../../src/axi_ddr/rtl/controller/mig_7series_v4_2_mc.v
  50. ../../../src/axi_ddr/rtl/controller/mig_7series_v4_2_rank_cntrl.v
  51. ../../../src/axi_ddr/rtl/controller/mig_7series_v4_2_rank_common.v
  52. ../../../src/axi_ddr/rtl/controller/mig_7series_v4_2_rank_mach.v
  53. ../../../src/axi_ddr/rtl/controller/mig_7series_v4_2_round_robin_arb.v
  54. ../../../src/axi_ddr/rtl/ecc/mig_7series_v4_2_ecc_buf.v
  55. ../../../src/axi_ddr/rtl/ecc/mig_7series_v4_2_ecc_dec_fix.v
  56. ../../../src/axi_ddr/rtl/ecc/mig_7series_v4_2_ecc_gen.v
  57. ../../../src/axi_ddr/rtl/ecc/mig_7series_v4_2_ecc_merge_enc.v
  58. ../../../src/axi_ddr/rtl/ecc/mig_7series_v4_2_fi_xor.v
  59. ../../../src/axi_ddr/rtl/ip_top/mig_7series_v4_2_memc_ui_top_axi.v
  60. ../../../src/axi_ddr/rtl/ip_top/mig_7series_v4_2_mem_intfc.v
  61. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_byte_group_io.v
  62. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_byte_lane.v
  63. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_calib_top.v
  64. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_if_post_fifo.v
  65. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_mc_phy.v
  66. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_mc_phy_wrapper.v
  67. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_of_pre_fifo.v
  68. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_4lanes.v
  69. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_ck_addr_cmd_delay.v
  70. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_dqs_found_cal.v
  71. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_dqs_found_cal_hr.v
  72. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_init.v
  73. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_ocd_cntlr.v
  74. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_ocd_data.v
  75. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_ocd_edge.v
  76. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_ocd_lim.v
  77. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_ocd_mux.v
  78. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_ocd_po_cntlr.v
  79. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_ocd_samp.v
  80. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_oclkdelay_cal.v
  81. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_prbs_rdlvl.v
  82. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_rdlvl.v
  83. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_tempmon.v
  84. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_top.v
  85. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_wrcal.v
  86. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_wrlvl.v
  87. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_phy_wrlvl_off_delay.v
  88. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_prbs_gen.v
  89. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_ddr_skip_calib_tap.v
  90. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_poc_cc.v
  91. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_poc_edge_store.v
  92. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_poc_meta.v
  93. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_poc_pd.v
  94. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_poc_tap_base.v
  95. ../../../src/axi_ddr/rtl/phy/mig_7series_v4_2_poc_top.v
  96. ../../../src/axi_ddr/rtl/ui/mig_7series_v4_2_ui_cmd.v
  97. ../../../src/axi_ddr/rtl/ui/mig_7series_v4_2_ui_rd_data.v
  98. ../../../src/axi_ddr/rtl/ui/mig_7series_v4_2_ui_top.v
  99. ../../../src/axi_ddr/rtl/ui/mig_7series_v4_2_ui_wr_data.v
  100. ../../../src/axi_ddr/rtl/ddr3_mig_sim.v
  101. ../../../src/axi_ddr/rtl/ddr3.v

打开questasim执行仿真脚本,结果与vivado联合questasim仿真结果一致

3.1在transcript命令行中cd到脚本文件路径下

3.2 source脚本文件,并执行build编译源文件

3.3 rerun,启动波形仿真

波形界面

4.注意事项

4.1 MEM_BITS

*如果需要仿真的地址空间太大需要修改ddr3_parameters.vh文件中的MEM_BITS,否则会报ERROR: Memory overflow. Write to Address 7000fe with data xxx will be lost You must increase the MEM_BITS parameter of define MAX_MEM.

MEM_BITS定义了ddr3_model.sv中地址位宽,默认为15
    在ddr3_parameters.vh文件中, 根据需要扩充MEM_BITS参数,比如修改至20。

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

闽ICP备14008679号