🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Process is existing as a dreference error during the sim

User: "JainamShah"
Altair Community Member

class processtest;
  process p[];  event ev[];
  function new(); 

  p = new[5];

    ev = new[5];

  endfunction
  task start_prcess(int idx,int delay);

    fork

      begin 

      $display("starting process for idx=%d tiem: %0t",idx, $time);   

    p[idx] = process::self;

     wait(ev[idx].triggered); 

      $display("process is done idx=%d time: %0t",idx, $time );   

  end  

  join_none   

endtask
  function void process_accepted(int idx); 

  ->ev[idx];
  endfunction 

function void print_process_status(int idx);

    process::state pstat;
    pstat = p[idx].status(); 

  $display("idx=%d process_status=%d", idx,p[idx].status);
  endfunction

endclass

module process_test;

  initial begin

    static processtest pt = new(); 

  pt.start_prcess(0,100);   

pt.start_prcess(1,100); 

  pt.start_prcess(2,10); 

  pt.start_prcess(3,1000); 

  pt.start_prcess(4,200); 

     pt.print_process_status(0); 

  pt.process_accepted(1); 

  endmodule

when I run this code I get following error which I am not able to explain. If I remove the pt.print_process_status(0); then this error goes away

S:Begin run-time elaboration and static initialization...=N:[dumpMXD] preparing MXD dump to 'waves.mxd'.=N:[dump] Dump started at time 0=N:Starting event scheduler...=F:[NullRef] null handle 'p' dereferenced @ testbench \processTest.sv:41:14=N:[dumpMXD] closing MXD dump=T:Simulation terminated due to null handle dereference.=N:Backtrace:


PS: is there a better way to put the code in the question?

Find more posts tagged with