uvm_sequence

squence由data item组成, 不同的组合可以产生不同的transaction, 所以便可以产生不同的激励。如下图所示:

下面是使用sequence的步骤:

  1. 创建一个自定义的sequence, 派生自[uvm_sequence]。 用factory机制注册, 并且创建new函数:
1
2
3
4
5
6
7
8
9
10
11
12
// my_sequence is user-given name for this class that has been derived from "uvm_sequence"
class my_sequence extends uvm_sequence;

// [Recommended] Makes this sequence reusable. Note that we are calling
// `uvm_object_utils instead of `uvm_component_utils because sequence is a uvm_transaction object
`uvm_object_utils (my_sequence)

// This is standard code for all components
function new (string name = "my_sequence");
super.new (name, parent);
endfunction
endclass
  1. 申明默认的sequencer来执行sequence的transaction:
1
2
// [Optional] my_sequencer is a pre-defined custom sequencer before this sequence definition
`uvm_declare_p_sequencer (my_sequencer)
  1. 定义body
1
2
3
4
// [Recommended] Make this task "virtual" so that child classes can override this task definition
virtual task body ();
// Stimulus for this sequence comes here
endtask