From 483aac6162f1614b32364df79dd1f5c1ff4d6ce6 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 26 Sep 2023 10:49:17 +0200 Subject: [PATCH] id field data --- ReceptionTrame_lib/receptionTrame_com.vhd | 85 ++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/ReceptionTrame_lib/receptionTrame_com.vhd b/ReceptionTrame_lib/receptionTrame_com.vhd index 81a3d83..a353b1b 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); +TYPE state IS (waiting, syncBreak0, syncBreak1, syncFieldWait, syncFieldStart, syncFieldData, syncFieldStop, idFieldWait, idFieldStart, idFieldData, idFieldStop); SIGNAL cState, nState : state; BEGIN @@ -97,6 +97,34 @@ CASE cState IS nState <= waiting; end if; end if; + + WHEN idFieldWait => + if(LinSynchro = '0') then + nState <= idFieldStart; + end if; + + WHEN idFieldStart => + if(n_0 = '1') then + if(LinSynchro = '0') then + nState <= idFieldData; + else + nState <= waiting; + end if; + end if; + + WHEN idFieldData => + if(nbBit_0 = '1') then + nState <= idFieldStop; + end if; + + WHEN idFieldStop => + if(n_0 = '1') then + if(LinSYnchro = '1') then + nState <= waiting; -- data frame + else + nState <= waiting; + end if; + end if; WHEN others => end CASE; @@ -112,6 +140,7 @@ BEGIN nbBit_LOAD <= '1'; nbBit_SELECT <= '0'; end IF; + WHEN syncBreak0 => if(LinSynchro = '1') then if(nbBit_0 = '1') then @@ -132,6 +161,7 @@ BEGIN n_EN <= '1'; nbBit_LOAD <= '0'; end if; + WHEN syncBreak1 => if(n_0 = '1') then if(LinSynchro = '0') then @@ -141,11 +171,13 @@ BEGIN n_LOAD <= '0'; n_EN <= '1'; end if; + WHEN syncFieldWait => if(LinSynchro = '0') then n_LOAD <= '1'; n_SELECT <= '1'; end if; + WHEN syncFieldStart => if(n_0 = '1') then if(LinSynchro = '0') then @@ -160,6 +192,7 @@ BEGIN n_LOAD <= '0'; n_EN <= '1'; end if; + WHEN syncFieldData => if(nbBit_0 = '1') then n_SELECT <= '0'; @@ -178,6 +211,56 @@ BEGIN end if; nbBit_LOAD <= '0'; end if; + + WHEN syncFieldStop => + if(n_0 = '1') then + if(LinSynchro = '1') then + + else + -- ERROR sync stop + end if; + else + n_LOAD <= '0'; + n_EN <= '1'; + end if; + + WHEN idFieldWait => + if(LinSynchro = '0') then + n_SELECT <= '1'; + n_LOAD <= '1'; + end if; + + WHEN idFieldStart => + 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 idFieldData => + 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 others => end CASE;