Incompatible data types when using a package

I’m attempting to modularize my testbench using packages but am getting this error during compile:

pbist_agent = PbistAgent::type_id::create("pbist_agent", this);
                                                            |

ncvlog: *E,TYCMPAT (…/tb/pbistEnv.sv,23|64): formal and actual do not have assignment compatible data types (expecting datatype compatible with ‘class ovm_component’ but found ‘class PbistBaseEnv’ instead).
module worklib.pbist_tb
errors: 1, warnings: 0

(The ‘|’ in the error message is pointing to the “this” portion in the line of code in case it doesn’t format correctly).

This testbench compiled and ran just fine before when I just `included everything. I put the code/files associated with the PbistAgent (agent,driver and sequencer) into a package construct, precompiled it and then imported it into the top level testbench module.

PbistBaseEnv is derived from ovm_env which is derived from ovm_component so what am I missing? I’m suspecting that it has to do with the package since the scoreboard create line doesn’t get flagged. The PbistAgent constructor is the standard constructor that is passed (string name, ovm_component parent) and calls super.new(name,parent).

Here’s some more of the code that may be relevant:

class PbistBaseEnv extends ovm_env;

PbistAgent pbist_agent;
PbistScoreboard pbist_scoreboard;

`ovm_component_utils(PbistBaseEnv)

function new (string name, ovm_component parent);
super.new(name, parent);
endfunction : new

function void build();
super.build();
pbist_agent = PbistAgent::type_id::create(“pbist_agent”, this);
pbist_scoreboard = PbistScoreboard::type_id::create(“pbist_scoreboard”, this);
endfunction : build
.
.
.

Using ncvlog 08.20-s009.

Thanks!
Pat

I’ve been trying different things and have gotten my test to compile and run when using a single command that includes the package source files as well as the rest of the test environment and DUT. But I thought that packages could/should be precompiled ahead of time.

Pat

Hi,

You may be assigning incompatible data types in the new function of pbist_agent.
can you post some sample code of your pbist_agent.

pbist_agent = PbistAgent::type_id::create(“pbist_agent”, this);
|
ncvlog: *E,TYCMPAT (…/tb/pbistEnv.sv,23|64): formal and actual do not have assignment compatible data types (expecting datatype compatible with ‘class ovm_component’ but found ‘class PbistBaseEnv’ instead).
module worklib.pbist_tb
errors: 1, warnings: 0
(The ‘|’ in the error message is pointing to the “this” portion in the line of code in case it doesn’t format correctly).

Thank you,
mpurna.

You may want to check out my recent blog about packages, imports, and `includes : http://go.mentor.com/package-import-versus-include

Dave

This may not be relevant to your situation, but I faced a similar error message because I forgot to register the data type using `ovm_object_utils(<class_name>).

Thanks,

Edmond