I'm trying to compile a VHDL core that has a verilog core instantiated inside of it. Unfortunately, I'm not allowed to modify any of the code because they are in somebody else's library.
The VHDL file was previously compiled inside of library "wildcores", and the verilog file was compiled inside of library "work".
The problem occurs because Modelsim doesn't know to automatically search the work library when compiling a VHDL source file in a different library. (See Error below.)
Is there a way to fix this problem by adding flags to the modelsim SE compile command without modifying any of the code?
FILE: core2.v
`timescale 1ns/10ps
module core2(
input wire A,
output wire Z
);
assign Z = A;
endmodule
FILE: 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;
FILE: 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
output:
$ ./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