4

I've done research on this, but the examples that I've found on other web pages have broken links. I'm looking for an example of how to import a custom VHDL record that is contained in a package into a SystemVerilog Testbench.

I'm using modelsim, so I've read that I need to use the -mixedsvvh switch. Do I need to use this switch for both vcom and vlog calls? Also, there's another switch [b | s | v] which when I use s it gives me an error:

** Error: (vcom-1276) Option '-mixedsvvh' was given with a bad argument.

When I use no arguments, I try to run vsim and I get the following message:

-- Importing package c:/Projects/source/work.test_pkg__mti__sv__equiv__implct__pack ** Error: Test_Top_TB.sv(4): 't_Test' is an unknown type.

VHDL Package:

library ieee;
use ieee.std_logic_1164.all;
package test_pkg is
  type t_Test is record
    DATA1 : std_logic_vector(15 downto 0);
    DV1   : std_logic;
    DATA2 : std_logic_vector(5 downto 0);
    DV2   : std_logic;
  end record t_Test;
end package test_pkg;

VHDL Entity/Architecture:

library ieee;
use ieee.std_logic_1164.all;

library work;
use work.test_pkg.all;

entity Test_Top is
  port (
    i_Clk  : in  std_logic;
    i_Data : in  t_Test;
    o_Data : out t_Test
    );
end entity Test_Top;

architecture RTL of Test_Top is
begin
  process (i_Clk) is
  begin
    if rising_edge(i_Clk) then
      o_Data.DATA1 <= i_Data.DATA1;
      o_Data.DV1   <= i_Data.DV1;
      o_Data.DATA2 <= i_Data.DATA2;
      o_Data.DV2   <= i_Data.DV2;  
    end if;
  end process;
end architecture RTL;

SystemVerilog Testbench:

interface Test_IF();
  import test_pkg::*;

  t_Test Data;
endinterface // Test_IF

module Test_Top_TB ();
  import test_pkg::*;
  logic r_Clock;
  Test_IF hook();
  Test_IF hook2();
  Test_Top UUT 
    (.i_Clk(r_Clock),
     .i_Data(hook.Data),
     .o_Data(hook2.Data)
     );
endmodule
3
  • @dave_59, You've answered this question at least twice: verificationacademy.com/forums/systemverilog/… and verificationguild.com/… but on both of those pages the link to the example is broken. Commented Feb 8, 2016 at 20:42
  • I don't see any links to examples on the pages you mentioned. Have you looked int the Questa install directory <>/examples/mixedlang for sample scripts? Commented Feb 8, 2016 at 23:23
  • @dave_59, ah, that's where you meant... I didn't know those were there. Thanks. Also on the 2nd link, your last post says, "The Details are Posted Here" but the link is broken. Commented Feb 9, 2016 at 13:45

1 Answer 1

4

Try changing t_Test in your systemverilog testbench to lower case, ie. t_test.

Sign up to request clarification or add additional context in comments.

1 Comment

That got it. Also for whoever has this same problem in the future, I didn't need to use any of the switches after -mixedsvvh, just using that during the compile was enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.