|
@@ -71,7 +71,7 @@ module InterfaceArbiter
|
|
|
reg dataValReg;
|
|
reg dataValReg;
|
|
|
|
|
|
|
|
reg [OUTWORDWIDTH/4-1:0] ssCnt;
|
|
reg [OUTWORDWIDTH/4-1:0] ssCnt;
|
|
|
- reg [OUTWORDWIDTH/4-1:0] wordsCnt;
|
|
|
|
|
|
|
+ reg [16:0] wordsCnt;
|
|
|
wire [OUTWORDWIDTH/4-1:0] ssCntRstThresh = (spiMode) ? QSPIWORDWIDTH-1:SSPIWORDWIDTH-1;
|
|
wire [OUTWORDWIDTH/4-1:0] ssCntRstThresh = (spiMode) ? QSPIWORDWIDTH-1:SSPIWORDWIDTH-1;
|
|
|
|
|
|
|
|
reg [16:0] wordsNum;
|
|
reg [16:0] wordsNum;
|
|
@@ -90,7 +90,7 @@ module InterfaceArbiter
|
|
|
|
|
|
|
|
//================================================================================
|
|
//================================================================================
|
|
|
// CODING
|
|
// CODING
|
|
|
- always @(posedge Sck_i) begin
|
|
|
|
|
|
|
+ always @(posedge Sck_i or posedge Rst_i) begin
|
|
|
if (!Rst_i) begin
|
|
if (!Rst_i) begin
|
|
|
if (!Ss_i) begin
|
|
if (!Ss_i) begin
|
|
|
captRegSspi <= {captRegSspi[OUTWORDWIDTH-2:0], Mosi0_i};
|
|
captRegSspi <= {captRegSspi[OUTWORDWIDTH-2:0], Mosi0_i};
|
|
@@ -110,7 +110,7 @@ module InterfaceArbiter
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
- always @(posedge Sck_i) begin
|
|
|
|
|
|
|
+ always @(posedge Sck_i or posedge Rst_i) begin
|
|
|
if (!Rst_i) begin
|
|
if (!Rst_i) begin
|
|
|
if (!Ss_i) begin
|
|
if (!Ss_i) begin
|
|
|
if (ssCnt == ssCntRstThresh) begin
|
|
if (ssCnt == ssCntRstThresh) begin
|
|
@@ -124,7 +124,7 @@ module InterfaceArbiter
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
- always @(posedge Clk_i) begin
|
|
|
|
|
|
|
+ always @(posedge Clk_i or posedge Rst_i) begin
|
|
|
if (!Rst_i) begin
|
|
if (!Rst_i) begin
|
|
|
if (currState == DATARX) begin
|
|
if (currState == DATARX) begin
|
|
|
if (ssPos) begin
|
|
if (ssPos) begin
|
|
@@ -146,7 +146,7 @@ module InterfaceArbiter
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
- always @(posedge Clk_i) begin
|
|
|
|
|
|
|
+ always @(posedge Sck_i or posedge Rst_i) begin
|
|
|
if (!Rst_i) begin
|
|
if (!Rst_i) begin
|
|
|
if (currState == IDLE) begin
|
|
if (currState == IDLE) begin
|
|
|
if (ssCnt == 1) begin
|
|
if (ssCnt == 1) begin
|
|
@@ -162,7 +162,7 @@ module InterfaceArbiter
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
- always @(posedge Clk_i) begin
|
|
|
|
|
|
|
+ always @(posedge Clk_i or posedge Rst_i) begin
|
|
|
if (!Rst_i) begin
|
|
if (!Rst_i) begin
|
|
|
if (currState == IDLE) begin
|
|
if (currState == IDLE) begin
|
|
|
if (!spiMode) begin
|
|
if (!spiMode) begin
|
|
@@ -176,7 +176,7 @@ module InterfaceArbiter
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
- always @(posedge Clk_i) begin
|
|
|
|
|
|
|
+ always @(posedge Clk_i or posedge Rst_i) begin
|
|
|
if (!Rst_i) begin
|
|
if (!Rst_i) begin
|
|
|
ssReg <= Ss_i;
|
|
ssReg <= Ss_i;
|
|
|
ssRegR <= ssReg;
|
|
ssRegR <= ssReg;
|
|
@@ -190,7 +190,7 @@ module InterfaceArbiter
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
- always @(posedge Clk_i) begin
|
|
|
|
|
|
|
+ always @(posedge Clk_i or posedge Rst_i) begin
|
|
|
if (!Rst_i) begin
|
|
if (!Rst_i) begin
|
|
|
if (ssPos) begin
|
|
if (ssPos) begin
|
|
|
dataRegSSpi <= captRegSspi;
|
|
dataRegSSpi <= captRegSspi;
|
|
@@ -206,16 +206,16 @@ module InterfaceArbiter
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
- always @(posedge Clk_i) begin
|
|
|
|
|
- if (Rst_i) begin
|
|
|
|
|
- currState <= IDLE;
|
|
|
|
|
- end else begin
|
|
|
|
|
- currState <= nextState;
|
|
|
|
|
|
|
+ always @(posedge Clk_i or posedge Rst_i) begin
|
|
|
|
|
+ if (Rst_i) begin
|
|
|
|
|
+ currState <= IDLE;
|
|
|
|
|
+ end else begin
|
|
|
|
|
+ currState <= nextState;
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
always @(*) begin
|
|
always @(*) begin
|
|
|
- nextState = IDLE;
|
|
|
|
|
|
|
+ nextState = IDLE;
|
|
|
case(currState)
|
|
case(currState)
|
|
|
IDLE :begin
|
|
IDLE :begin
|
|
|
if (ssPosR) begin
|
|
if (ssPosR) begin
|