Line 142... |
Line 142... |
next_processRxBitRdy <= 1'b1;
|
next_processRxBitRdy <= 1'b1;
|
NextState_prRxBit <= `WAIT_BITS;
|
NextState_prRxBit <= `WAIT_BITS;
|
end
|
end
|
`WAIT_BITS:
|
`WAIT_BITS:
|
begin
|
begin
|
if ((processRxBitsWEn == 1'b1) && (RXBitStMachCurrState == `WAIT_RESUME_ST))
|
if ((processRxBitsWEn == 1'b1) && (RXBitStMachCurrState == `DATA_RECEIVE_BIT_ST))
|
begin
|
begin
|
NextState_prRxBit <= `RES_RX_CHK;
|
NextState_prRxBit <= `DATA_RX_CHK_SE0;
|
next_RxBits <= RxBitsIn;
|
next_RxBits <= RxBitsIn;
|
next_processRxBitRdy <= 1'b0;
|
next_processRxBitRdy <= 1'b0;
|
end
|
end
|
else if ((processRxBitsWEn == 1'b1) && (RXBitStMachCurrState == `DATA_RECEIVE_BIT_ST))
|
else if ((processRxBitsWEn == 1'b1) && (RXBitStMachCurrState == `WAIT_RESUME_ST))
|
begin
|
begin
|
NextState_prRxBit <= `DATA_RX_CHK_SE0;
|
NextState_prRxBit <= `RES_RX_CHK;
|
next_RxBits <= RxBitsIn;
|
next_RxBits <= RxBitsIn;
|
next_processRxBitRdy <= 1'b0;
|
next_processRxBitRdy <= 1'b0;
|
end
|
end
|
else if ((processRxBitsWEn == 1'b1) && (RXBitStMachCurrState == `IDLE_BIT_ST))
|
else if ((processRxBitsWEn == 1'b1) && (RXBitStMachCurrState == `RESUME_END_WAIT_ST))
|
begin
|
begin
|
NextState_prRxBit <= `IDLE_CHK_KBIT;
|
NextState_prRxBit <= `RES_END_CHK1;
|
next_RxBits <= RxBitsIn;
|
next_RxBits <= RxBitsIn;
|
next_processRxBitRdy <= 1'b0;
|
next_processRxBitRdy <= 1'b0;
|
end
|
end
|
else if ((processRxBitsWEn == 1'b1) && (RXBitStMachCurrState == `RESUME_END_WAIT_ST))
|
else if ((processRxBitsWEn == 1'b1) && (RXBitStMachCurrState == `IDLE_BIT_ST))
|
begin
|
begin
|
NextState_prRxBit <= `RES_END_CHK1;
|
NextState_prRxBit <= `IDLE_CHK_KBIT;
|
next_RxBits <= RxBitsIn;
|
next_RxBits <= RxBitsIn;
|
next_processRxBitRdy <= 1'b0;
|
next_processRxBitRdy <= 1'b0;
|
end
|
end
|
end
|
end
|
`IDLE_FIRST_BIT:
|
`IDLE_FIRST_BIT:
|
begin
|
begin
|
next_processRxByteWEn <= 1'b0;
|
next_processRxByteWEn <= 1'b0;
|
next_RXBitStMachCurrState <= `DATA_RECEIVE_BIT_ST;
|
next_RXBitStMachCurrState <= `DATA_RECEIVE_BIT_ST;
|
next_RXSameBitCount <= 4'h1;
|
next_RXSameBitCount <= 4'h0;
|
next_RXBitCount <= 4'h1;
|
next_RXBitCount <= 4'h1;
|
next_oldRXBits <= RxBits;
|
next_oldRXBits <= RxBits;
|
//zero is always the first RZ data bit of a new packet
|
//zero is always the first RZ data bit of a new packet
|
next_RXByte <= 8'h00;
|
next_RXByte <= 8'h00;
|
NextState_prRxBit <= `WAIT_BITS;
|
NextState_prRxBit <= `WAIT_BITS;
|
Line 224... |
Line 224... |
NextState_prRxBit <= `DATA_RX_DATA_DESTUFF;
|
NextState_prRxBit <= `DATA_RX_DATA_DESTUFF;
|
if (RxBits == oldRXBits) //if the current 'RxBits' are the same as the old 'RxBits', then
|
if (RxBits == oldRXBits) //if the current 'RxBits' are the same as the old 'RxBits', then
|
begin
|
begin
|
next_RXSameBitCount <= RXSameBitCount + 1'b1;
|
next_RXSameBitCount <= RXSameBitCount + 1'b1;
|
//inc 'RXSameBitCount'
|
//inc 'RXSameBitCount'
|
if (RXSameBitCount == `MAX_CONSEC_SAME_BITS) //if 'RXSameBitCount' == 7 there has been a bit stuff error
|
if (RXSameBitCount == `MAX_CONSEC_SAME_BITS) //if 'RXSameBitCount' == 6 there has been a bit stuff error
|
next_bitStuffError <= 1'b1;
|
next_bitStuffError <= 1'b1;
|
//flag 'bitStuffError'
|
//flag 'bitStuffError'
|
else //else no bit stuffing error
|
else //else no bit stuffing error
|
begin
|
begin
|
next_RXBitCount <= RXBitCount + 1'b1;
|
next_RXBitCount <= RXBitCount + 1'b1;
|
if (RXBitCount != 4'h7) begin
|
if (RXBitCount != `MAX_CONSEC_SAME_BITS_PLUS1) begin
|
next_processRxBitRdy <= 1'b1;
|
next_processRxBitRdy <= 1'b1;
|
//early indication of ready
|
//early indication of ready
|
end
|
end
|
next_RXByte <= { 1'b1, RXByte[7:1]};
|
next_RXByte <= { 1'b1, RXByte[7:1]};
|
//RZ bit <= 1 (ie no change in 'RxBits')
|
//RZ bit <= 1 (ie no change in 'RxBits')
|
Line 250... |
Line 250... |
//early indication of ready
|
//early indication of ready
|
end
|
end
|
next_RXByte <= {1'b0, RXByte[7:1]};
|
next_RXByte <= {1'b0, RXByte[7:1]};
|
//RZ bit <= 0 (ie current'RxBits' is different than old 'RxBits')
|
//RZ bit <= 0 (ie current'RxBits' is different than old 'RxBits')
|
end
|
end
|
next_RXSameBitCount <= 4'h1;
|
next_RXSameBitCount <= 4'h0;
|
//reset 'RXSameBitCount'
|
//reset 'RXSameBitCount'
|
end
|
end
|
next_oldRXBits <= RxBits;
|
next_oldRXBits <= RxBits;
|
end
|
end
|
end
|
end
|