diff --git a/ReceptionTrame_lib/receptionTrame_com.vhd b/ReceptionTrame_lib/receptionTrame_com.vhd index 3e5b3e5..4c2b689 100644 --- a/ReceptionTrame_lib/receptionTrame_com.vhd +++ b/ReceptionTrame_lib/receptionTrame_com.vhd @@ -30,7 +30,7 @@ ENTITY receptionTrame_com IS END receptionTrame_com; ARCHITECTURE arch of receptionTrame_com IS -TYPE state IS (waiting, syncBreak0, syncBreak1, syncFieldWait, syncFieldStart, syncFieldData, syncFieldStop, idFieldWait, idFieldStart, idFieldData, idFieldStop, dataFieldWait, dataFieldStart, dataFieldData, dataFieldStop); +TYPE state IS (waiting, syncBreak0, syncBreak1, syncFieldWait, syncFieldStart, syncFieldData, syncFieldStop, idFieldWait, idFieldStart, idFieldData, idFieldStop, dataFieldWait, dataFieldStart, dataFieldData, dataFieldStop, checksumFieldWait, checksumFieldStart, checksumFieldData, checksumFieldStop); SIGNAL cState, nState : state; BEGIN @@ -149,7 +149,7 @@ CASE cState IS if(n_0 = '1') then if(LinSynchro = '1') then if(nbData_0 = '1') then - nState <= waiting; + nState <= checksumFieldWait; else nState <= dataFieldWait; end if; @@ -158,7 +158,30 @@ CASE cState IS end if; end if; - WHEN others => + WHEN checksumFieldWait => + if(LinSynchro = '0') then + nState <= checksumFieldStart; + end if; + + WHEN checksumFieldStart => + if(n_0 = '1') then + if(LinSynchro = '0') then + nState <= checksumFieldData; + else + nState <= waiting; + end if; + end if; + + WHEN checksumFieldData => + if(nbBit_0 = '1') then + nState <= checksumFieldStop; + end if; + + WHEN checksumFieldStop => + if(n_0 = '1') then + nState <= waiting; + end if; + end CASE; END PROCESS nStateUpd; @@ -356,8 +379,46 @@ BEGIN n_LOAD <= '0'; n_EN <= '1'; end if; + + WHEN checksumFieldWait => + if(LinSynchro = '0') then + n_SELECT <= '1'; + n_LOAD <= '1'; + end if; + + WHEN checksumFieldStart => + if(n_0 = '1') then + n_SELECT <= '0'; + n_LOAD <= '1'; + nbBit_SELECT <= '1'; + nbBit_LOAD <= '1'; + else + n_LOAD <= '0'; + n_EN <= '1'; + end if; + + WHEN checksumFieldData => + if(nbBit_0 = '1') then + n_SELECT <= '0'; + n_LOAD <= '1'; + octetRecu_EN <= '0'; + else + if(n_0 = '1') then + n_LOAD <= '1'; + n_SELECT <= '0'; + nbBit_EN <= '1'; + octetRecu_EN <= '1'; + else + n_LOAD <= '0'; + nbBIt_EN <= '0'; + octetRecu_EN <= '0'; + end if; + nbBit_LOAD <= '0'; + n_EN <= '1'; + end if; + + WHEN checksumFieldStop => - WHEN others => end CASE; END PROCESS RCS;