From d5db786a32a3b4b57e0dd0902583518ae5a5efed Mon Sep 17 00:00:00 2001 From: bacon Date: Mon, 19 May 2025 08:32:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tb/shinTest/ShinTopSpiTb.v | 90 ++++++++------------------------------ 1 file changed, 18 insertions(+), 72 deletions(-) diff --git a/tb/shinTest/ShinTopSpiTb.v b/tb/shinTest/ShinTopSpiTb.v index f1ff53f..74a0d58 100644 --- a/tb/shinTest/ShinTopSpiTb.v +++ b/tb/shinTest/ShinTopSpiTb.v @@ -208,7 +208,7 @@ initial begin #240 reset <= 0; -#10000000 +#20000000 $display("Time Out !!!"); $fclose(spidata_file); $stop; @@ -383,25 +383,20 @@ task spi_trans( input [15:0] saddress, input [7:0] scmd, input [12:0] slength,in $fwrite(spidata_file, "T:%2tns \tdev:%4d, addr:0x%02h%02h, %s, len:%4d\n", $time/1000, sidx, txBuf[1], txBuf[0], ((txBuf[2] == 0)? "Write":" Read"), slength); - if (scmd == 0) begin - for (integer i=0; i>>嗅探前,检查链路状态寄存器"); //spi_trans( (16'h00c0), (`SPI_READ), (6), (`IF_IDX(0)) ); - txBuf[0+3] = 8'h00; - txBuf[1+3] = 8'h00; - txBuf[2+3] = 8'h00; - txBuf[3+3] = 8'h00; - txBuf[4+3] = 8'h00; - txBuf[5+3] = 8'h00; spi_trans( (16'h00c0), (`SPI_READ), (6), (`IF_IDX(1)) ); - txBuf[0+3] = 8'h00; - txBuf[1+3] = 8'h00; - txBuf[2+3] = 8'h00; - txBuf[3+3] = 8'h00; - txBuf[4+3] = 8'h00; - txBuf[5+3] = 8'h00; spi_trans( (16'h00c0), (`SPI_READ), (6), (`IF_IDX(2)) ); - txBuf[0+3] = 8'h00; - txBuf[1+3] = 8'h00; - txBuf[2+3] = 8'h00; - txBuf[3+3] = 8'h00; - txBuf[4+3] = 8'h00; - txBuf[5+3] = 8'h00; spi_trans( (16'h00c0), (`SPI_READ), (6), (`IF_IDX(3)) ); - txBuf[0+3] = 8'h00; - txBuf[1+3] = 8'h00; - txBuf[2+3] = 8'h00; - txBuf[3+3] = 8'h00; - txBuf[4+3] = 8'h00; - txBuf[5+3] = 8'h00; spi_trans( (16'h00c0), (`SPI_READ), (6), (`IF_IDX(4)) ); $fdisplay(spidata_file, "--->>>嗅探"); @@ -523,13 +495,11 @@ initial begin //无子报文 txBuf[0+3] = 8'h00; - txBuf[1+3] = 8'h01;//heeader length 0 嗅探包1 + txBuf[1+3] = 8'h01;//header length 0 嗅探包1 txBuf[2+3] = 8'h3f; txBuf[3+3] = 8'hff; spi_trans( (16'h1000), (`SPI_WRITE), (4), (`IF_IDX(0)) ); //写入SM1 - - //发布请求 txBuf[0+3] = 8'h04; txBuf[1+3] = 8'h00; @@ -551,33 +521,9 @@ initial begin #50000 $fdisplay(spidata_file, "--->>>嗅探后,检查链路状态寄存器"); //spi_trans( (16'h00c0), (`SPI_READ), (6), (`IF_IDX(0)) ); - txBuf[0+3] = 8'h00; - txBuf[1+3] = 8'h00; - txBuf[2+3] = 8'h00; - txBuf[3+3] = 8'h00; - txBuf[4+3] = 8'h00; - txBuf[5+3] = 8'h00; spi_trans( (16'h00c0), (`SPI_READ), (6), (`IF_IDX(1)) ); - txBuf[0+3] = 8'h00; - txBuf[1+3] = 8'h00; - txBuf[2+3] = 8'h00; - txBuf[3+3] = 8'h00; - txBuf[4+3] = 8'h00; - txBuf[5+3] = 8'h00; spi_trans( (16'h00c0), (`SPI_READ), (6), (`IF_IDX(2)) ); - txBuf[0+3] = 8'h00; - txBuf[1+3] = 8'h00; - txBuf[2+3] = 8'h00; - txBuf[3+3] = 8'h00; - txBuf[4+3] = 8'h00; - txBuf[5+3] = 8'h00; spi_trans( (16'h00c0), (`SPI_READ), (6), (`IF_IDX(3)) ); - txBuf[0+3] = 8'h00; - txBuf[1+3] = 8'h00; - txBuf[2+3] = 8'h00; - txBuf[3+3] = 8'h00; - txBuf[4+3] = 8'h00; - txBuf[5+3] = 8'h00; spi_trans( (16'h00c0), (`SPI_READ), (6), (`IF_IDX(4)) );