In reply to dip0:
The driver code
class tc_driver extends uvm_driver;
`uvm_component_utils(tc_driver)
virtual intf dut_vi; //virtual interface
function new(string name, uvm_component parent);
super.new(name,parent);
endfunction
function void build_phase(uvm_phase phase);
endfunction:build_phase
task run_phase(uvm_phase phase);
forever
begin
tc_transaction tx;
@(posedge dut_vi.clock);
seq_item_port.get_next_item(tx); //the get_next_item is synchronus to the start_item()
dut_vi.a<=tx.a;
dut_vi.comma<=tx.comma;//pin wiggles for the DUT
dut_vi.enable<=tx.enable;
//dut_vi.out=tx.out;
seq_item_port.item_done();//transaction is complete
end //this signals the sequencer that transaction is complete
//it //this tells the sequencer to return
endtask:run_phase
endclass:tc_driver
===============================
The sequence code
class tc_sequence extends uvm_sequence;
`uvm_object_utils(tc_sequence)
tc_transaction tc_tr;
function new(string name=“tc_sequence”);
super.new(name);
endfunction:new
task body();
//tc_transaction tc_tr;
tc_tr=tc_transaction::type_id::create("tc_tr");
//`uvm_do(tc_tr)
repeat(100)
begin
start_item(tc_tr); //the start_item returns
//the driver is ready to recive the transaction
//this synchronize the driver with the sequencer
assert(tc_tr.randomize());
//tc_tr.cmd=READ; read (use enum)
finish_item(tc_tr);
end
endtask:body
function void report_phase(uvm_phase phase);
//if(tc_tr.randomize)
// $display("the randomization is successfull");
endfunction:report_phase
endclass:tc_sequence
//--------------------------------------
//the sequencer
typedef uvm_sequencer#(tc_transaction) tc_sequencer;
========================================
The test class
class tc_test extends uvm_test;
`uvm_component_utils(tc_test)
tc_env tc_e;
function new(string name, uvm_component parent);
super.new(name,parent);
endfunction:new
function void build_phase(uvm_phase phase);
super.build_phase(phase);
//tc_env tc_e;
tc_e=tc_env::type_id::create(“tc_e”,this);
endfunction:build_phase
task run_phase(uvm_phase phase);
tc_sequence tc_seq;
phase.raise_objection(.obj(this));
tc_seq=tc_sequence::type_id::create(“tc_seq”,this);
//assert(tc_seq.randomize());
tc_seq.start(tc_e.tc_ag.tc_seqr);
phase.drop_objection(.obj(this));
endtask:run_phase
endclass:tc_test