【问题标题】:Instantiating a Verilog Module inside of a VHDL architecture with Modelsim SE使用 Modelsim SE 在 VHDL 架构中实例化 Verilog 模块
【发布时间】:2020-05-12 15:00:23
【问题描述】:

我正在尝试编译一个 VHDL 内核,该内核内部实例化了一个 verilog 内核。 不幸的是,我不允许修改任何代码,因为它们在其他人的库中。

VHDL 文件之前是在库“wildcores”中编译的,而verilog 文件是在库“work”中编译的。

出现问题是因为 Modelsim 在不同库中编译 VHDL 源文件时不知道自动搜索工作库。 (请参阅下面的错误。)

有没有办法通过在modelsim SE编译命令中添加标志而不修改任何代码来解决这个问题?

文件:core2.v

`timescale 1ns/10ps

module core2(
    input  wire A,
    output wire Z
);

   assign Z = A;

endmodule

文件:core1.vhd

Library IEEE;
use IEEE.std_logic_1164.all;

library wildcores;

entity core1 is 
   port(
       A : in  std_logic;
       Z : out std_logic
   );
end entity;

architecture rtl of core1 is
begin
   core2_inst: core2 
        port map(
            A => A,
            Z => Z
        );

end architecture;

文件:run.sh

#!/bin/bash
# Modelsim SE Compile Script:

set -o verbose

vlib wildcores

vlog -work work core2.v || exit 1

vcom -work vhdlcores core1.vhd || exit 1

vopt core1 -o sim || exit 1

vsim sim

输出:

$ ./run.sh

vlib wildcores
** Warning: (vlib-34) Library already exists at "wildcores".

vlog -work work core2.v
Model Technology ModelSim SE-64 vlog 10.7a Compiler 2018.03 Mar 27 2018
Start time: 10:49:17 on May 12,2020
vlog -work work core2.v
-- Compiling module core2

Top level modules:
        core2
End time: 10:49:18 on May 12,2020, Elapsed time: 0:00:01
Errors: 0, Warnings: 0

vcom -work vhdlcores core1.vhd || exit 1
Model Technology ModelSim SE-64 vcom 10.7a Compiler 2018.03 Mar 27 2018
Start time: 10:49:18 on May 12,2020
vcom -work vhdlcores core1.vhd
-- Loading package STANDARD
-- Loading package TEXTIO
-- Loading package std_logic_1164
-- Compiling entity core1
-- Compiling architecture rtl of core1
** Error (suppressible): core1.vhd(16): (vcom-1141) Identifier "core2" does not identify a component declaration.
** Note: core1.vhd(22): VHDL Compiler exiting
End time: 10:49:18 on May 12,2020, Elapsed time: 0:00:00
Errors: 1, Warnings: 0

【问题讨论】:

  • Verilog 对库一无所知。此外,工作本身并不是一个图书馆——它是工作图书馆。最后 - VHDL 没有 verilog 的可见性。因此,您需要用 VHDL 为您的 Verilog 编写一个组件:并让详细说明将该组件映射到 Verilog 模块。
  • 我将 Verilog 编译到与 VHDL 相同的库中,这似乎可以工作......

标签: vhdl verilog modelsim


【解决方案1】:
#!/bin/bash
# Modelsim SE Compile Script:

set -o verbose

vlib work
vlib wildcores

# I think, this is the line that fixes it..
vmap wildcores work

vlog -work work core2.v || exit 1

vcom -work vhdlcores core1.vhd || exit 1

vopt core1 -o sim || exit 1

vsim -c -t '1fs' sim

【讨论】:

  • 这是对您原来问题的回答还是补充?
  • 它的答案.... modelsim "vmap" 命令的目的是添加一个替代库(vmap 的第二个参数)来搜索是否在主库中找不到该单元(第一个vmap 的参数)。所以基本上你需要把你的verilog放在一个不同的库中,然后告诉你的vhdl库在逻辑上将自己加入verilog库......它首先搜索vhdl库,然后搜索逻辑链接到它的verilog库与vmap .例如,您可以将您的 verilog 编译成库“vlog -work vercores”...然后是“vmap vhdlcores vercores”..
猜你喜欢
  • 1970-01-01
  • 2023-03-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多