I’ve got the following set of classes. Would you agree or disagree that this is the most proper way to: configure and send a transaction?
Notes:
- transaction is configured by the parent
- No configuration database
- No p_sequencer
- Constraints live with the transaction definition (and any extensions), not using in-line constraints.
Agree? Thoughts to add?
class txnA extends uvm_sequence_item;
`uvm_object_utils(txnA )
int Amax;
rand int A;
constraint c_A { A<Amax; }
function new(string name="txnA");
super.new(name);
endfunction
endclass
class seq_A extends uvm_sequence #(txnA);
`uvm_object_utils(seq_A)
int Amax;
function new(string name="seq_A");
super.new(name);
endfunction
virtual task body();
txnA t;
t = txnA::type_id::create("t")
start_item(t);
t.Amax=Amax;
if(!t.randomize()) `uvm_error("RANDERR","Randomization error")
finish_item(t);
endtask
endclass
class test_A extends test_base ;
`uvm_component_utils(test_A)
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction
virtual task run_phase( uvm_phase phase );
phase.raise_objection(this, "Objection raised");
begin
seq_A seq;
seq = seq_A::type_id::create("seq");
seq.Amax=cfg.subcfg.settings.calculated_max;
seq.start(my_sqr);
end
end
phase.drop_objection(this, "Objection dropped");
endtask
endclass