[原创]Modelsim后仿真

因调试需要,进行后仿真,ISE生成的sim文件和sdf文件

`timescale 1 ns/1 ps

module lut_dly (
  clkout, fpga_clk, config_in
);
  output clkout;
  input fpga_clk;
  input [5 : 0] config_in;
  wire clk_in;
  wire dly1;
  wire config_in_4_IBUF_49;
  wire config_in_5_IBUF_50;
  wire dly2_0;
  wire dly3;
  wire config_in_2_IBUF_53;
  wire config_in_3_IBUF_54;
  wire dly4_0;
  wire dly5;
  wire config_in_0_IBUF_57;
  wire config_in_1_IBUF_58;
  wire dly2;
  wire dly1_pack_1;
  wire dly4;
  wire dly3_pack_1;
  wire clkout_OBUF_129;
  wire dly5_pack_1;
  wire \config_in<0>/INBUF ;
  wire \config_in<1>/INBUF ;
  wire \config_in<2>/INBUF ;
  wire \config_in<3>/INBUF ;
  wire \config_in<4>/INBUF ;
  wire \config_in<5>/INBUF ;
  wire \clkout/O ;
  wire \fpga_clk/INBUF ;
  wire VCC;
  initial $sdf_annotate("lut_dly_timesim.sdf");
  X_BUF #(
    .LOC ( "SLICE_X88Y0" ))
  \dly2/XUSED  (
    .I(dly2),
    .O(dly2_0)
  );
  X_BUF #(
    .LOC ( "SLICE_X88Y0" ))
  \dly2/YUSED  (
    .I(dly1_pack_1),
    .O(dly1)
  );
  X_LUT4 #(
    .INIT ( 16‘h8888 ),
    .LOC ( "SLICE_X88Y0" ))
  u_lut6 (
    .ADR0(clk_in),
    .ADR1(config_in_5_IBUF_50),
    .ADR2(VCC),
    .ADR3(VCC),
    .O(dly1_pack_1)
  );
  X_BUF #(
    .LOC ( "SLICE_X88Y1" ))
  \dly4/XUSED  (
    .I(dly4),
    .O(dly4_0)
  );
  X_BUF #(
    .LOC ( "SLICE_X88Y1" ))
  \dly4/YUSED  (
    .I(dly3_pack_1),
    .O(dly3)
  );
  X_LUT4 #(
    .INIT ( 16‘h3C0C ),
    .LOC ( "SLICE_X88Y1" ))
  u_lut4 (
    .ADR0(VCC),
    .ADR1(dly2_0),
    .ADR2(config_in_3_IBUF_54),
    .ADR3(clk_in),
    .O(dly3_pack_1)
  );
  X_BUF #(
    .LOC ( "SLICE_X89Y0" ))
  \clkout_OBUF/YUSED  (
    .I(dly5_pack_1),
    .O(dly5)
  );
  X_LUT4 #(
    .INIT ( 16‘h3838 ),
    .LOC ( "SLICE_X89Y0" ))
  u_lut2 (
    .ADR0(clk_in),
    .ADR1(config_in_1_IBUF_58),
    .ADR2(dly4_0),
    .ADR3(VCC),
    .O(dly5_pack_1)
  );
  X_IPAD #(
    .LOC ( "PAD685" ))
  \config_in<0>/PAD  (
    .PAD(config_in[0])
  );
  X_BUF #(
    .LOC ( "PAD685" ))
  config_in_0_IBUF (
    .I(config_in[0]),
    .O(\config_in<0>/INBUF )
  );
  X_BUF #(
    .LOC ( "PAD685" ))
  \config_in<0>/IFF/IMUX  (
    .I(\config_in<0>/INBUF ),
    .O(config_in_0_IBUF_57)
  );
  X_IPAD #(
    .LOC ( "PAD686" ))
  \config_in<1>/PAD  (
    .PAD(config_in[1])
  );
  X_BUF #(
    .LOC ( "PAD686" ))
  config_in_1_IBUF (
    .I(config_in[1]),
    .O(\config_in<1>/INBUF )
  );
  X_BUF #(
    .LOC ( "PAD686" ))
  \config_in<1>/IFF/IMUX  (
    .I(\config_in<1>/INBUF ),
    .O(config_in_1_IBUF_58)
  );
  X_IPAD #(
    .LOC ( "PAD683" ))
  \config_in<2>/PAD  (
    .PAD(config_in[2])
  );
  X_BUF #(
    .LOC ( "PAD683" ))
  config_in_2_IBUF (
    .I(config_in[2]),
    .O(\config_in<2>/INBUF )
  );
  X_BUF #(
    .LOC ( "PAD683" ))
  \config_in<2>/IFF/IMUX  (
    .I(\config_in<2>/INBUF ),
    .O(config_in_2_IBUF_53)
  );
  X_IPAD #(
    .LOC ( "PAD681" ))
  \config_in<3>/PAD  (
    .PAD(config_in[3])
  );
  X_BUF #(
    .LOC ( "PAD681" ))
  config_in_3_IBUF (
    .I(config_in[3]),
    .O(\config_in<3>/INBUF )
  );
  X_BUF #(
    .LOC ( "PAD681" ))
  \config_in<3>/IFF/IMUX  (
    .I(\config_in<3>/INBUF ),
    .O(config_in_3_IBUF_54)
  );
  X_IPAD #(
    .LOC ( "PAD688" ))
  \config_in<4>/PAD  (
    .PAD(config_in[4])
  );
  X_BUF #(
    .LOC ( "PAD688" ))
  config_in_4_IBUF (
    .I(config_in[4]),
    .O(\config_in<4>/INBUF )
  );
  X_BUF #(
    .LOC ( "PAD688" ))
  \config_in<4>/IFF/IMUX  (
    .I(\config_in<4>/INBUF ),
    .O(config_in_4_IBUF_49)
  );
  X_IPAD #(
    .LOC ( "PAD682" ))
  \config_in<5>/PAD  (
    .PAD(config_in[5])
  );
  X_BUF #(
    .LOC ( "PAD682" ))
  config_in_5_IBUF (
    .I(config_in[5]),
    .O(\config_in<5>/INBUF )
  );
  X_BUF #(
    .LOC ( "PAD682" ))
  \config_in<5>/IFF/IMUX  (
    .I(\config_in<5>/INBUF ),
    .O(config_in_5_IBUF_50)
  );
  X_OPAD #(
    .LOC ( "PAD680" ))
  \clkout/PAD  (
    .PAD(clkout)
  );
  X_OBUF #(
    .LOC ( "PAD680" ))
  clkout_OBUF (
    .I(\clkout/O ),
    .O(clkout)
  );
  X_IPAD #(
    .LOC ( "PAD684" ))
  \fpga_clk/PAD  (
    .PAD(fpga_clk)
  );
  X_BUF #(
    .LOC ( "PAD684" ))
  u_ibufg (
    .I(fpga_clk),
    .O(\fpga_clk/INBUF )
  );
  X_BUF #(
    .LOC ( "PAD684" ))
  \fpga_clk/IFF/IMUX  (
    .I(\fpga_clk/INBUF ),
    .O(clk_in)
  );
  X_LUT4 #(
    .INIT ( 16‘h0FA0 ),
    .LOC ( "SLICE_X88Y0" ))
  u_lut5 (
    .ADR0(clk_in),
    .ADR1(VCC),
    .ADR2(config_in_4_IBUF_49),
    .ADR3(dly1),
    .O(dly2)
  );
  X_LUT4 #(
    .INIT ( 16‘h3C30 ),
    .LOC ( "SLICE_X88Y1" ))
  u_lut3 (
    .ADR0(VCC),
    .ADR1(config_in_2_IBUF_53),
    .ADR2(dly3),
    .ADR3(clk_in),
    .O(dly4)
  );
  X_LUT4 #(
    .INIT ( 16‘h0AF0 ),
    .LOC ( "SLICE_X89Y0" ))
  u_lut1 (
    .ADR0(clk_in),
    .ADR1(VCC),
    .ADR2(dly5),
    .ADR3(config_in_0_IBUF_57),
    .O(clkout_OBUF_129)
  );
  X_BUF #(
    .LOC ( "PAD680" ))
  \clkout/OUTPUT/OFF/OMUX  (
    .I(clkout_OBUF_129),
    .O(\clkout/O )
  );
  X_ONE   NlwBlock_lut_dly_VCC (
    .O(VCC)
  );
endmodule

`timescale  1 ps / 1 ps

module glbl ();

    parameter ROC_WIDTH = 100000;
    parameter TOC_WIDTH = 0;

    wire GSR;
    wire GTS;
    wire PRLD;

    reg GSR_int;
    reg GTS_int;
    reg PRLD_int;

//--------   JTAG Globals --------------
    wire JTAG_TDO_GLBL;
    wire JTAG_TCK_GLBL;
    wire JTAG_TDI_GLBL;
    wire JTAG_TMS_GLBL;
    wire JTAG_TRST_GLBL;

    reg JTAG_CAPTURE_GLBL;
    reg JTAG_RESET_GLBL;
    reg JTAG_SHIFT_GLBL;
    reg JTAG_UPDATE_GLBL;

    reg JTAG_SEL1_GLBL = 0;
    reg JTAG_SEL2_GLBL = 0 ;
    reg JTAG_SEL3_GLBL = 0;
    reg JTAG_SEL4_GLBL = 0;

    reg JTAG_USER_TDO1_GLBL = 1‘bz;
    reg JTAG_USER_TDO2_GLBL = 1‘bz;
    reg JTAG_USER_TDO3_GLBL = 1‘bz;
    reg JTAG_USER_TDO4_GLBL = 1‘bz;

    assign (weak1, weak0) GSR = GSR_int;
    assign (weak1, weak0) GTS = GTS_int;
    assign (weak1, weak0) PRLD = PRLD_int;

    initial begin
    GSR_int = 1‘b1;
    PRLD_int = 1‘b1;
    #(ROC_WIDTH)
    GSR_int = 1‘b0;
    PRLD_int = 1‘b0;
    end

    initial begin
    GTS_int = 1‘b1;
    #(TOC_WIDTH)
    GTS_int = 1‘b0;
    end

endmodule

SDF文件

(DELAYFILE
  (SDFVERSION "3.0")
  (DESIGN "lut_dly")
  (DATE "Sun Mar 22 15:04:04 2015")
  (VENDOR "Xilinx")
  (PROGRAM "Xilinx SDF Writer")
  (VERSION "K.31")
  (DIVIDER /)
  (VOLTAGE 1.425)
  (TEMPERATURE 85)
  (TIMESCALE 1 ps)
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE dly2\/XUSED)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 111 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE dly2\/YUSED)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 111 ))
        )
      )
  )
  (CELL (CELLTYPE "X_LUT4")
    (INSTANCE u_lut6)
      (DELAY
        (ABSOLUTE
          (PORT ADR0 ( 676 ))
          (PORT ADR1 ( 593 ))
          (IOPATH ADR0 O ( 236 ))
          (IOPATH ADR1 O ( 236 ))
          (IOPATH ADR2 O ( 236 ))
          (IOPATH ADR3 O ( 236 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE dly4\/XUSED)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 111 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE dly4\/YUSED)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 111 ))
        )
      )
  )
  (CELL (CELLTYPE "X_LUT4")
    (INSTANCE u_lut4)
      (DELAY
        (ABSOLUTE
          (PORT ADR1 ( 367 ))
          (PORT ADR2 ( 454 ))
          (PORT ADR3 ( 483 ))
          (IOPATH ADR0 O ( 236 ))
          (IOPATH ADR1 O ( 236 ))
          (IOPATH ADR2 O ( 236 ))
          (IOPATH ADR3 O ( 236 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE clkout_OBUF\/YUSED)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 111 ))
        )
      )
  )
  (CELL (CELLTYPE "X_LUT4")
    (INSTANCE u_lut2)
      (DELAY
        (ABSOLUTE
          (PORT ADR0 ( 676 ))
          (PORT ADR1 ( 409 ))
          (PORT ADR2 ( 4 ))
          (IOPATH ADR0 O ( 236 ))
          (IOPATH ADR1 O ( 236 ))
          (IOPATH ADR2 O ( 236 ))
          (IOPATH ADR3 O ( 236 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE config_in_0_IBUF)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 71 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE config_in\<0\>\/IFF\/IMUX)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 501 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE config_in_1_IBUF)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 73 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE config_in\<1\>\/IFF\/IMUX)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 501 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE config_in_2_IBUF)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 75 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE config_in\<2\>\/IFF\/IMUX)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 501 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE config_in_3_IBUF)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 52 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE config_in\<3\>\/IFF\/IMUX)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 501 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE config_in_4_IBUF)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 54 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE config_in\<4\>\/IFF\/IMUX)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 501 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE config_in_5_IBUF)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 51 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE config_in\<5\>\/IFF\/IMUX)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 501 ))
        )
      )
  )
  (CELL (CELLTYPE "X_OBUF")
    (INSTANCE clkout_OBUF)
      (DELAY
        (ABSOLUTE
          (IOPATH I O ( 3308 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE u_ibufg)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 71 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE fpga_clk\/IFF\/IMUX)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 501 ))
        )
      )
  )
  (CELL (CELLTYPE "X_LUT4")
    (INSTANCE u_lut5)
      (DELAY
        (ABSOLUTE
          (PORT ADR0 ( 647 ))
          (PORT ADR2 ( 540 ))
          (PORT ADR3 ( 2 ))
          (IOPATH ADR0 O ( 236 ))
          (IOPATH ADR1 O ( 236 ))
          (IOPATH ADR2 O ( 236 ))
          (IOPATH ADR3 O ( 236 ))
        )
      )
  )
  (CELL (CELLTYPE "X_LUT4")
    (INSTANCE u_lut3)
      (DELAY
        (ABSOLUTE
          (PORT ADR1 ( 616 ))
          (PORT ADR2 ( 28 ))
          (PORT ADR3 ( 452 ))
          (IOPATH ADR0 O ( 236 ))
          (IOPATH ADR1 O ( 236 ))
          (IOPATH ADR2 O ( 236 ))
          (IOPATH ADR3 O ( 236 ))
        )
      )
  )
  (CELL (CELLTYPE "X_LUT4")
    (INSTANCE u_lut1)
      (DELAY
        (ABSOLUTE
          (PORT ADR0 ( 647 ))
          (PORT ADR2 ( 28 ))
          (PORT ADR3 ( 511 ))
          (IOPATH ADR0 O ( 236 ))
          (IOPATH ADR1 O ( 236 ))
          (IOPATH ADR2 O ( 236 ))
          (IOPATH ADR3 O ( 236 ))
        )
      )
  )
  (CELL (CELLTYPE "X_BUF")
    (INSTANCE clkout\/OUTPUT\/OFF\/OMUX)
      (DELAY
        (PATHPULSE (605))
        (ABSOLUTE
          (IOPATH I O ( 853 ))
        )
      )
  )
)

顶层仿真文件

`timescale 1ns / 1ps
module tb_dly;
reg clk_in;
reg [5:0] sel_in;
wire clk_out;
lut_dly uut(
               .fpga_clk (clk_in ),
               .config_in (sel_in ),
               .clkout(clk_out)
                  );

initial
begin
    clk_in =0;

    #1000
    sel_in = 6‘d32;
    #1000
    sel_in = 6‘d16;
    #1000
    sel_in = 6‘d8;
    #1000
    sel_in = 6‘d4;
    #1000
    sel_in = 6‘d2;
    #1000
    sel_in = 6‘d1;         

end

always #(5/2)  clk_in <= ~clk_in;
endmodule

do文件

vlib work
vlog +acc tb_dly.v

vlog +acc lut_dly_timesim.v
vlog +acc C:/Xilinx/ISE/verilog/src/glbl.v
vsim -novopt -t 1ps -L UNISIMS_VER -L UNIMACRO_VER -L UNI9000_VER -L SIMPRIMS_VER -L XILINXCORELIB_VER -L SECUREIP -L AIM_VER -L CPLD_VER -L UNISIM -L UNIMACRO -L SIMPRIM -L XILINXCORELIB -L AIM -L PLS -L CPLD -lib work tb_dly glbl
log -r /*

Modelsim仿真波形如下

原文地址:https://www.cnblogs.com/ifpga/p/10142198.html

时间: 2024-10-28 18:14:00

[原创]Modelsim后仿真的相关文章

搭建Modelsim SE仿真环境-适应do文件仿真

本章我们介绍仿真环境搭建是基于Modelsim SE的.Modelsim有很多版本,比如说Modelsim-Altera,但是笔者还是建议大家使用Modelsim-SE,Modelsim-Altera实际是针对Altera 的OEM版本,它事先将Altera的一些IP核仿真库添加到了工具中,但功能上有一些缩减.而Modelsim-SE需要自己手动添加这些仿真库,但是功能更全,而且工作中,工程师更倾向用SE版本,因为今后的FPGA开发中我们会接触更多其他厂商的FPGA,比如Xilinx.Latti

ISE和Modelsim联合仿真(转)

ISE和Modelsim联合仿真(转) 地址:http://www.cnblogs.com/feitian629/archive/2013/07/13/3188192.html 相信很多人会遇到过这个问题,不知如何让ISE调用Modelsim进行仿真.我也迷糊了不少时间,查查找找,终于弄明白了,所以有了本文,和大家分享一下.我尽量讲得详细点儿,多多上图. 我的环境:Windows 7 64位,Xilinx ISE Design Suite 13.4(D:\Xilinx\13.4),Modelsi

【转】Quartus II调用modelsim无缝仿真

Quartus II调用modelsim无缝仿真 ★emouse 思·睿博客文章★ 原创文章转载请注明:http://emouse.cnblogs.com 本篇文章为转载,写的不错,最近在学modelsim仿真,网上的教程很乱,把自己认为不错的整理贴出来,后面有机会会写个详细点的. Quartus 中调用modelsim的流程 1. 设定仿真工具 assignmentèsettingèEDA tool settingèsimulation 选择你需要的工具.  2. 自动产生测试激励文件模板: 

后仿真

---我们就不用modulesim自己来写run.do 文件了,因为有点麻烦. ---我们可以直接用Quartus来运行后仿真. .vo 网标,映射到硬件电路,与sdo对应 .sdo 延时文件,布线 管脚延迟 125C_slow.vo 在高温下的低速---跟严格的仿真才会用到,推测建立时间是否可以 -40C_fast.vo 在低温高速下---验证保持时间

关于后仿真的一些探讨

用syonpsys工具试着研究了一下,也把自己的感悟分享出来,欢迎指正:   综合用的dc,后仿真用的vcs:   对于非展平的网表:        1. 子模块内部的触发器类型,比如时序逻辑reg[7:0] temp;非展平之后,必然存在与之对应的wire[7:0] temp数据类型,并且命名完全相同,连接std cell的连线:        2. 子模块内部定义的wire类型,全部被工具定义的std cell 线网取代,找不到相同线网的命名:        3. 模块间的wire数据类型,

[原创][FPGA]Quartus中调用Modelsim波形仿真步骤说明

1     建立Quartus和Modelsim的连接 如果是首次使用,需建立连接.Tools->Options->EDA Tools Option,在Modelsim-Altera处选择应用软件路径.比如“D:\altera\13.0\modelsim_ae\win32aloem”这种. 2.     建立测试文件 Processing->Start->Start Test Bench Template Writer,建立好之后自行进行编写测试文件.13.0版本的vt测试文件在.

[Xilinx]Modelsim独立仿真Vivado生成的PLL核

EDA Tools: 1.Vivado 2015.1(64-bit) 2.Modelsim SE-64 10.1c Time: 2016.05.26 ----------------------------------------------------------------------------------- 喜欢使用Modelsim工具独立进行代码的仿真.也不是Vivado自带的不好(至少目前的小代码没啥影响) 只是在一个vivado工程进行仿真时,添加文件的功能没用太明白,好烦! --

modelsim保存仿真波形

一.保存为.wlf文件 1.完成仿真波形: 2.切换到sim视窗: 3.点击保存图标保存: 4.打开:file菜单打开.wlf文件,选中窗口中的信号右击,add to wave...即可. 二.保存为.do文件 1.保存 file->save format->xxx.do,当然可以自定义路径及文件名: 2.加载 在sim视窗下,file->load: 3..do文件记录了仿真过程命令.

关于modelsim时序仿真的几篇文章

1.http://wenku.baidu.com/view/386597f37c1cfad6195fa797.html 2.http://wenku.baidu.com/view/4b9521f9f705cc175527094f.html?re=view 3.http://wenku.baidu.com/link?url=idbSvNzz2fLSl1WXiEmtIL1amhQTHmtqqQ6g1cp-oU1X3W4wF2Wdu5LSe745rwjCrM-btR44-we9zLCyMf2ofjjA