Hi , i am running this example of bidirectional in ovm which is giving me a null pointer dereference error . The code is :
// program_1 :Defining the request and response transaction objects
class request_tr extends ovm_transaction;
byte request;
endclass
class response_tr extends ovm_transaction;
byte response;
endclass
//Program_2: Producer implementation
class producer extends ovm_component;
ovm_transport_port #(request_tr, response_tr) transport_port;
ovm_blocking_master_port #(request_tr, response_tr) b_master_port;
function new(string name, ovm_component parent);
super.new(name, parent);
transport_port = new("transport_port", this);
b_master_port = new("b_master_port", this);
endfunction
endclass
// Program_3: Consumer implementation
class consumer extends ovm_component;
ovm_transport_imp #(request_tr, response_tr, consumer) transport_imp;
ovm_blocking_master_imp #(request_tr, response_tr, consumer) b_master_imp;
function new(string name, ovm_component parent);
super.new(name, parent);
transport_imp = new("transport_imp", this);
b_master_imp = new("b_master_imp", this);
endfunction
function bit must_wait_for_response(request_tr req_tr); endfunction
function void handle_request(request_tr req_tr); endfunction
function response_tr get_response(); endfunction
function response_tr peek_at_response(); endfunction
task wait_until_next_request_can_be_accepted(); endtask
task wait_until_response_is_ready(); endtask
task transport(input request_tr req_tr, output response_tr rsp_tr);
wait_until_next_request_can_be_accepted();
handle_request(req_tr);
wait_until_response_is_ready();
rsp_tr = get_response();
endtask
function bit nb_transport(input request_tr req_tr, output response_tr rsp_tr);
if (must_wait_for_response(req_tr)) return 0;
handle_request(req_tr);
rsp_tr = get_response();
return 1;
endfunction
task put(input request_tr req_tr);
wait_until_next_request_can_be_accepted();
handle_request(req_tr);
endtask
task get(output response_tr rsp_tr);
wait_until_response_is_ready();
rsp_tr = get_response();
endtask
task peek(output response_tr rsp_tr);
wait_until_response_is_ready();
rsp_tr = peek_at_response();
endtask
endclass
// program_4 : Example top component implementation
class bidir_example_top extends ovm_component;
producer prod;
consumer cons;
function new(string name, ovm_component parent);
super.new(name, parent);
prod = new("prod", this);
cons = new("cons", this);
prod.transport_port.connect(cons.transport_imp);
prod.b_master_port.connect(cons.b_master_imp);
endfunction
endclass
Program_5: Top level component instantiation and binding resolution
module top;
include "ovm.svh"
include “program_1” // request/response classes
include "program_2" // producer class
include “program_3” // consumer class
`include “program_4” // bidir_example_top class
request_tr req_tr;
response_tr rsp_tr;
bidir_example_top extop;
initial begin
extop = new("bidir_example_top", null);
extop.resolve_all_bindings();
req_tr = new();
extop.prod.transport_port.transport(req_tr, rsp_tr);
`message(OVM_INFO, (rep_tr.response))
end
endmodule
I get the error as :
ncsim: *E,TRNULLID: NULL pointer dereference.
File: /tools/cadence/INCISIV11.10/tools.lnx86/ovm/ovm_lib/ovm_sv/sv/tlm/ovm_ports.svh, line = 288, pos = 47
Scope: top.ovm_transport_port#(request_tr,response_tr)@1150_2.transport
Time: 0 FS + 0
Verilog Stack Trace:
0: task top.ovm_transport_port#(request_tr,response_tr)@1150_2.transport at /tools/cadence/INCISIV11.10/tools.lnx86/ovm/ovm_lib/ovm_sv/sv/tlm/ovm_ports.svh:288
1: initial block in top at ./top.sv:22
/tools/cadence/INCISIV11.10/tools.lnx86/ovm/ovm_lib/ovm_sv/sv/tlm/ovm_ports.svh:288 `TRANSPORT_IMP (this.m_if, REQ, RSP, req, rsp)
ncsim> exit
I just came to understand that in top file there is extop.prod.transport_port.transport(req_tr, rsp_tr); where task transport is called which is defined in consumer class . so we need to intialise the variable where we call this . Is that rit ? if yes let me no what i have to intialise and how ?
please give ur valuable knowledge and let me know what is this error and why it occured…?