Merge branch 'feature/ShinTop' of github.com:whutddk/RISCV-MAC-SWICH into feature/ShinTop
This commit is contained in:
@@ -438,8 +438,9 @@ initial begin
|
||||
|
||||
#1000
|
||||
$fdisplay(spidata_file, "测试用例1-从IP中读取寄存器,上电后的寄存器期望值为0");
|
||||
spi_trans( (16'h00), (`SPI_READ), (1024), (`IF_IQSPI(0)) );
|
||||
spi_trans( (16'h400), (`SPI_READ), (1024), (`IF_IQSPI(0)) );
|
||||
//spi_trans( (16'h00), (`SPI_READ), (1024), (`IF_IQSPI(0)) );
|
||||
//spi_trans( (16'h400), (`SPI_READ), (1024), (`IF_IQSPI(0)) );
|
||||
spi_trans( (16'h00), (`SPI_READ), (64), (`IF_IQSPI(0)) );
|
||||
spi_trans( (16'h00), (`SPI_READ), (64), (`IF_IQSPI(1)) );
|
||||
spi_trans( (16'h00), (`SPI_READ), (64), (`IF_IQSPI(2)) );
|
||||
spi_trans( (16'h00), (`SPI_READ), (64), (`IF_IQSPI(3)) );
|
||||
@@ -514,10 +515,7 @@ initial begin
|
||||
spi_trans( (16'h0306), (`SPI_WRITE), (2), (`IF_IDX(0)) );
|
||||
|
||||
//无子报文
|
||||
txBuf[0+3] = 8'h00;
|
||||
txBuf[1+3] = 8'h01;//header length 0 嗅探包1
|
||||
txBuf[2+3] = 8'h3f;
|
||||
txBuf[3+3] = 8'hff;
|
||||
`include "detect_pkt.vh"
|
||||
spi_trans( (16'h1000), (`SPI_WRITE), (4), (`IF_IDX(0)) ); //写入SM1
|
||||
|
||||
//发布请求
|
||||
@@ -598,11 +596,11 @@ initial begin
|
||||
|
||||
|
||||
//测试
|
||||
spi_trans( (16'hc0), (`SPI_READ), (6), (3) );
|
||||
spi_trans( (16'h0a), (`SPI_READ), (2), (1) );
|
||||
spi_trans( (16'h0a), (`SPI_READ), (2), (2) );
|
||||
spi_trans( (16'h0a), (`SPI_READ), (2), (3) );
|
||||
spi_trans( (16'h0a), (`SPI_READ), (2), (4) );
|
||||
spi_trans( (16'hc0), (`SPI_READ), (6), (`IF_IDX(3)) );
|
||||
spi_trans( (16'h0a), (`SPI_READ), (2), (`IF_IDX(1)) );
|
||||
spi_trans( (16'h0a), (`SPI_READ), (2), (`IF_IDX(2)) );
|
||||
spi_trans( (16'h0a), (`SPI_READ), (2), (`IF_IDX(3)) );
|
||||
spi_trans( (16'h0a), (`SPI_READ), (2), (`IF_IDX(4)) );
|
||||
|
||||
|
||||
//读写
|
||||
@@ -627,79 +625,7 @@ initial begin
|
||||
spi_trans( (16'h0302), (`SPI_WRITE), (2), (`IF_IDX(0)) );
|
||||
spi_trans( (16'h0306), (`SPI_WRITE), (2), (`IF_IDX(0)) );
|
||||
|
||||
|
||||
txBuf[0+3] = 8'h20;
|
||||
txBuf[1+3] = 8'h00;//heeader length 512
|
||||
txBuf[2+3] = 8'h00;
|
||||
txBuf[3+3] = 8'h00;
|
||||
|
||||
//子报文
|
||||
txBuf[4+3] = 8'h0;
|
||||
txBuf[5+3] = 8'h8; //index = 2
|
||||
txBuf[6+3] = 8'h08; //地址 //SM0
|
||||
txBuf[7+3] = 8'h30; //地址 //偏置
|
||||
txBuf[8+3] = 8'h20; //命令2 长度56
|
||||
txBuf[9+3] = 8'd56; //长度
|
||||
txBuf[10+3] = $random;
|
||||
txBuf[11+3] = $random;
|
||||
|
||||
for( integer j = 0; j < 64-8; j = j + 1 ) begin
|
||||
@(posedge clock) #3
|
||||
txBuf[12+3+j] = $random;
|
||||
end
|
||||
|
||||
//-------------------------
|
||||
|
||||
//子报文
|
||||
txBuf[68+3] = 8'h0;
|
||||
txBuf[69+3] = 8'h4; //index = 1
|
||||
txBuf[70+3] = 8'h08; //地址 //SM0
|
||||
txBuf[71+3] = 8'h40; //地址 //偏置
|
||||
txBuf[72+3] = 8'h10; //命令1 长度56
|
||||
txBuf[73+3] = 8'd56; //长度
|
||||
txBuf[74+3] = $random;
|
||||
txBuf[75+3] = $random;
|
||||
|
||||
for( integer j = 0; j < 64-8; j = j + 1 ) begin
|
||||
@(posedge clock) #3
|
||||
txBuf[76+3+j] = $random;
|
||||
end
|
||||
|
||||
//-------------------------
|
||||
|
||||
//子报文
|
||||
txBuf[132+3] = 8'h0;
|
||||
txBuf[133+3] = 8'hc; //index = 3
|
||||
txBuf[134+3] = 8'h10; //地址 //SM1
|
||||
txBuf[135+3] = 8'h40; //地址 //偏置
|
||||
txBuf[136+3] = 8'h00; //命令0 长度56
|
||||
txBuf[137+3] = 8'd56; //长度
|
||||
txBuf[138+3] = $random;
|
||||
txBuf[139+3] = $random;
|
||||
|
||||
for( integer j = 0; j < 64-8; j = j + 1 ) begin
|
||||
@(posedge clock) #3
|
||||
txBuf[140+3+j] = $random;
|
||||
end
|
||||
|
||||
//-------------------------
|
||||
|
||||
for( integer i = 0 ; i < 5; i = i + 1) begin
|
||||
//子报文
|
||||
txBuf[196+3+i*64+0] = $random;
|
||||
txBuf[196+3+i*64+1] = 8'h0; //index = random
|
||||
txBuf[196+3+i*64+2] = $random;
|
||||
txBuf[196+3+i*64+3] = $random;
|
||||
txBuf[196+3+i*64+4] = 8'h00; //命令0 长度56
|
||||
txBuf[196+3+i*64+5] = 8'd56; //长度
|
||||
txBuf[196+3+i*64+6] = $random;
|
||||
txBuf[196+3+i*64+7] = $random;
|
||||
|
||||
for( integer j = 0; j < 64-8; j = j + 1 ) begin
|
||||
@(posedge clock) #3
|
||||
txBuf[196+3+i*64+8+j] = $random;
|
||||
end
|
||||
end
|
||||
`include "seq_pkt.vh"
|
||||
spi_trans( (16'h1000), (`SPI_WRITE), (516), (`IF_IDX(0)) ); //写入SM1
|
||||
|
||||
|
||||
@@ -741,36 +667,7 @@ initial begin
|
||||
spi_trans( (16'h0302), (`SPI_WRITE), (2), (`IF_IDX(0)) );
|
||||
spi_trans( (16'h0306), (`SPI_WRITE), (2), (`IF_IDX(0)) );
|
||||
|
||||
txBuf[0+3] = 8'h01;
|
||||
txBuf[1+3] = 8'h40;//heeader length 20
|
||||
txBuf[2+3] = 8'h00;
|
||||
txBuf[3+3] = 8'h00;
|
||||
|
||||
//子报文
|
||||
//设置同步
|
||||
txBuf[4+3] = 8'h0; //设备索引
|
||||
txBuf[5+3] = 8'h0; //设备索引、类型
|
||||
txBuf[6+3] = $random; //地址
|
||||
txBuf[7+3] = $random; //地址
|
||||
txBuf[8+3] = 8'he0; //命令d 负载长度2
|
||||
txBuf[9+3] = 8'h0c; //负载长度c
|
||||
txBuf[10+3] = 8'h0; //工作计数0
|
||||
txBuf[11+3] = 8'h0; //工作计数0
|
||||
|
||||
txBuf[12+3] = 0;//timeStamp[7:0]; //负载
|
||||
txBuf[13+3] = 0;//timeStamp[15:8]; //负载
|
||||
txBuf[14+3] = 0;//timeStamp[23:16]; //负载
|
||||
txBuf[15+3] = 0;//timeStamp[31:24]; //负载
|
||||
txBuf[16+3] = 0;//timeStamp[39:32]; //负载
|
||||
txBuf[17+3] = 0;//timeStamp[47:40]; //负载
|
||||
txBuf[18+3] = 0;//timeStamp[55:48]; //负载
|
||||
txBuf[19+3] = 0;//timeStamp[63:56]; //负载
|
||||
|
||||
txBuf[20+3] = 0;//s_ShinTop_Mst.masterParser.deltaTimeStamp[ 7: 0]; //负载
|
||||
txBuf[21+3] = 0;//s_ShinTop_Mst.masterParser.deltaTimeStamp[15: 8]; //负载
|
||||
txBuf[22+3] = 0;//s_ShinTop_Mst.masterParser.deltaTimeStamp[23:16]; //负载
|
||||
txBuf[23+3] = 0;//s_ShinTop_Mst.masterParser.deltaTimeStamp[31:24]; //负载
|
||||
|
||||
`include "sync_pkt.vh"
|
||||
spi_trans( (16'h1000), (`SPI_WRITE), (24), (`IF_IDX(0)) ); //写入SM1
|
||||
|
||||
//写入替换时间戳替换地址
|
||||
@@ -801,89 +698,7 @@ initial begin
|
||||
spi_trans( (16'h0302), (`SPI_WRITE), (2), (`IF_IDX(0)) );
|
||||
spi_trans( (16'h0306), (`SPI_WRITE), (2), (`IF_IDX(0)) );
|
||||
|
||||
//header
|
||||
txBuf[0+3] = 8'h03;
|
||||
txBuf[1+3] = 8'h00;//heeader length 48
|
||||
txBuf[2+3] = 8'h00;
|
||||
txBuf[3+3] = 8'h00;
|
||||
|
||||
//子报文
|
||||
//设置同步相关寄存器
|
||||
txBuf[4+3] = 8'h0; //设备索引
|
||||
txBuf[5+3] = 8'h08; //设备索引、类型 //2号设备
|
||||
txBuf[6+3] = 8'h01; //地址
|
||||
txBuf[7+3] = 8'h20; //地址 0x120
|
||||
txBuf[8+3] = 8'h10; //命令1 写入寄存器 负载长度2
|
||||
txBuf[9+3] = 8'h28; //负载长度0x28
|
||||
txBuf[10+3] = 8'h0; //工作计数0
|
||||
txBuf[11+3] = 8'h0; //工作计数0
|
||||
|
||||
// txBuf[12+3] = 8'h0f; //负载0x120 0x0f 全部脉冲,全部使能
|
||||
// txBuf[13+3] = 0; //负载0x121
|
||||
// txBuf[14+3] = 10; //负载0x122 sync0脉冲宽度 10
|
||||
// txBuf[15+3] = 0; //负载0x123
|
||||
// txBuf[16+3] = 0; //负载0x124 sync1脉冲宽度 0
|
||||
// txBuf[17+3] = 0; //负载0x125
|
||||
// txBuf[18+3] = 1; //负载0x126 sync2脉冲宽度 1
|
||||
// txBuf[19+3] = 0; //负载0x127
|
||||
// txBuf[20+3] = 8'hff; //负载0x128 sync3脉冲宽度 最大
|
||||
// txBuf[21+3] = 8'hff; //负载0x129
|
||||
|
||||
|
||||
txBuf[12+3] = 8'hff; //负载0x120 0xff 全部电平,全部使能
|
||||
txBuf[13+3] = 0; //负载0x121
|
||||
|
||||
txBuf[14+3] = 0; //负载0x122 sync0脉冲宽度
|
||||
txBuf[15+3] = 0; //负载0x123
|
||||
txBuf[16+3] = 0; //负载0x124 sync1脉冲宽度
|
||||
txBuf[17+3] = 0; //负载0x125
|
||||
txBuf[18+3] = 0; //负载0x126 sync2脉冲宽度
|
||||
txBuf[19+3] = 0; //负载0x127
|
||||
txBuf[20+3] = 0; //负载0x128 sync3脉冲宽度
|
||||
txBuf[21+3] = 0; //负载0x129
|
||||
|
||||
txBuf[22+3] = 0; //负载0x12a empty
|
||||
txBuf[23+3] = 0; //负载0x12b
|
||||
txBuf[24+3] = 0; //负载0x12c
|
||||
txBuf[25+3] = 0; //负载0x12d
|
||||
txBuf[26+3] = 0; //负载0x12e
|
||||
txBuf[27+3] = 0; //负载0x12f
|
||||
|
||||
//同步点
|
||||
txBuf[28+3] = 8'h90; //负载0x130 同步点
|
||||
txBuf[29+3] = 8'h88; //负载0x131
|
||||
txBuf[30+3] = 0; //负载0x132
|
||||
txBuf[31+3] = 0; //负载0x133
|
||||
txBuf[32+3] = 0; //负载0x134
|
||||
txBuf[33+3] = 0; //负载0x135
|
||||
txBuf[34+3] = 0; //负载0x136
|
||||
txBuf[35+3] = 0; //负载0x137
|
||||
|
||||
//周期
|
||||
txBuf[36+3] = 8'hff; //负载0x138
|
||||
txBuf[37+3] = 8'hf; //负载0x139
|
||||
txBuf[38+3] = 0; //负载0x13a
|
||||
txBuf[39+3] = 0; //负载0x13b
|
||||
|
||||
//0ffset sync1
|
||||
txBuf[40+3] = 8'ha; //负载0x13c
|
||||
txBuf[41+3] = 0; //负载0x13d
|
||||
txBuf[42+3] = 0; //负载0x13e
|
||||
txBuf[43+3] = 0; //负载0x13f
|
||||
|
||||
//0ffset sync2
|
||||
txBuf[44+3] = 8'h0; //负载0x140
|
||||
txBuf[45+3] = 0; //负载0x141
|
||||
txBuf[46+3] = 0; //负载0x142
|
||||
txBuf[47+3] = 0; //负载0x143
|
||||
|
||||
//0ffset sync3
|
||||
txBuf[48+3] = 8'h0; //负载0x144
|
||||
txBuf[49+3] = 8'h01; //负载0x145
|
||||
txBuf[50+3] = 0; //负载0x146
|
||||
txBuf[51+3] = 0; //负载0x147
|
||||
|
||||
|
||||
`include "sync_sig_pkt.vh"
|
||||
spi_trans( (16'h1000), (`SPI_WRITE), (52), (`IF_IDX(0)) ); //写入SM1
|
||||
|
||||
//发布请求
|
||||
|
||||
Reference in New Issue
Block a user