【发布时间】: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 相同的库中,这似乎可以工作......