Fatal Error bad reference

Hi All,

I got this Fatal error while running a sim :
** Fatal: (SIGSEGV) Bad handle or reference.

Fatal error in Module spi_if at ///***/spi_if.sv line 651

I saw line 651 of the SPI interface i see this code :

always @(SCK)
begin
   if (curr_mode) begin
      MinData = spi_cfg.Mindr * DELAY_UNIT * 1ps;
   end
   else begin
#651      MinData = spi_cfg.Minsr * DELAY_UNIT * 1ps;
   end
end

spi_cfg is handle of class spi_agent_config   
spi_agent_config   spi_cfg;

The variable Minsr is defined as int in the class spi_agent_config 

Not sure what to debug in this case, any pointers 

Thanks,
Tejas

In reply to tejasakulu:

spi_cfg is not a class handle, it is a class variable that should hold a handle to a spi_agent_config object. Make sure you have assigned it and is not currently null.

In reply to dave_59:

Hi Dave :

Sorry i did not get that can you elaborate please

Thanks,
Tejas

In reply to tejasakulu:
See http://go.mentor.com/class-on-classes

Have you constructed or assigned a handle to spi_cfg?

Add this line before line #651

if (spi_cfg == null) $fatal(1, "I was lazy and did not construct an object before trying to reference it");