I have been reading a few papers and the questa manual for data type mapping between VHDL and systemverilog.
Currently i am wanting to map a custom VHDL record into systemverilog interface. I have created a systemverilog struct with the same elements as the vhdl record and i have instantiated this struct in the interface.
The connection at the top level is as normal, however i end up with a questa errror
** Fatal: (vsim-3362) The type of VHDL port 'reg_fld_out' is invalid for Verilog connection (35th connection).
# Time: 0 ps Iteration: 0 Instance: /top/dut_wrapper File: /top/block_A_dut_wrapper.vhd Line: 97
Verror states
Message # 3362:
The type of VHDL port is either not compatible with the type of Verilog
connection or is not currently supported at the VHDL-SystemVerilog mixed
language boundary. Please refer to QuestaSim User's Manual for a list of
supported types.
I have compiled the vhdl with -mixedsvh option, and my struct and record content types match. Does anyone have any ideas on why this isn’t working for me?
The purpose of using the ‘-mixedsvvh’ option is to generate a SystemVerilog package that is equivalent to the VHDL package so you don’t have to worry about creating your own SV package and trying to map the data types correctly.
Have you tried importing the VHDL package name in your SV code? The use mode varies somewhat based on what you are trying to accomplish, but Questasim provides some examples for this.
I have a separate compile process for the vhdl and the systemverilog. The vhdl is compiled into a different library and vmapped before vsim.
So if i import the vhdl package, the compiler will complain because it has no visibility of its contents.
Can i forward declare the package? I have seen this down with classes and types, but not packages.
I have not seen any questa examples - do you have a specific one in mind?
You cannot forward declare packages - a fundamental principle of a package (VHDL or SystemVerilog) is that it must be compiled before it can be referenced.
You can compile your VHDL first, and then reference the library it was compiled into using the vlog -L switch.
I have seen the examples and it does seem very trivial. They are both compiled into the same work lib, but the vlog -L flag gets around this.
So i am still a little puzzled that i still have errors here.
Just to confirm my vcom and vlog commands and the resultant error.
I have imported the vhdl package into my interface, but i am still unable to use the VHDL record types. The vlog compilation error is still related to visibility.
** Error: ** while parsing file included at …/tb/top/registerHW_if/registerHW_pkg.sv(19)
** at …/tb/top/registerHW_if/registerHW_if.sv(49): (vlog-2143) Unable to find ‘register_outputs’ in scope registerHW_if.
** Error: ** while parsing file included at …/tb/top/registerHW_if/registerHW_pkg.sv(19)
** at …/tb/top/registerHW_if/registerHW_if.sv(50): (vlog-2143) Unable to find ‘register_inputs’ in scope registerHW_if.
This is my debug flow, so for the time being, the DUT will always be compiled without an optimization step. I also use questas run manager, where optimization is enabled. This hopefully addresses the +acc option as well. The vopt in the run manager scripts have both these options.
Since i am passing file lists to vlog, i assumed i needed -mfcu? However i guess if i am not spreading declarations across different files i probably dont need this?
How will questa know what version of UVM to use if i don’t tell it?
When a VHDL package is used for SV, all the identifiers are converted to lower case. This is done to prevent any upper/lower case conflicts. If you change reg_field_inT and reg_field_outT to reg_field_int and reg_field_outt, everything should compile successfully.
I was using Questa 10.1 and importing VHDL record without issue.
We recently moved to 10.3a and ran into some problems with this. If we use vopt +acc options-- everything is fine. If we shut off optimization with the -novopt switch, the simulator complains it cannot the *_sv_unit package file.