修改spitb clk, 可以测试cdr的偏移
This commit is contained in:
@@ -505,13 +505,13 @@ always @(negedge reset) begin
|
|||||||
_reset_deactive <= 1'b1;
|
_reset_deactive <= 1'b1;
|
||||||
end
|
end
|
||||||
|
|
||||||
`define SCKFRE #64000000
|
`define SCKFRE 64000000
|
||||||
|
|
||||||
reg sck = 0;
|
reg sck = 0;
|
||||||
|
|
||||||
initial begin
|
initial begin
|
||||||
forever begin
|
forever begin
|
||||||
`SCKFRE sck <= ~sck;
|
#`SCKFRE sck <= ~sck;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -607,6 +607,15 @@ always @(negedge sck) begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
//输入
|
||||||
|
always @(negedge sck) begin
|
||||||
|
if( isBusy ) begin
|
||||||
|
if( transCnt == length & &bitCnt ) begin
|
||||||
|
spi_csn[idx] <= #(`SCKFRE/2) 1'b1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
//输入
|
//输入
|
||||||
always @(posedge sck) begin
|
always @(posedge sck) begin
|
||||||
if( isBusy ) begin
|
if( isBusy ) begin
|
||||||
@@ -651,7 +660,6 @@ always @(posedge sck) begin
|
|||||||
end
|
end
|
||||||
end else begin
|
end else begin
|
||||||
isBusy <= #500000 1'b0;
|
isBusy <= #500000 1'b0;
|
||||||
spi_csn[idx] <= #500000 1'b1;
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -668,7 +676,7 @@ task spi_trans( input [15:0] saddress, input [7:0] scmd, input [12:0] slength, i
|
|||||||
if (sidx >=(`ALL_DEV_NUM * 3)) begin
|
if (sidx >=(`ALL_DEV_NUM * 3)) begin
|
||||||
txBuf[2] <= (scmd | slength[12:8]);
|
txBuf[2] <= (scmd | slength[12:8]);
|
||||||
txBuf[3] <= slength[7:0];
|
txBuf[3] <= slength[7:0];
|
||||||
length <= slength + 4;
|
length <= slength + 4 + 1;
|
||||||
end else begin
|
end else begin
|
||||||
txBuf[2] <= scmd;
|
txBuf[2] <= scmd;
|
||||||
length <= slength + 3;
|
length <= slength + 3;
|
||||||
@@ -685,6 +693,7 @@ task spi_trans( input [15:0] saddress, input [7:0] scmd, input [12:0] slength, i
|
|||||||
@( negedge isBusy) #100000000
|
@( negedge isBusy) #100000000
|
||||||
begin
|
begin
|
||||||
//$fwrite(spidata_file, "------------%5t------------\n", $realtime);
|
//$fwrite(spidata_file, "------------%5t------------\n", $realtime);
|
||||||
|
if (sidx >=(`ALL_DEV_NUM * 3)) begin
|
||||||
$fwrite(spidata_file, "T:%t \tdev:%4d(%4d), addr:0x%02h%02h, %s, len:%4d (0x%02h%02h)\n",
|
$fwrite(spidata_file, "T:%t \tdev:%4d(%4d), addr:0x%02h%02h, %s, len:%4d (0x%02h%02h)\n",
|
||||||
$realtime,
|
$realtime,
|
||||||
sidx % (`ALL_DEV_NUM), sidx,
|
sidx % (`ALL_DEV_NUM), sidx,
|
||||||
@@ -693,6 +702,15 @@ task spi_trans( input [15:0] saddress, input [7:0] scmd, input [12:0] slength, i
|
|||||||
(((txBuf[2] & 8'h80) == 0)? "Write":" Read"),
|
(((txBuf[2] & 8'h80) == 0)? "Write":" Read"),
|
||||||
slength,
|
slength,
|
||||||
txBuf[2], txBuf[3]);
|
txBuf[2], txBuf[3]);
|
||||||
|
end else begin
|
||||||
|
$fwrite(spidata_file, "T:%t \tdev:%4d(%4d), addr:0x%02h%02h, %s, len:%4d\n",
|
||||||
|
$realtime,
|
||||||
|
sidx % (`ALL_DEV_NUM), sidx,
|
||||||
|
txBuf[0],
|
||||||
|
txBuf[1],
|
||||||
|
(((txBuf[2] & 8'h80) == 0)? "Write":" Read"),
|
||||||
|
slength);
|
||||||
|
end
|
||||||
|
|
||||||
if (sidx >=(`ALL_DEV_NUM * 3)) begin _pos = 4; end
|
if (sidx >=(`ALL_DEV_NUM * 3)) begin _pos = 4; end
|
||||||
else begin _pos = 3; end
|
else begin _pos = 3; end
|
||||||
|
|||||||
Reference in New Issue
Block a user