Skip to content

Commit d5db090

Browse files
committed
testbenches/ip/spi_engine: update test_program and test_slowdata
Both tests were not generic regarding the sdi_lane_mask. They were relying on the default value, which is not guaranteed that it is going to enable all lanes. Added instructions to change the sdi_lane_mask before executing the tests for the FIFO and Offload modes. Signed-off-by: Carlos Souza <[email protected]>
1 parent 2a92363 commit d5db090

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

testbenches/ip/spi_engine/tests/test_program.sv

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,11 @@ program test_program (
205205
//---------------------------------------------------------------------------
206206
task generate_transfer_cmd(
207207
input [7:0] sync_id,
208+
input [7:0] sdi_lane_mask,
208209
input [7:0] sdo_lane_mask);
209210

210211
// define spi lane mask
212+
spi_api.fifo_command(`SET_SDI_LANE_MASK(sdi_lane_mask));
211213
spi_api.fifo_command(`SET_SDO_LANE_MASK(sdo_lane_mask));
212214
// assert CSN
213215
spi_api.fifo_command(`SET_CS(8'hFE));
@@ -415,6 +417,7 @@ program test_program (
415417
//---------------------------------------------------------------------------
416418
task fifo_spi_test();
417419

420+
sdi_lane_mask = (2**`NUM_OF_SDI)-1; //new mask defining the active lanes
418421
sdo_lane_mask = (2**`NUM_OF_SDO)-1; //new mask defining the active lanes
419422
num_of_active_sdo_lanes = $countones(sdo_lane_mask);
420423

@@ -453,7 +456,7 @@ program test_program (
453456
spi_send(rx_data);
454457
end
455458

456-
generate_transfer_cmd(1, sdo_lane_mask); //generate transfer with specific spi lane mask
459+
generate_transfer_cmd(1, sdi_lane_mask, sdo_lane_mask); //generate transfer with specific spi lane mask
457460

458461
`INFO(("Waiting for SPI VIP send..."), ADI_VERBOSITY_LOW);
459462
spi_wait_send();

testbenches/ip/spi_engine/tests/test_slowdata.sv

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,14 @@ program test_slowdata (
248248

249249
task generate_single_rtransfer_cmd(
250250
input [7:0] sync_id,
251+
input [7:0] sdi_lane_mask,
251252
input [7:0] sdo_lane_mask);
252253
// configure cs
253254
if (`CS_ACTIVE_HIGH) begin
254255
spi_api.fifo_command(`SET_CS_INV_MASK(8'hFF));
255256
end
256257
// define spi lane mask
258+
spi_api.fifo_command(`SET_SDI_LANE_MASK(sdi_lane_mask));
257259
spi_api.fifo_command(`SET_SDO_LANE_MASK(sdo_lane_mask));
258260
// write cfg
259261
spi_api.fifo_command(`INST_CFG);
@@ -275,12 +277,14 @@ program test_slowdata (
275277

276278
task generate_double_rtransfer_cmd(
277279
input [7:0] sync_id,
280+
input [7:0] sdi_lane_mask,
278281
input [7:0] sdo_lane_mask);
279282
// configure cs
280283
if (`CS_ACTIVE_HIGH) begin
281284
spi_api.fifo_command(`SET_CS_INV_MASK(8'hFF));
282285
end
283286
// define spi lane mask
287+
spi_api.fifo_command(`SET_SDI_LANE_MASK(sdi_lane_mask));
284288
spi_api.fifo_command(`SET_SDO_LANE_MASK(sdo_lane_mask));
285289
// write cfg
286290
spi_api.fifo_command(`INST_CFG);
@@ -651,7 +655,7 @@ program test_slowdata (
651655
end
652656
spi_send(rx_data);
653657

654-
generate_single_rtransfer_cmd(1, sdo_lane_mask);
658+
generate_single_rtransfer_cmd(1, sdi_lane_mask, sdo_lane_mask);
655659

656660
`INFO(("Waiting for SPI VIP send..."), ADI_VERBOSITY_LOW);
657661
spi_wait_send();
@@ -693,7 +697,7 @@ program test_slowdata (
693697
spi_send(rx_data);
694698
end
695699

696-
generate_double_rtransfer_cmd(1, sdo_lane_mask);
700+
generate_double_rtransfer_cmd(1, sdi_lane_mask, sdo_lane_mask);
697701

698702
`INFO(("Waiting for SPI VIP send..."), ADI_VERBOSITY_LOW);
699703
spi_wait_send();

0 commit comments

Comments
 (0)