Skip to content

Commit 2a92363

Browse files
committed
testbenches/ip/spi_engine: fix test_lanes
This commit fixes the read and write test for the offload mode of the test_lanes. The DDR read was removed by accident in latest commit. It also fixes the mask and the num of active lanes. Signed-off-by: Carlos Souza <[email protected]>
1 parent 5abadd2 commit 2a92363

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

testbenches/ip/spi_engine/tests/test_lanes.sv

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,10 @@ program test_lanes (
181181
#100ns;
182182

183183
fifo_spi_test();
184-
sdi_lane_mask = 8'h1;
185-
sdo_lane_mask = 8'h1;
184+
sdi_lane_mask = {`NUM_OF_SDI{1'b1}};
185+
sdo_lane_mask = {`NUM_OF_SDO{1'b1}};
186+
num_of_active_sdi_lanes = $countones(sdi_lane_mask);
187+
num_of_active_sdo_lanes = $countones(sdo_lane_mask);
186188
spi_api.fifo_command(`SET_SDI_LANE_MASK(sdi_lane_mask));//guarantee all SDI lanes must be active
187189
spi_api.fifo_command(`SET_SDO_LANE_MASK(sdo_lane_mask));//guarantee all SDO lanes must be active
188190

@@ -389,6 +391,7 @@ program test_lanes (
389391

390392
for (int i = 0, k = 0; i < ((`NUM_OF_TRANSFERS)*(`NUM_OF_WORDS)*(`NUM_OF_SDI)); i++) begin
391393
if (sdi_lane_mask[i%(`NUM_OF_SDI)]) begin
394+
sdi_read_data[k] = base_env.ddr.agent.mem_model.backdoor_memory_read_4byte(xil_axi_uint'(`DDR_BA + 4*i));
392395
if (sdi_read_data[k] != sdi_read_data_store[k]) begin //one word at a time comparison
393396
`INFO(("sdi_read_data[%d]: %x; sdi_read_data_store[%d]: %x",
394397
k, sdi_read_data[k],

testbenches/ip/spi_engine/tests/test_program.sv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,12 +431,12 @@ program test_program (
431431
// Generate a FIFO transaction, write SDO first
432432
for (int i = 0; i < (`NUM_OF_WORDS); i++) begin
433433
for (int j = 0; j < (`NUM_OF_SDI); j++) begin
434-
rx_data[j] = sdo_lane_mask[j] ? {$urandom} : `SDO_IDLE_STATE;
434+
rx_data[j] = sdo_lane_mask[j] ? $urandom : `SDO_IDLE_STATE;
435435
sdi_fifo_data_store[i * (`NUM_OF_SDI) + j] = rx_data[j];
436436
end
437437

438438
for (int j = 0; j < num_of_active_sdo_lanes; j++) begin
439-
tx_data[j] = {$urandom};
439+
tx_data[j] = $urandom;
440440
tx_data_cast[j] = tx_data[j]; //a cast is necessary for the SPI API
441441
end
442442

0 commit comments

Comments
 (0)