124 lines
3.8 KiB
Systemverilog
124 lines
3.8 KiB
Systemverilog
class awgreg_monitor;
|
|
|
|
virtual awgreg_if aif;
|
|
virtual spi_if wif;
|
|
virtual sram_if xif;
|
|
|
|
static int pktnum;
|
|
|
|
//Collected Vars
|
|
awgreg_trans awg_tr[$];
|
|
|
|
|
|
function new();
|
|
endfunction
|
|
extern task do_mon();
|
|
extern task collect();
|
|
|
|
endclass : awgreg_monitor
|
|
|
|
task awgreg_monitor::do_mon();
|
|
int pkt_i=0;
|
|
|
|
fork
|
|
|
|
while(1) begin: awgreg_monitor
|
|
if(pkt_i==pktnum) break;
|
|
if(wif.csn) @(negedge wif.csn);
|
|
collect();
|
|
end: awgreg_monitor
|
|
|
|
repeat(pktnum) begin: kill_progress
|
|
@(negedge wif.csn);
|
|
pkt_i++;
|
|
end
|
|
|
|
join
|
|
|
|
endtask: do_mon
|
|
|
|
|
|
task awgreg_monitor::collect();
|
|
awgreg_trans awg_tr_temp;
|
|
bit[31:0] cmd_temp;
|
|
int size=0;
|
|
int i=0,j=0;
|
|
|
|
for(j=0;j<31;j++) begin
|
|
@(posedge wif.sclk or posedge wif.csn)
|
|
if(wif.error_check | wif.csn)
|
|
break;
|
|
cmd_temp[j] = wif.mosi;
|
|
end
|
|
size = cmd_temp[1] ? 16 : 1;
|
|
|
|
awg_tr.delete;
|
|
repeat(size) begin
|
|
awg_tr_temp = new();
|
|
//if read, sample regfile's input port as exp_data
|
|
if(cmd_temp[0]) begin
|
|
@(posedge xif.rden);
|
|
repeat(1) @(posedge wif.clk);
|
|
awg_tr_temp.mcu_result0 = aif.mcu_result0;
|
|
awg_tr_temp.mcu_result1 = aif.mcu_result1;
|
|
awg_tr_temp.mcu_result2 = aif.mcu_result2;
|
|
awg_tr_temp.mcu_result3 = aif.mcu_result3;
|
|
awg_tr_temp.fb_st_i = aif.fb_st_i;
|
|
awg_tr_temp.run_time = aif.run_time;
|
|
awg_tr_temp.instr_num = aif.instr_num;
|
|
end
|
|
//if write, sample regfile's output port as act_data
|
|
else begin
|
|
@(posedge xif.wren);
|
|
repeat(2) @(posedge wif.clk);
|
|
@(negedge wif.clk);
|
|
awg_tr_temp.mcu_param0 = aif.mcu_param0 ;
|
|
awg_tr_temp.mcu_param1 = aif.mcu_param1 ;
|
|
awg_tr_temp.mcu_param2 = aif.mcu_param2 ;
|
|
awg_tr_temp.mcu_param3 = aif.mcu_param3 ;
|
|
awg_tr_temp.fb_st_o = aif.fb_st_o ;
|
|
awg_tr_temp.mod_sel_sideband = aif.mod_sel_sideband;
|
|
awg_tr_temp.qam_nco_clr = aif.qam_nco_clr ;
|
|
awg_tr_temp.qam_fcw = aif.qam_fcw ;
|
|
awg_tr_temp.qam_pha = aif.qam_pha ;
|
|
awg_tr_temp.qam_mod = aif.qam_mod ;
|
|
awg_tr_temp.qam_sel_sideband = aif.qam_sel_sideband;
|
|
awg_tr_temp.intp_mode = aif.intp_mode ;
|
|
awg_tr_temp.intp_sel = aif.intp_sel ;
|
|
awg_tr_temp.dac_mode_sel = aif.dac_mode_sel ;
|
|
awg_tr_temp.tc_bypass = aif.tc_bypass ;
|
|
awg_tr_temp.tcparr0 = aif.tcparr0 ;
|
|
awg_tr_temp.tcparr1 = aif.tcparr1 ;
|
|
awg_tr_temp.tcparr2 = aif.tcparr2 ;
|
|
awg_tr_temp.tcparr3 = aif.tcparr3 ;
|
|
awg_tr_temp.tcparr4 = aif.tcparr4 ;
|
|
awg_tr_temp.tcparr5 = aif.tcparr5 ;
|
|
awg_tr_temp.tcpbrr0 = aif.tcpbrr0 ;
|
|
awg_tr_temp.tcpbrr1 = aif.tcpbrr1 ;
|
|
awg_tr_temp.tcpbrr2 = aif.tcpbrr2 ;
|
|
awg_tr_temp.tcpbrr3 = aif.tcpbrr3 ;
|
|
awg_tr_temp.tcpbrr4 = aif.tcpbrr4 ;
|
|
awg_tr_temp.tcpbrr5 = aif.tcpbrr5 ;
|
|
awg_tr_temp.tcpair0 = aif.tcpair0 ;
|
|
awg_tr_temp.tcpair1 = aif.tcpair1 ;
|
|
awg_tr_temp.tcpair2 = aif.tcpair2 ;
|
|
awg_tr_temp.tcpair3 = aif.tcpair3 ;
|
|
awg_tr_temp.tcpair4 = aif.tcpair4 ;
|
|
awg_tr_temp.tcpair5 = aif.tcpair5 ;
|
|
awg_tr_temp.tcpbir0 = aif.tcpbir0 ;
|
|
awg_tr_temp.tcpbir1 = aif.tcpbir1 ;
|
|
awg_tr_temp.tcpbir2 = aif.tcpbir2 ;
|
|
awg_tr_temp.tcpbir3 = aif.tcpbir3 ;
|
|
awg_tr_temp.tcpbir4 = aif.tcpbir4 ;
|
|
awg_tr_temp.tcpbir5 = aif.tcpbir5 ;
|
|
end
|
|
awg_tr.push_back(awg_tr_temp);
|
|
//$display("one pkt cllct");
|
|
end
|
|
|
|
if(cmd_temp[0] & !wif.csn) @(posedge wif.csn);
|
|
|
|
endtask
|
|
|
|
|