From 1b7d3a9d389daf0455397f7451adb6ff8cf817d5 Mon Sep 17 00:00:00 2001 From: Radek Isa Date: Thu, 17 Oct 2024 19:54:32 +0200 Subject: [PATCH] UVM MFB: [MAINTENANCE] Refactorization If dependency. This structure prevents more errors which can occur on the interface. Such as EOF withnout SOF. --- comp/uvm/mfb/statistic.sv | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/comp/uvm/mfb/statistic.sv b/comp/uvm/mfb/statistic.sv index 15d31f2fd..b9bbea343 100644 --- a/comp/uvm/mfb/statistic.sv +++ b/comp/uvm/mfb/statistic.sv @@ -30,29 +30,36 @@ class statistic #(int unsigned REGIONS, int unsigned REGION_SIZE, int unsigned B const int unsigned eof_pos = (REGION_SIZE*BLOCK_SIZE) > 1 ? t.eof_pos[it] : 0; if (indata == 1) begin + //Data end in this region if (t.eof[it]) begin data_size += (eof_pos+1)*ITEM_WIDTH; indata = 0; + // Next data start in this region + if (t.sof[it]) begin + data_size += (REGION_SIZE - sof_pos)*BLOCK_SIZE*ITEM_WIDTH; + indata = 1; + end end else begin + // Data is all acros this region data_size += REGION_SIZE*BLOCK_SIZE*ITEM_WIDTH; end - - if (t.sof[it]) begin - data_size += (REGION_SIZE - sof_pos)*BLOCK_SIZE*ITEM_WIDTH; - indata = 1; - end end else begin + // This path is outside frame. If there is EOF then there have to + // sof before it. if (t.sof[it]) begin - data_size += (REGION_SIZE - sof_pos)*BLOCK_SIZE*ITEM_WIDTH; - indata = 1; + // Data start and end in same region + if (t.eof[it]) begin + data_size += (eof_pos+1 - sof_pos*BLOCK_SIZE)*ITEM_WIDTH; + indata = 0; + // Data only start in this region + end else begin + data_size += (REGION_SIZE - sof_pos)*BLOCK_SIZE*ITEM_WIDTH; + indata = 1; + end end else begin + //There is no data in region data_size += 0; end - - if (t.eof[it]) begin - data_size -= (REGION_SIZE*BLOCK_SIZE - eof_pos)*ITEM_WIDTH; - indata = 0; - end end end end