SPI_Test/tb/dacreg_tb/dacreg_monitor.sv

70 lines
1.9 KiB
Systemverilog
Raw Permalink Normal View History

2024-06-25 16:41:01 +08:00
class dacreg_monitor;
virtual dacreg_if dif;
virtual spi_if wif;
virtual sram_if#(25,32) xif;
//collect
dacreg_trans act_trans[$];
function new();
endfunction
extern task collect();
extern task do_mon();
endclass : dacreg_monitor
task dacreg_monitor::do_mon();
while(1) begin
@(negedge xif.wren);
collect();
end
endtask: do_mon
task dacreg_monitor::collect();
dacreg_trans tr_temp;
@(posedge xif.clk);
@(negedge xif.clk);
tr_temp = new();
tr_temp.Prbs = dif.Prbs ;
tr_temp.Set0 = dif.Set0 ;
tr_temp.Set1 = dif.Set1 ;
tr_temp.Set2 = dif.Set2 ;
tr_temp.Set3 = dif.Set3 ;
tr_temp.Set4 = dif.Set4 ;
tr_temp.Set5 = dif.Set5 ;
tr_temp.Set6 = dif.Set6 ;
tr_temp.Set7 = dif.Set7 ;
tr_temp.Set8 = dif.Set8 ;
tr_temp.Set9 = dif.Set9 ;
tr_temp.Set10 = dif.Set10 ;
tr_temp.Set11 = dif.Set11 ;
tr_temp.Set12 = dif.Set12 ;
tr_temp.Set13 = dif.Set13 ;
tr_temp.Set14 = dif.Set14 ;
tr_temp.Set15 = dif.Set15 ;
tr_temp.Dac_addr = dif.Dac_addr ;
tr_temp.Dac_dw = dif.Dac_dw ;
tr_temp.Dac_ref = dif.Dac_ref ;
tr_temp.Prbs_rst0 = dif.Prbs_rst0 ;
tr_temp.Prbs_set0 = dif.Prbs_set0 ;
tr_temp.Prbs_rst1 = dif.Prbs_rst1 ;
tr_temp.Prbs_set1 = dif.Prbs_set1 ;
tr_temp.Cal_sig = dif.Cal_sig ;
tr_temp.Cal_rstn = dif.Cal_rstn ;
tr_temp.Cal_div_rstn = dif.Cal_div_rstn;
act_trans.push_back(tr_temp);
endtask: collect