93 lines
2.2 KiB
Systemverilog
93 lines
2.2 KiB
Systemverilog
|
class sysreg_driver;
|
||
|
|
||
|
|
||
|
sysreg_trans tr;
|
||
|
|
||
|
//interface
|
||
|
virtual sysreg_if vif;
|
||
|
virtual spi_if wif;
|
||
|
|
||
|
|
||
|
function new();
|
||
|
endfunction
|
||
|
extern task do_drive();
|
||
|
extern task make_intr();
|
||
|
|
||
|
endclass : sysreg_driver
|
||
|
|
||
|
task sysreg_driver::do_drive();
|
||
|
|
||
|
fork
|
||
|
|
||
|
while(1) begin
|
||
|
make_intr();
|
||
|
end
|
||
|
|
||
|
join
|
||
|
|
||
|
endtask
|
||
|
|
||
|
task sysreg_driver::make_intr();
|
||
|
int cnt=0;
|
||
|
|
||
|
vif.status =32'b0;
|
||
|
|
||
|
cnt = 0;
|
||
|
|
||
|
|
||
|
tr = new();
|
||
|
if(!tr.randomize())
|
||
|
$fatal(0,"Randomize Failed");
|
||
|
|
||
|
|
||
|
while(cnt<3000) begin
|
||
|
@(posedge wif.clk);
|
||
|
|
||
|
cnt = cnt + 1;
|
||
|
|
||
|
case(cnt)
|
||
|
|
||
|
tr.status_time[28]: vif.status[28] <=1'b1;
|
||
|
tr.status_time[27]: vif.status[27] <=1'b1;
|
||
|
tr.status_time[26]: vif.status[26] <=1'b1;
|
||
|
tr.status_time[25]: vif.status[25] <=1'b1;
|
||
|
tr.status_time[24]: vif.status[24] <=1'b1;
|
||
|
tr.status_time[19]: vif.status[19] <=1'b1;
|
||
|
tr.status_time[18]: vif.status[18] <=1'b1;
|
||
|
tr.status_time[17]: vif.status[17] <=1'b1;
|
||
|
tr.status_time[16]: vif.status[16] <=1'b1;
|
||
|
tr.status_time[11]: vif.status[11] <=1'b1;
|
||
|
tr.status_time[10]: vif.status[10] <=1'b1;
|
||
|
tr.status_time[ 9]: vif.status[ 9] <=1'b1;
|
||
|
tr.status_time[ 8]: vif.status[ 8] <=1'b1;
|
||
|
tr.status_time[ 3]: vif.status[ 3] <=1'b1;
|
||
|
tr.status_time[ 2]: vif.status[ 2] <=1'b1;
|
||
|
tr.status_time[ 1]: vif.status[ 1] <=1'b1;
|
||
|
tr.status_time[ 0]: vif.status[ 0] <=1'b1;
|
||
|
endcase
|
||
|
//$display(vif.status);
|
||
|
|
||
|
case(cnt-1)
|
||
|
tr.status_time[28]: vif.status[28] <=1'b0;
|
||
|
tr.status_time[27]: vif.status[27] <=1'b0;
|
||
|
tr.status_time[26]: vif.status[26] <=1'b0;
|
||
|
tr.status_time[25]: vif.status[25] <=1'b0;
|
||
|
tr.status_time[24]: vif.status[24] <=1'b0;
|
||
|
tr.status_time[19]: vif.status[19] <=1'b0;
|
||
|
tr.status_time[18]: vif.status[18] <=1'b0;
|
||
|
tr.status_time[17]: vif.status[17] <=1'b0;
|
||
|
tr.status_time[16]: vif.status[16] <=1'b0;
|
||
|
tr.status_time[11]: vif.status[11] <=1'b0;
|
||
|
tr.status_time[10]: vif.status[10] <=1'b0;
|
||
|
tr.status_time[ 9]: vif.status[ 9] <=1'b0;
|
||
|
tr.status_time[ 8]: vif.status[ 8] <=1'b0;
|
||
|
tr.status_time[ 3]: vif.status[ 3] <=1'b0;
|
||
|
tr.status_time[ 2]: vif.status[ 2] <=1'b0;
|
||
|
tr.status_time[ 1]: vif.status[ 1] <=1'b0;
|
||
|
tr.status_time[ 0]: vif.status[ 0] <=1'b0;
|
||
|
endcase
|
||
|
end
|
||
|
|
||
|
endtask : make_intr
|
||
|
|