coverage callbacks to sample transaction class svidCovCallbacks extends svidCallbacks; // 引入整个transaction svidTrans obj; //*********************************************************** //define functional coverage groups here! //*********************************************************** //定义采样点:transaction中的某些成员。 //SETREGADR covergroup cov_svid_setregadr; covp_sop: coverpoint (obj.sop) iff(obj.command==svidTrans::SETREGADR){ bins covb_sop[] = {[0:7]};//7 bins } covp_addr: coverpoint (obj.address) iff(obj.command==svidTrans::SETREGADR){ bins covb_address_0 = {0};//1 bin bins covb_address_1 = {1};//1 bin } covp_payload: coverpoint (obj.payload) iff(obj.command==svidTrans::SETREGADR){ bins covb_payload[5] = {[0:8'hff]}; //5 bins } covp_parity: coverpoint (obj.parity) iff(obj.command==svidTrans::SETREGADR){ bins covb_parity[] = {[0:1]}; //2 bins } endgroup //*********************************************************** // function new() //*********************************************************** function new(); cov_svid_setregadr=new(); endfunction virtual task pre_send(svidTrans obj); this.obj = obj; cov_svid_setregadr.sample(); endtask endclass