Hi,
Coming from VHDL world i’m used to compile parts of the design in seperate libraries, i.e. module A in library A, module B in library B.
I’m trying to do the same in system verilog without much success when i try to use a structure for my module IOs.
Code example:
module1.sv:
package my_types_pkg;
typedef struct
{
logic read;
logic write;
} record_test_t;
endpackage
module module_1(
my_types_pkg::record_test_t t_tb
);
endmodule
module1_tb.sv:
module top;
my_types_pkg::record_test_t t_tb_1_s;
module_1 module_1_1(
.t_tb(t_tb_1_s)
);
endmodule
When i compile both files in the same library i have no issue:
vlib work
vlog -sv -work work module1.sv
vlog -sv -work work module1_tb.sv
However when i try to compile them in different libraries it tells me the structure i’ve defined is undefined… :(
vlib work
vlib module1
vlib module1_tb
vlog -sv -work module1 module1.sv
vlog -sv -work module1_tb module1_tb.sv
==>
vlog -libmap_verbose -sv -work module1_tb module1_tb.sv
QuestaSim vlog 10.2c_5 Compiler 2013.11 Nov 19 2013
– Compiling module top
** Error: module1_tb.sv(41): (vlog-2164) Class or package ‘my_types_pkg’ not found.
** Error: module1_tb.sv(41): near “::”: syntax error, unexpected ::, expecting IDENTIFIER or TYPE_IDENTIFIER
I’m not sure how to tell system verilog to look in another library for this package.
In VHDL it would be something as simple as:
library module1;
use module1.all;
Thanks.
Nicolas.