start_item()调用前后请求随机化的效果



我正在尝试使用信号量、fork-join&驱动程序的run_phase中的get((-put((方法。

只要我用特定的方式编码序列,驱动程序部分就可以完成任务。据我所知,身体任务编码如下

Code1:
pkt = packet::type_id::create("pkt");    // Factory create the sequence item  
for(int i=0;i<num_trans;i++)             // Repeat as required
begin
assert(pkt.randomize());             // Randomize the sequence item
start_item(pkt);                     //Send the request to Driver. 
finish_item(pkt);                    //Wait for the driver to finish the current item

在上面的风格中,没有实现流水线,而且丢失了与第一个事务包相对应的数据节拍。当在start_item之后调用随机化时,测试台可以按预期工作。

Code2:
pkt = packet::type_id::create("pkt");      
for(int i=0;i<num_trans;i++)
begin

start_item(pkt); 
assert(pkt.randomize());       
finish_item(pkt);

我想知道编码风格1和2 之间的区别是什么

发生这种情况可能是因为在任务start_item((上,我们正在等待以下内容。

sequencer.wait_for_grant(this, set_priority);

因此,我们正在等待sequencer授予序列,然后sequence_item将被获取,但如果您喜欢以下内容。

assert(pkt.randomize());  // Randomize the sequence item
start_item(pkt);          //Send the request to Driver. 

随机化失败了,因为startitem可能正在等待序列发生器空闲,直到那时我们才失去随机化。

你可以进一步阅读下面的文章,这可能会有所帮助https://verificationacademy.com/forums/uvm/startitem/finishitem-versus-uvmdo-macros

最新更新