stats: Add gate input to statistics collector

Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
Alex Forencich
2025-04-16 11:54:16 -07:00
parent 4be054e9b3
commit e3fcf54466
4 changed files with 9 additions and 2 deletions

View File

@@ -214,6 +214,7 @@ tx_stats_inst (
/*
* Control inputs
*/
.gate(1'b1),
.update(1'b0)
);
@@ -372,6 +373,7 @@ rx_stats_inst (
/*
* Control inputs
*/
.gate(1'b1),
.update(1'b0)
);

View File

@@ -44,6 +44,7 @@ module taxi_stats_collect #
/*
* Control inputs
*/
input wire logic gate = 1'b1,
input wire logic update = 1'b0
);
@@ -100,13 +101,13 @@ for (genvar n = 0; n < CNT; n = n + 1) begin : ch
always_ff @(posedge clk) begin
if (acc_clear[n]) begin
if (stat_valid[n]) begin
if (stat_valid[n] && gate) begin
acc_reg <= ACC_W'(stat_inc[n]);
end else begin
acc_reg <= '0;
end
end else begin
if (stat_valid[n]) begin
if (stat_valid[n] && gate) begin
acc_reg <= acc_reg + ACC_W'(stat_inc[n]);
end
end

View File

@@ -39,6 +39,8 @@ class TB(object):
for k in range(len(dut.stat_inc)):
dut.stat_inc[k].setimmediatevalue(0)
dut.stat_valid[k].setimmediatevalue(0)
dut.gate.setimmediatevalue(1)
dut.update.setimmediatevalue(0)
def set_backpressure_generator(self, generator=None):

View File

@@ -42,6 +42,7 @@ taxi_axis_if #(
.ID_W(STAT_ID_W)
) m_axis_stat();
logic gate;
logic update;
taxi_stats_collect #(
@@ -68,6 +69,7 @@ uut (
/*
* Control inputs
*/
.gate(gate),
.update(update)
);