修正自动添加从站设备的测试用例
This commit is contained in:
@@ -523,8 +523,9 @@ always @(posedge clock) begin
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
wire isQspi = (idx >= 0 && idx <= 4) || idx >= 10;
|
||||
//DEV_NUM
|
||||
//ALL_DEV_NUM
|
||||
wire isQspi = (idx >= 0 && idx <= (`ALL_DEV_NUM - 1)) || idx >= (`ALL_DEV_NUM * 2);
|
||||
wire [11:0] nextByteCnt = byteCnt + 1;
|
||||
|
||||
//输出
|
||||
@@ -594,7 +595,7 @@ task spi_trans( input [15:0] saddress, input [7:0] scmd, input [12:0] slength,in
|
||||
begin
|
||||
//$fwrite(spidata_file, "------------%5t------------\n", $realtime);
|
||||
$fwrite(spidata_file, "T:%t \tdev:%4d, addr:0x%02h%02h, %s, len:%4d\n",
|
||||
$realtime, ((sidx >= 5)? ((sidx >= 10)? (sidx - 10):(sidx - 5)):sidx), txBuf[0], txBuf[1],
|
||||
$realtime, ((sidx >= `ALL_DEV_NUM)? ((sidx >= (`ALL_DEV_NUM * 2))? (sidx - (`ALL_DEV_NUM * 2)):(sidx - `ALL_DEV_NUM)):sidx), txBuf[0], txBuf[1],
|
||||
((txBuf[2] == 0)? "Write":" Read"), slength);
|
||||
|
||||
if ( ((saddress == 16'h0800)
|
||||
@@ -605,7 +606,7 @@ task spi_trans( input [15:0] saddress, input [7:0] scmd, input [12:0] slength,in
|
||||
|| (saddress == 16'h3000)
|
||||
|| (saddress == 16'h3800)
|
||||
|| (saddress == 16'h4000))
|
||||
&& ((sidx == 0) || (sidx == 5) || (sidx == 10))) begin
|
||||
&& ((sidx == 0) || (sidx == `ALL_DEV_NUM) || (sidx == (`ALL_DEV_NUM * 2)))) begin
|
||||
_pos = 3;
|
||||
for (integer _k = 0; _k < 4; _k++) begin
|
||||
if (scmd == 0) begin
|
||||
@@ -771,8 +772,8 @@ end
|
||||
`define INTERFACE_IDX 0 //internal spi
|
||||
`define IF_IDX(idx) ((`INTERFACE_IDX)+(idx))
|
||||
`define IF_IQSPI(idx) ((idx))
|
||||
`define IF_OQSPI(idx) ((10) + (idx))
|
||||
`define IF_OSPI(idx) ((5) + (idx))
|
||||
`define IF_OQSPI(idx) ((`ALL_DEV_NUM * 2) + (idx))
|
||||
`define IF_OSPI(idx) ((`ALL_DEV_NUM) + (idx))
|
||||
`define SPI_WRITE 8'h0
|
||||
`define SPI_READ 8'h1
|
||||
|
||||
@@ -944,7 +945,7 @@ initial begin
|
||||
`endif
|
||||
|
||||
begin:SETTING_INTERFACE
|
||||
if ((`INTERFACE_IDX) == 5) begin
|
||||
if ((`INTERFACE_IDX) == `ALL_DEV_NUM) begin
|
||||
$fdisplay(spidata_file, "\n\n从内部QSPI配置使用外部的SPI接口访问EasyBus");
|
||||
txBuf[0+3] = 8'h01;
|
||||
spi_trans( (16'h09), (`SPI_WRITE), (1), (`IF_OSPI(0)) );
|
||||
@@ -952,7 +953,7 @@ initial begin
|
||||
spi_trans( (16'h09), (`SPI_WRITE), (1), (`IF_OSPI(2)) );
|
||||
spi_trans( (16'h09), (`SPI_WRITE), (1), (`IF_OSPI(3)) );
|
||||
spi_trans( (16'h09), (`SPI_WRITE), (1), (`IF_OSPI(4)) );
|
||||
end else if ((`INTERFACE_IDX) == 10) begin
|
||||
end else if ((`INTERFACE_IDX) == (`ALL_DEV_NUM * 2)) begin
|
||||
$fdisplay(spidata_file, "\n\n从内部QSPI配置使用外部的QSPI接口访问EasyBus");
|
||||
txBuf[0+3] = 8'h02;
|
||||
spi_trans( (16'h09), (`SPI_WRITE), (1), (`IF_OSPI(0)) );
|
||||
|
||||
Reference in New Issue
Block a user