UVM_Sequence

1、sequence、sequencer、driver的关系

一个sequence在向sequencer发送transaction前,要先向sequencer发送一个请求,sequencer把这个请求放在一个仲裁队列中。

1、作为sequencer,它需做两件事情:

第一,检测仲裁队列里是否有某个sequence发送transaction的请求;

第二,检测driver是否申请transaction

1、如果仲裁队列里有发送请求,但是driver没有申请transaction,那么sequencer将会一直处于等待driver的状态,直到driver申请新的transaction此时,sequencer同意sequence的发送请求,sequence在得到sequencer的批准后,产生出一个transaction并交给sequencer,后者把这个transaction交给driver

2、如果仲裁队列中没有发送请求,但是driversequencer申请新的transaction,那么sequencer将会处于等待sequence的状态,一直到有sequence递交发送请求,sequencer马上同意这个请求,sequence产生transaction并交给sequencer,最终driver获得这个transaction

3、 如果仲裁队列中有发送请求,同时driver也在向sequencer申请新的transaction,那么将会同意发送请求,sequence产生transaction并交给sequencer,最终driver获得这个transaction。 

2、driver如何向sequencer申请transaction

uvm_driver中有成员变量seq_item_port,而在uvm_sequencer中有成员变量seq_item_export这两者之间可以建立一个通道,通道中传递的transaction类型就是定义my_sequencermy_driver时指定的transaction。

 3、www.testbench.in中的解释:

The above image shows how a transaction from a sequence is sent to driver and the response from the driver is sent to sequencer. There are multiple methods called during this operation. 

First when the body() method is called 
1) A transaction is created using "create()" method. If a transaction is created using "create()" method, then it can be overridden if required using uvm factory. 

2) After a transaction is created, wait_for_grant() method is called. This method is blocking method. (此时还未随机化)

3) In the run task of the driver, when "seq_item_port.get_next_item()" is called, then the sequencer un blocks wait_for_grant() method. If more than one sequence is getting executed by sequencer, then based on arbitration rules, un blocks the wait_for_grant() method. 

4) After the wait_for_grant() un blocks, then transaction can be randomized, or its properties can be filled directly. Then using the send_request() method, send the transaction to the driver. 

5) After calling the send_request() method, "wait_for_item_done()" method is called. This is a blocking method and execution gets blocks at this method call. 

6) The transaction which is sent from sequence , in the driver this transaction is available as "seq_item_port.get_next_item(req)" method argument. Then driver can drive this transaction to bus or lower level. 

7) Once the driver operations are completed, then by calling "seq_item_port.put(rsp)", wait_for_item_done() method of sequence gest unblocked. Using get_responce(res), the response transaction from driver is taken by sequence and processes it. 

After this step, again the steps 1 to 7 are repeated five times. 

2、sequence的启动相关的:

1、手动启动:

 2、通过default_sequence启动:

3、定义嵌套sequence然后启动:

4、定义virtual_sequence然后启动:

 

posted on 2016-10-10 00:52  hematologist  阅读(333)  评论(0编辑  收藏  举报

导航