[i2c, dv] Add i2c_stretch_timeout and i2c_fifo_full tests (v2)
1) i2c_stretch_timeout: stretch_timeout interrupt is aggressively trigerred and verified.
- Add i2c_stretch_timeout_vseq
- Update i2c_testplan.md
- Fix invalid format programmed to fmt_fifo (i2c_rx_tx_vseq.sv)
- Refactor code and clean nits
2) i2c_fifo_full: verify full status of both rx_fifo and fmt_fifo
- Add i2c_fifo_full_vseq
- Update i2c_testplan.md
Signed-off-by: Tung Hoang <hoang.tung@wdc.com>
diff --git a/hw/dv/sv/i2c_agent/i2c_device_driver.sv b/hw/dv/sv/i2c_agent/i2c_device_driver.sv
index 7917814..e87628d 100644
--- a/hw/dv/sv/i2c_agent/i2c_device_driver.sv
+++ b/hw/dv/sv/i2c_agent/i2c_device_driver.sv
@@ -15,7 +15,7 @@
virtual task get_and_drive();
uint num_stretch_host_clks;
- uint rd_data_cnt = 0;
+ bit [7:0] rd_data_cnt = 8'd0;
i2c_item rsp_item;
@(posedge cfg.vif.rst_ni);
@@ -45,12 +45,12 @@
join
end
RdData: begin
- `DV_CHECK_MEMBER_RANDOMIZE_FATAL(rd_data)
- rd_data_cnt++;
- `DV_CHECK_LE(rd_data_cnt, 256);
+ if (rd_data_cnt == 8'd0) `DV_CHECK_MEMBER_RANDOMIZE_FATAL(rd_data)
for (int i = 7; i >= 0; i--) begin
cfg.vif.device_send_bit(cfg.timing_cfg, rd_data[rd_data_cnt][i]);
end
+ // rd_data_cnt is rollled back (no overflow) after reading 256 bytes
+ rd_data_cnt++;
`uvm_info(`gfn, $sformatf("driver, trans %0d, byte %0d %0x",
rsp_item.tran_id, rsp_item.num_data+1, rd_data[rd_data_cnt]), UVM_DEBUG)
end