自己又写个简单的结构,跑出来还是死掉,请大家指点一下。代码如下, vcs下编译可以通过,命名有点没章法,见谅.
//`timescale 1ns/100ps
`include "uvm_macros.svh"
import uvm_pkg::*;
class test extends uvm_reg;
rand uvm_reg_field data;
virtual function void build();
data = uvm_reg_field::type_id::create("data");
data.configure(this,1,0,"RW",1,0,1,1,0 );
endfunction
`uvm_object_utils( test )
function new( input string name="test" );
super.new( name,16,UVM_NO_COVERAGE );
endfunction
endclass
class reg_model extends uvm_reg_block;
rand test test_0;
virtual function void build();
default_map = create_map("default_map",0,2,UVM_BIG_ENDIAN,0);
test_0 = test::type_id::create("test_0", , get_full_name());
test_0.configure( this, null, "test_0" );
test_0.build();
default_map.add_reg( test_0, 'h9, "RW" );
endfunction
`uvm_object_utils(reg_model)
function new( input string name="reg_model" );
super.new( name, UVM_NO_COVERAGE );
endfunction
endclass
class A extends uvm_sequencer;
reg_model rm;
`uvm_component_utils( A )
function new( string name="A", uvm_component parent );
super.new( name );//, parent );
endfunction
virtual task configure_phase( uvm_phase phase );
super.configure_phase( phase );
$display("???????????????????? 11");
endtask
virtual task main_phase( uvm_phase phase );
uvm_status_e st;
uvm_reg_data_t value;
super.main_phase( phase );
phase.raise_objection( this );
$display("????????????????????");
rm.test_0.read( st, value, UVM_FRONTDOOR );
$display("!!!!!!!!!!!!!!!!!!!!");
$display("hhhhhhhhhhhhhhhhhhh value is %d", value);
phase.drop_objection( this );
endtask
endclass
class sqrrr extends uvm_sequence ;
`uvm_object_utils( sqrrr )
function new( string name="sqrrr" );
super.new( name );
endfunction
virtual task body();
if( starting_phase != null )
starting_phase.raise_objection( this );
$display("here ?? ");
#2000;
if( starting_phase != null )
starting_phase.drop_objection( this );
endtask
endclass
class adapter extends uvm_reg_adapter;
function new( string name );
super.new( name );
endfunction
function uvm_sequence_item reg2bus( const ref uvm_reg_bus_op rw );
uvm_sequence_item tr;
tr = new("tr");
return tr;
endfunction
function void bus2reg ( uvm_sequence_item bus_item, ref uvm_reg_bus_op rw );
endfunction
endclass
class case0 extends uvm_test;
A test;
reg_model rm;
adapter adp;
`uvm_component_utils( case0 );
function new( string name = "case0", uvm_component parent = null );
super.new( name, parent );
endfunction
function void build_phase( uvm_phase phase );
adp = new("adper");
test = A::type_id::create("test",this);
rm = reg_model::type_id::create("rm",this);
rm.configure(null,"");
rm.build();
rm.lock_model();
rm.reset();
rm.default_map.set_sequencer( test , adp );
rm.default_map.set_auto_predict( 1 );
test.rm = this.rm;
super.build_phase( phase );
//test = A::type_id::create("test",this);
uvm_config_db #( uvm_object_wrapper )::set( this,
"test.main_phase",
"default_sequence",
sqrrr::type_id::get());
$display("here ?? ");
endfunction
endclass
module aaa;
// test = new("test",null);
initial begin
run_test( "case0" );
#1000;
// $finish();
end
endmodule
|