通过 modelsim 仅转储设计的子部分的 VCD

发布于 2024-11-28 12:17:40 字数 3829 浏览 0 评论 0原文

我有一个大型设计,包括一个测试台、一些测试电路和被测电路本身。 我使用 modelsim 来模拟设计,并且想要转储模拟结果。建议我使用以下命令生成转储:

vcd file myvcd1.vcd
vcd add -r /sim_minimips/*

它似乎可以工作,但我想要的是仅为被测电路生成转储。

我尝试使用相同的命令来指定我希望考虑的文件名:

vcd file myvcd2.vcd
vcd add -r /minimips/*

但生成了以下错误:

Error vsim 3561 No object matching minimips

我不明白该错误,并且我不确定即使这是正确的过程隔离一个子部分。

有谁知道该怎么做或知道我在哪里可以获得有关此值更改转储的简单教程?

我附上我的测试台实体:

library IEEE;
use IEEE.std_logic_1164.all;

library std;
use std.textio.all;

library work;
use work.pack_mips.all;

entity sim_minimips is
end;

architecture bench of sim_minimips is

  component minimips is
  port (
      clock    : in std_logic;
      reset    : in std_logic;

      ram_req  : out std_logic;
      ram_adr  : out bus32;
      ram_r_w  : out std_logic;
      ram_data : inout bus32;
      ram_ack  : in std_logic;

      it_mat   : in std_logic
  );
  end component;


  component ram is
    generic (mem_size : natural := 256;
             latency : time := 10 ns);
    port(
        req        : in std_logic;
        adr        : in bus32;
        data_inout : inout bus32;
        r_w        : in std_logic;
        ready      : out std_logic
  );
  end component;

  component rom is
  generic (mem_size : natural := 256;
           start : natural := 0;
           latency : time := 10 ns);
  port(
          adr : in bus32;
          donnee : out bus32;
          ack : out std_logic;
          load : in std_logic;
          fname : in string
  );
  end component;

  signal clock : std_logic := '0';
  signal reset : std_logic;

  signal it_mat : std_logic := '0';

  -- Connexion with the code memory
  signal load : std_logic;
  signal fichier : string(1 to 7);

  -- Connexion with the Ram
  signal ram_req : std_logic;
  signal ram_adr : bus32;
  signal ram_r_w : std_logic;
  signal ram_data : bus32;
  signal ram_rdy : std_logic;

begin

    U_minimips : minimips port map (
        clock => clock,
        reset => reset,
        ram_req => ram_req,
        ram_adr => ram_adr,
        ram_r_w => ram_r_w,
        ram_data => ram_data,
        ram_ack => ram_rdy,
        it_mat => it_mat
    );

    U_ram : ram port map (
        req => ram_req,
        adr => ram_adr,
        data_inout => ram_data,
        r_w => ram_r_w,
        ready => ram_rdy
    );

    U_rom : rom port map (
        adr => ram_adr,
        donnee => ram_data,
        ack => ram_rdy,
        load => load,
        fname => fichier
    );

    clock <= not clock after 20 ns;
    reset <= '0', '1' after 5 ns, '0' after 70 ns;
    ram_data <= (others => 'L');

    process
        variable command : line;
        variable nomfichier : string(1 to 3);
    begin
        write (output, "Enter the filename : ");
        readline(input, command);
        read(command, nomfichier);

        fichier <= nomfichier & ".bin";

        load <= '1';
        wait;
    end process;

    -- Memory Mapping
    -- 0000 - 00FF      ROM

    process (ram_adr, ram_r_w, ram_data)
    begin -- Emulation of an I/O controller
        ram_data <= (others => 'Z');

        case ram_adr is
            when X"00001000" => -- program an interrupt after 1000ns
                                it_mat <= '1' after 1000 ns;
                                ram_rdy <= '1' after 5 ns;
            when X"00001001" => -- clear interrupt line on cpu
                                it_mat <= '0';
                                ram_data <= X"FFFFFFFF";
                                ram_rdy <= '1' after 5 ns;
            when others      => ram_rdy <= 'L';
        end case;
    end process;

end bench;

干杯, 斯特

I have a big design that includes a test-bench, some testing circuit and the circuit under test itself.
I use modelsim to simulate the design and I want to have a dump of the simulation. I was suggested to generate the dump using the command:

vcd file myvcd1.vcd
vcd add -r /sim_minimips/*

it seams to work but what i would like is to generate the dump only for the circuit under test.

i tried to use the same command in specifying just the name of the file i would like to be taken in consideration:

vcd file myvcd2.vcd
vcd add -r /minimips/*

but the following error was generated:

Error vsim 3561 No object matching minimips

I do not understand the error and i am not sure even if this is the correct procedure to isolate a subpart.

does anyone knows how to do or knows where could i get a decent simply tutorial about this Value Change Dump?

I attach my test bench entity:

library IEEE;
use IEEE.std_logic_1164.all;

library std;
use std.textio.all;

library work;
use work.pack_mips.all;

entity sim_minimips is
end;

architecture bench of sim_minimips is

  component minimips is
  port (
      clock    : in std_logic;
      reset    : in std_logic;

      ram_req  : out std_logic;
      ram_adr  : out bus32;
      ram_r_w  : out std_logic;
      ram_data : inout bus32;
      ram_ack  : in std_logic;

      it_mat   : in std_logic
  );
  end component;


  component ram is
    generic (mem_size : natural := 256;
             latency : time := 10 ns);
    port(
        req        : in std_logic;
        adr        : in bus32;
        data_inout : inout bus32;
        r_w        : in std_logic;
        ready      : out std_logic
  );
  end component;

  component rom is
  generic (mem_size : natural := 256;
           start : natural := 0;
           latency : time := 10 ns);
  port(
          adr : in bus32;
          donnee : out bus32;
          ack : out std_logic;
          load : in std_logic;
          fname : in string
  );
  end component;

  signal clock : std_logic := '0';
  signal reset : std_logic;

  signal it_mat : std_logic := '0';

  -- Connexion with the code memory
  signal load : std_logic;
  signal fichier : string(1 to 7);

  -- Connexion with the Ram
  signal ram_req : std_logic;
  signal ram_adr : bus32;
  signal ram_r_w : std_logic;
  signal ram_data : bus32;
  signal ram_rdy : std_logic;

begin

    U_minimips : minimips port map (
        clock => clock,
        reset => reset,
        ram_req => ram_req,
        ram_adr => ram_adr,
        ram_r_w => ram_r_w,
        ram_data => ram_data,
        ram_ack => ram_rdy,
        it_mat => it_mat
    );

    U_ram : ram port map (
        req => ram_req,
        adr => ram_adr,
        data_inout => ram_data,
        r_w => ram_r_w,
        ready => ram_rdy
    );

    U_rom : rom port map (
        adr => ram_adr,
        donnee => ram_data,
        ack => ram_rdy,
        load => load,
        fname => fichier
    );

    clock <= not clock after 20 ns;
    reset <= '0', '1' after 5 ns, '0' after 70 ns;
    ram_data <= (others => 'L');

    process
        variable command : line;
        variable nomfichier : string(1 to 3);
    begin
        write (output, "Enter the filename : ");
        readline(input, command);
        read(command, nomfichier);

        fichier <= nomfichier & ".bin";

        load <= '1';
        wait;
    end process;

    -- Memory Mapping
    -- 0000 - 00FF      ROM

    process (ram_adr, ram_r_w, ram_data)
    begin -- Emulation of an I/O controller
        ram_data <= (others => 'Z');

        case ram_adr is
            when X"00001000" => -- program an interrupt after 1000ns
                                it_mat <= '1' after 1000 ns;
                                ram_rdy <= '1' after 5 ns;
            when X"00001001" => -- clear interrupt line on cpu
                                it_mat <= '0';
                                ram_data <= X"FFFFFFFF";
                                ram_rdy <= '1' after 5 ns;
            when others      => ram_rdy <= 'L';
        end case;
    end process;

end bench;

Cheers,
Ste

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笑梦风尘 2024-12-05 12:17:40

vcd add 的最后一个参数是要添加的信号的设计层次结构路径(使用实例名称)(*表示所有信号,尽管使用 -r 信号,它也会扩展到您指定的层次结构下方的所有设计级别)。

因此,如果您的 minimips 使用实例名称 i_minimipssim_minimips 中实例化,则在(该特定)中添加所有信号的正确方法>minimips 及其可能实例化的任何块是

vcd add -r /sim_minimips/i_minimips/*

如果您想进一步限制添加到 VCD 的项目,您可以添加一个或多个参数 -in-inout-out-internal-ports,仅选择这些类型的项目。或者省略 -r 以不下降到层次结构中 - 常见用法是 vcd add -ports /sim_minimips/minimips/* ,它将仅添加设计顶层,适合为多种类型的测试台生成激励。

应该注意的是,vcd add 的工作原理与 wave add 类似,即对象规范的格式完全相同。因此,通常将项目添加到 VCD 的最简单方法是将它们添加到 Modelsim UI 中的 Wave,从脚本中复制粘贴命令,然后简单地将 wave add 更改为 vcd 添加

此外,文件名在这里并不重要,只有设计本身的结构。例如,如果您有类似的内容:

entity sim_minimips is
    port (
        -- ...
    );
end sim_minimips;

entity minimips is
    port (
        -- ...
    );
end minimips;

architecture tb of sim_minimips is
    component minimips
        port (
            -- ...
        );
    end component;
begin
    I_MINIMIPS: minimips
        port map (
            -- ...
        );
end architecture tb;

在本例中,minimips 实例的路径为 /sim_minimips/I_MINIMIPS/

The last parameter for vcd add is the design hierarchy path (using instance names) of the signal(s) you want to add (the * means all signals, though with the -r signal it also expands to all levels of the design below the hierarchy you've specified).

Thus, if your minimips is instantiated within sim_minimips using the instance name i_minimips, the correct way to add all signals in (that particular) minimips and any blocks it might instantiate is

vcd add -r /sim_minimips/i_minimips/*

If you want to restrict the items to add to the VCD a bit further, you could add one or more of the parameters -in, -inout, -out, -internal or -ports, which select only items of these types. Or leave out the -r to not descend into the hierarchy -- a common usage is vcd add -ports /sim_minimips/minimips/* which will add only the ports of the design top level, suitable for generating stimulus for many types of test benches.

It should be noted that vcd add works "just" like wave add, i.e. the object specification is in exactly the same format. Thus, often the simplest way to add items to a VCD is to add them to a wave in the Modelsim UI, copy-pasting the command from the transcript, and simply changing the wave add to a vcd add.

Also, file names are of no consequence here, only the structure of the design itself. For example, if you have something like:

entity sim_minimips is
    port (
        -- ...
    );
end sim_minimips;

entity minimips is
    port (
        -- ...
    );
end minimips;

architecture tb of sim_minimips is
    component minimips
        port (
            -- ...
        );
    end component;
begin
    I_MINIMIPS: minimips
        port map (
            -- ...
        );
end architecture tb;

In this case, the path to your minimips instance is /sim_minimips/I_MINIMIPS/.

清醇 2024-12-05 12:17:40

这个问题的答案已经在上一篇文章中给出了。下面给出了在 Modelsim 中生成 VCD 文件的替代方法,该方法将被 Synopsys 的 Tetramax ATPG 工具接受

# Simulate the design
vsim -novopt work.mips_tb

# Create the VCD file
vcd dumpports -file mips.vcd /mips_tb/tb/*

我的测试平台(供参考)

module mips_tb;
mips_core tb
        (
            clk,rst,cop_dout,
            din,  ins_i,iack_o,cop_addr_o,
            cop_data_o,cop_mem_ctl_o,  addr_o,
            dout,  pc_o,  wr_en_o
        );
...

The answer to the question is already given in the previous post. Given below is an alternative method to generate the VCD file in Modelsim which will be accepted by Tetramax ATPG tool by Synopsys

# Simulate the design
vsim -novopt work.mips_tb

# Create the VCD file
vcd dumpports -file mips.vcd /mips_tb/tb/*

My testbench (for reference)

module mips_tb;
mips_core tb
        (
            clk,rst,cop_dout,
            din,  ins_i,iack_o,cop_addr_o,
            cop_data_o,cop_mem_ctl_o,  addr_o,
            dout,  pc_o,  wr_en_o
        );
...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文