fpga: rfnoc: Fix strobe probability in radio simulator

Original-commit: 8f68886ee3045abb486bfa8179e7129ebd377580
This commit is contained in:
Wade Fife
2022-03-04 18:46:12 -06:00
parent 6227436d54
commit 9ddb360199
@@ -1,14 +1,14 @@
// //
// Copyright 2019 Ettus Research, A National Instruments Company // Copyright 2022 Ettus Research, A National Instruments Brand
// //
// SPDX-License-Identifier: LGPL-3.0-or-later // SPDX-License-Identifier: LGPL-3.0-or-later
// //
// Module: sim_radio_gen // Module: sim_radio_gen
// //
// Description: Generate radio data for simulation purposes. The strobe pattern // Description: Generate radio data for simulation purposes. The strobe pattern
// is random, which is not like a normal radio but covers every possibility. // is random, which is not like a normal radio but covers every possibility.
// The data pattern is an incrementing sequence of samples, with each channel // The data pattern is an incrementing sequence of samples, with each channel
// starting at a different value to differentiate them. Strobe and time are // starting at a different value to differentiate them. Strobe and time are
// common between channels. // common between channels.
// //
@@ -39,7 +39,7 @@ module sim_radio_gen #(
// Generate an initial value all radio channels // Generate an initial value all radio channels
function radio_t [NUM_CHANNELS-1:0] radio_init(); function radio_t [NUM_CHANNELS-1:0] radio_init();
radio_t [NUM_CHANNELS-1:0] ret_val; radio_t [NUM_CHANNELS-1:0] ret_val;
for (int n = 0; n < NUM_CHANNELS; n++) begin for (int n = 0; n < NUM_CHANNELS; n++) begin
sample_t sample; sample_t sample;
@@ -70,7 +70,7 @@ module sim_radio_gen #(
radio_rx_stb <= '0; radio_rx_stb <= '0;
end else begin end else begin
radio_rx_stb <= '0; radio_rx_stb <= '0;
if ($urandom_range(100) < STB_PROB) begin if ($urandom_range(99) < STB_PROB) begin
for (int n = 0; n < NUM_CHANNELS; n++) begin for (int n = 0; n < NUM_CHANNELS; n++) begin
for (int s = 0; s < NSPC; s++) begin for (int s = 0; s < NSPC; s++) begin
data[n][s*SAMP_W +: SAMP_W] <= data[n][s*SAMP_W +: SAMP_W] + NSPC; data[n][s*SAMP_W +: SAMP_W] <= data[n][s*SAMP_W +: SAMP_W] + NSPC;