|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 lkk1988223 于 2013-10-31 15:43 编辑
直接附代码:
virtual task body();
automatic ahb_transfer a ;
begin
for(int i = 0; i <= itr; i++) begin
req = ahb_transfer::type_id::create("req");
start_item(req);
assert(req.randomize());
a = req ;
fork
begin
a.wait_trigger("DATA_DONE") ;
if(a.direction==READ) `uvm_info(get_type_name(),$psprintf("master sequence read data :\n%s",a.sprint()), UVM_LOW)
end
join_none
finish_item(req);
end
end
endtask
task automatic do_pipeline_transfer ;
ahb_transfer transfer ;
forever begin
key.get(); //the key is a semaphore
seq_item_port.get( transfer );
`uvm_info(get_type_name(),$psprintf("Driving request :\n%s",transfer.sprint()), UVM_LOW)
accept_tr(transfer,$time);
void'(begin_tr(transfer,"pipelined_driver"));
// driver control
...
@(posedge vif.HCLK)
key.put();
//driver data
...
@(posedge vif.HCLK iff vif. AHB_HREADY)
if(transfer.direction == READ)
begin
transfer.rdata = vif.AHB_HRDATA;
`uvm_info(get_type_name(),$psprintf("master read data :\n%s",transfer.sprint()), UVM_LOW)
transfer.trigger("DATA_DONE");
end
end_tr(transfer);
end
endtask
output :
# UVM_INFO ahb_master_driver.sv(73) @ 75: uvm_test_top.ahb0.master_agent.driver [ahb_master_driver] master read data :
# ----------------------------------------------------------------------------------------------------------------------
# Name Type Size Value
# ----------------------------------------------------------------------------------------------------------------------
# req ahb_transfer - @963
# wdata integral 32 'h91fb2fc4
# rdata integral 32 'h6afb75c6
# address integral 32 'h17ce26
# direction ahb_direction 1 READ
# ----------------------------------------------------------------------------------------------------------------------
#
# UVM_INFO ahb_master_seq_lib.sv(84) @ 75: uvm_test_top.ahb0.master_agent.sequencer@@ahb_master_single_seq [ahb_master_single_seq] master sequence read data :
# ----------------------------------------------------------------------------------------------------------------------
# Name Type Size Value
# ----------------------------------------------------------------------------------------------------------------------
# req ahb_transfer - @1020
# wdata integral 32 'hd1fb2950
# rdata integral 32 'h82332ddc
# address integral 32 'h136da6
# direction ahb_direction 1 READ
求助:我是想让sequence输出从总线上收集的信息,为什么我执行transfer.trigger("DATA_DONE")时是@963 而sequence被触发的时候换成 @1020 了 。注意:这里任务 do_pipeline_transfer 是2个并发执行的。 谢谢指点~ 速度来人啊!解答困惑啊! |
|