1.总线功能模型作用:
总线功能模型可以用来产生激励,也可以监视设计的响应。通常,一个总线功能模型实现这两个操作。
2.CPU transactions
task write_cycle(input bit [23:0] wadd,
input bit [31:0] wdat);
do @ (cb) while (cb.phi != 2);
cb.addr <= wadd;
cb.ads <= 1’b0;
cb.rw <= 1’b1;
cb.data <= wdat;
repeat (2) @ (cb);
cb.ads <= 1’b1;
do @(cb) while (cb.phi != 2 ||
cb.ready != ’0’);
cb.data <= ’z;
endtask: write_cycle
2.1 总线功能程序能包含返回值
All of the abstracted transactions shown so far were unidirectional.Data always flowed from the testbench through the bus-functional task where the data was applied to the design and outputs were checked for correctness. What if determining the correctness of the output required visibility over multiple operations? What if only the relevant output values for this testcase were known and the others were to be ignored? Bus-functional tasks can just as easily sample output and return it instead of comparing the output against supplied expected responses. The sampled value can then be processed by the testbench where the value can be dealt w