From d35d61f89bb89c3db63dbec74dae785c381e5191 Mon Sep 17 00:00:00 2001 From: bsdevlin Date: Sun, 7 Apr 2019 14:18:05 -0400 Subject: [PATCH] add code for random backpressure --- ip_cores/common/src/rtl/common_if.sv | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ip_cores/common/src/rtl/common_if.sv b/ip_cores/common/src/rtl/common_if.sv index 8d2cd97..e7424d5 100644 --- a/ip_cores/common/src/rtl/common_if.sv +++ b/ip_cores/common/src/rtl/common_if.sv @@ -126,12 +126,12 @@ interface if_axi_stream # ( endtask; // Task used in simulation to get data from a sink interface - task automatic get_stream(ref logic [common_pkg::MAX_SIM_BYTS*8-1:0] data, ref integer signed len, input integer bp = 0); + task automatic get_stream(ref logic [common_pkg::MAX_SIM_BYTS*8-1:0] data, ref integer signed len, input integer unsigned bp = 50); logic sop_l = 0; rdy = ($random % 100) >= bp; len = 0; data = 0; - @(posedge i_clk); + @(negedge i_clk); while (1) begin if (val && rdy) begin @@ -144,9 +144,11 @@ interface if_axi_stream # ( len = len + (eop ? (mod == 0 ? DAT_BYTS : mod) : DAT_BYTS); if (eop) break; end - @(posedge i_clk); + @(negedge i_clk); rdy = ($random % 100) >= bp; end + @(posedge i_clk); + rdy = 1; endtask