54 lines
694 B
Systemverilog
54 lines
694 B
Systemverilog
|
class dacreg_driver;
|
||
|
|
||
|
|
||
|
dacreg_trans tr;
|
||
|
|
||
|
//interface
|
||
|
virtual dacreg_if dif;
|
||
|
virtual spi_if wif;
|
||
|
|
||
|
|
||
|
function new();
|
||
|
endfunction
|
||
|
extern task do_drive();
|
||
|
extern task make_pkt();
|
||
|
|
||
|
endclass : dacreg_driver
|
||
|
|
||
|
task dacreg_driver::do_drive();
|
||
|
|
||
|
fork
|
||
|
|
||
|
while(1) begin
|
||
|
make_pkt();
|
||
|
end
|
||
|
|
||
|
join
|
||
|
|
||
|
endtask
|
||
|
|
||
|
task dacreg_driver::make_pkt();
|
||
|
int cnt=0;
|
||
|
|
||
|
|
||
|
cnt = 0;
|
||
|
|
||
|
|
||
|
tr = new();
|
||
|
if(!tr.randomize())
|
||
|
$fatal(0,"Randomize Failed");
|
||
|
|
||
|
|
||
|
while(cnt<3000) begin
|
||
|
@(posedge wif.clk);
|
||
|
|
||
|
cnt = cnt + 1;
|
||
|
|
||
|
case(cnt)
|
||
|
tr.Cal_end: dif.Cal_end <=tr.Cal_end;
|
||
|
endcase
|
||
|
|
||
|
end
|
||
|
|
||
|
endtask : make_pkt
|