我想用任务来描述事务。我正在使用时钟模块 cb。这个任务是我想做的,但是写接缝的值在这样做时是随机的,我想没有定义谁最后驱动写的顺序。
task automatic write_trans(input int data);
fork
begin
cb.write <= '1;
cb.data <= data;
end
begin
##1;
//But only if there is no other transactions driving write to 1
cb.write <= '0;
end
join_any
endtask
因此,如果我只运行一个事务write
,下一个时钟周期就会变低。
//for isolated transactions write should be 0,1,0;
write_trans('h17);
##2;
//for these two transactions write should be 0,1,1,0;
write_trans('h18);
##1;
write_trans('h19);