From 14f542a674f498d219485fa094f22814c4ad8c9b Mon Sep 17 00:00:00 2001 From: Klagarge Date: Wed, 17 Apr 2024 12:50:48 +0200 Subject: [PATCH] - --- .../charToMorseController_studentVersion.vhd | 841 +++++++++--------- 05-Morse/Morse/hds/.cache.dat | Bin 7638 -> 7638 bytes 05-Morse/Morse_test/hds/.cache.dat | Bin 5441 -> 5441 bytes 3 files changed, 431 insertions(+), 410 deletions(-) diff --git a/05-Morse/Morse/hdl/charToMorseController_studentVersion.vhd b/05-Morse/Morse/hdl/charToMorseController_studentVersion.vhd index 0ec8085..85f832e 100644 --- a/05-Morse/Morse/hdl/charToMorseController_studentVersion.vhd +++ b/05-Morse/Morse/hdl/charToMorseController_studentVersion.vhd @@ -94,432 +94,453 @@ BEGIN process(reset, clock) begin - case general_current_state is - when waitForChar => - --report "General current state is wait for char" severity note; - register1 <= SPACE; - register2 <= SPACE; - register3 <= SPACE; - register4 <= SPACE; - register5 <= SPACE; - signSendRegisters <= '0'; - if charNotReady = '0' then - general_next_state <= storeChar; - readChar <= '1'; - report "charReady" severity note; - else - general_next_state <= waitForChar; - readChar <= '0'; - --report "charNotReady" severity note; - end if; + if reset = '1' then + register1 <= SPACE; + register2 <= SPACE; + register3 <= SPACE; + register4 <= SPACE; + register5 <= SPACE; + signSendRegisters <= '0'; + elsif rising_edge(clock) then - when storeChar => - report "General current state is store char" severity note; - if isA then - register1 <= SHORT; - register2 <= LONG; - general_next_state <= sendRegisters; - report "New char: A" severity note; - elsif isB then - register1 <= LONG; - register2 <= SHORT; - register3 <= SHORT; - register4 <= SHORT; - general_next_state <= sendRegisters; - elsif isC then - register1 <= LONG; - register2 <= SHORT; - register3 <= LONG; - register4 <= SHORT; - general_next_state <= sendRegisters; - elsif isD then - register1 <= LONG; - register2 <= SHORT; - register3 <= SHORT; - general_next_state <= sendRegisters; - elsif isE then - register1 <= SHORT; - general_next_state <= sendRegisters; - report "New char: E" severity note; - elsif isF then - register1 <= SHORT; - register2 <= SHORT; - register3 <= LONG; - register4 <= SHORT; - general_next_state <= sendRegisters; - elsif isG then - register1 <= LONG; - register2 <= LONG; - register3 <= SHORT; - general_next_state <= sendRegisters; - elsif isH then - register1 <= SHORT; - register2 <= SHORT; - register3 <= SHORT; - register4 <= SHORT; - general_next_state <= sendRegisters; - elsif isI then - register1 <= SHORT; - register2 <= SHORT; - general_next_state <= sendRegisters; - report "New char: I" severity note; - elsif isJ then - register1 <= SHORT; - register2 <= LONG; - register3 <= LONG; - register4 <= LONG; - general_next_state <= sendRegisters; - elsif isK then - register1 <= LONG; - register2 <= SHORT; - register3 <= LONG; - general_next_state <= sendRegisters; - elsif isL then - register1 <= SHORT; - register2 <= LONG; - register3 <= SHORT; - register4 <= SHORT; - general_next_state <= sendRegisters; - elsif isM then - register1 <= LONG; - register2 <= LONG; - general_next_state <= sendRegisters; - report "New char: M" severity note; - elsif isN then - register1 <= LONG; - register2 <= SHORT; - general_next_state <= sendRegisters; - elsif isO then - register1 <= LONG; - register2 <= LONG; - register3 <= LONG; - general_next_state <= sendRegisters; - elsif isP then - register1 <= SHORT; - register2 <= LONG; - register3 <= LONG; - register4 <= SHORT; - general_next_state <= sendRegisters; - elsif isQ then - register1 <= LONG; - register2 <= LONG; - register3 <= SHORT; - register4 <= LONG; - general_next_state <= sendRegisters; - elsif isR then - register1 <= SHORT; - register2 <= LONG; - register3 <= SHORT; - general_next_state <= sendRegisters; - elsif isS then - register1 <= SHORT; - register2 <= SHORT; - register3 <= SHORT; - general_next_state <= sendRegisters; - elsif isT then - register1 <= LONG; - general_next_state <= sendRegisters; - report "New char: T" severity note; - elsif isU then - register1 <= SHORT; - register2 <= SHORT; - register3 <= LONG; - general_next_state <= sendRegisters; - elsif isV then - register1 <= SHORT; - register2 <= SHORT; - register3 <= SHORT; - register4 <= LONG; - general_next_state <= sendRegisters; - elsif isW then - register1 <= SHORT; - register2 <= LONG; - register3 <= LONG; - general_next_state <= sendRegisters; - elsif isX then - register1 <= LONG; - register2 <= SHORT; - register3 <= SHORT; - register4 <= LONG; - general_next_state <= sendRegisters; - elsif isY then - register1 <= LONG; - register2 <= SHORT; - register3 <= LONG; - register4 <= LONG; - general_next_state <= sendRegisters; - elsif isZ then - register1 <= LONG; - register2 <= LONG; - register3 <= SHORT; - register4 <= SHORT; - general_next_state <= sendRegisters; - elsif is0 then - register1 <= LONG; - register2 <= LONG; - register3 <= LONG; - register4 <= LONG; - register5 <= LONG; - general_next_state <= sendRegisters; - elsif is1 then - register1 <= SHORT; - register2 <= LONG; - register3 <= LONG; - register4 <= LONG; - register5 <= LONG; - general_next_state <= sendRegisters; - elsif is2 then - register1 <= SHORT; - register2 <= SHORT; - register3 <= LONG; - register4 <= LONG; - register5 <= LONG; - general_next_state <= sendRegisters; - elsif is3 then - register1 <= SHORT; - register2 <= SHORT; - register3 <= SHORT; - register4 <= LONG; - register5 <= LONG; - general_next_state <= sendRegisters; - elsif is4 then - register1 <= SHORT; - register2 <= SHORT; - register3 <= SHORT; - register4 <= SHORT; - register5 <= LONG; - general_next_state <= sendRegisters; - elsif is5 then - register1 <= SHORT; - register2 <= SHORT; - register3 <= SHORT; - register4 <= SHORT; - register5 <= SHORT; - general_next_state <= sendRegisters; - elsif is6 then - register1 <= LONG; - register2 <= SHORT; - register3 <= SHORT; - register4 <= SHORT; - register5 <= SHORT; - general_next_state <= sendRegisters; - elsif is7 then - register1 <= LONG; - register2 <= LONG; - register3 <= SHORT; - register4 <= SHORT; - register5 <= SHORT; - general_next_state <= sendRegisters; - elsif is8 then - register1 <= LONG; - register2 <= LONG; - register3 <= LONG; - register4 <= SHORT; - register5 <= SHORT; - general_next_state <= sendRegisters; - elsif is9 then - register1 <= LONG; - register2 <= LONG; - register3 <= LONG; - register4 <= LONG; - register5 <= SHORT; - general_next_state <= sendRegisters; - else + case general_current_state is + when waitForChar => + --report "General current state is wait for char" severity note; register1 <= SPACE; register2 <= SPACE; register3 <= SPACE; register4 <= SPACE; register5 <= SPACE; - general_next_state <= storeChar; - report "Char look not correct" severity warning; - end if; - signSendRegisters <= '1'; + signSendRegisters <= '0'; + if charNotReady = '0' then + general_next_state <= storeChar; + readChar <= '1'; + report "charReady" severity note; + else + general_next_state <= waitForChar; + readChar <= '0'; + --report "charNotReady" severity note; + end if; - when sendRegisters => - --report "General current state is send registers" severity note; - readChar <= '0'; - signSendRegisters <= '0'; - if signRegistersSended then - general_next_state <= sended; - report "Char is send" severity note; - end if; + when storeChar => + report "General current state is store char" severity note; + if isA then + register1 <= SHORT; + register2 <= LONG; + general_next_state <= sendRegisters; + report "New char: A" severity note; + elsif isB then + register1 <= LONG; + register2 <= SHORT; + register3 <= SHORT; + register4 <= SHORT; + general_next_state <= sendRegisters; + elsif isC then + register1 <= LONG; + register2 <= SHORT; + register3 <= LONG; + register4 <= SHORT; + general_next_state <= sendRegisters; + elsif isD then + register1 <= LONG; + register2 <= SHORT; + register3 <= SHORT; + general_next_state <= sendRegisters; + elsif isE then + register1 <= SHORT; + general_next_state <= sendRegisters; + report "New char: E" severity note; + elsif isF then + register1 <= SHORT; + register2 <= SHORT; + register3 <= LONG; + register4 <= SHORT; + general_next_state <= sendRegisters; + elsif isG then + register1 <= LONG; + register2 <= LONG; + register3 <= SHORT; + general_next_state <= sendRegisters; + elsif isH then + register1 <= SHORT; + register2 <= SHORT; + register3 <= SHORT; + register4 <= SHORT; + general_next_state <= sendRegisters; + elsif isI then + register1 <= SHORT; + register2 <= SHORT; + general_next_state <= sendRegisters; + report "New char: I" severity note; + elsif isJ then + register1 <= SHORT; + register2 <= LONG; + register3 <= LONG; + register4 <= LONG; + general_next_state <= sendRegisters; + elsif isK then + register1 <= LONG; + register2 <= SHORT; + register3 <= LONG; + general_next_state <= sendRegisters; + elsif isL then + register1 <= SHORT; + register2 <= LONG; + register3 <= SHORT; + register4 <= SHORT; + general_next_state <= sendRegisters; + elsif isM then + register1 <= LONG; + register2 <= LONG; + general_next_state <= sendRegisters; + report "New char: M" severity note; + elsif isN then + register1 <= LONG; + register2 <= SHORT; + general_next_state <= sendRegisters; + elsif isO then + register1 <= LONG; + register2 <= LONG; + register3 <= LONG; + general_next_state <= sendRegisters; + elsif isP then + register1 <= SHORT; + register2 <= LONG; + register3 <= LONG; + register4 <= SHORT; + general_next_state <= sendRegisters; + elsif isQ then + register1 <= LONG; + register2 <= LONG; + register3 <= SHORT; + register4 <= LONG; + general_next_state <= sendRegisters; + elsif isR then + register1 <= SHORT; + register2 <= LONG; + register3 <= SHORT; + general_next_state <= sendRegisters; + elsif isS then + register1 <= SHORT; + register2 <= SHORT; + register3 <= SHORT; + general_next_state <= sendRegisters; + elsif isT then + register1 <= LONG; + general_next_state <= sendRegisters; + report "New char: T" severity note; + elsif isU then + register1 <= SHORT; + register2 <= SHORT; + register3 <= LONG; + general_next_state <= sendRegisters; + elsif isV then + register1 <= SHORT; + register2 <= SHORT; + register3 <= SHORT; + register4 <= LONG; + general_next_state <= sendRegisters; + elsif isW then + register1 <= SHORT; + register2 <= LONG; + register3 <= LONG; + general_next_state <= sendRegisters; + elsif isX then + register1 <= LONG; + register2 <= SHORT; + register3 <= SHORT; + register4 <= LONG; + general_next_state <= sendRegisters; + elsif isY then + register1 <= LONG; + register2 <= SHORT; + register3 <= LONG; + register4 <= LONG; + general_next_state <= sendRegisters; + elsif isZ then + register1 <= LONG; + register2 <= LONG; + register3 <= SHORT; + register4 <= SHORT; + general_next_state <= sendRegisters; + elsif is0 then + register1 <= LONG; + register2 <= LONG; + register3 <= LONG; + register4 <= LONG; + register5 <= LONG; + general_next_state <= sendRegisters; + elsif is1 then + register1 <= SHORT; + register2 <= LONG; + register3 <= LONG; + register4 <= LONG; + register5 <= LONG; + general_next_state <= sendRegisters; + elsif is2 then + register1 <= SHORT; + register2 <= SHORT; + register3 <= LONG; + register4 <= LONG; + register5 <= LONG; + general_next_state <= sendRegisters; + elsif is3 then + register1 <= SHORT; + register2 <= SHORT; + register3 <= SHORT; + register4 <= LONG; + register5 <= LONG; + general_next_state <= sendRegisters; + elsif is4 then + register1 <= SHORT; + register2 <= SHORT; + register3 <= SHORT; + register4 <= SHORT; + register5 <= LONG; + general_next_state <= sendRegisters; + elsif is5 then + register1 <= SHORT; + register2 <= SHORT; + register3 <= SHORT; + register4 <= SHORT; + register5 <= SHORT; + general_next_state <= sendRegisters; + elsif is6 then + register1 <= LONG; + register2 <= SHORT; + register3 <= SHORT; + register4 <= SHORT; + register5 <= SHORT; + general_next_state <= sendRegisters; + elsif is7 then + register1 <= LONG; + register2 <= LONG; + register3 <= SHORT; + register4 <= SHORT; + register5 <= SHORT; + general_next_state <= sendRegisters; + elsif is8 then + register1 <= LONG; + register2 <= LONG; + register3 <= LONG; + register4 <= SHORT; + register5 <= SHORT; + general_next_state <= sendRegisters; + elsif is9 then + register1 <= LONG; + register2 <= LONG; + register3 <= LONG; + register4 <= LONG; + register5 <= SHORT; + general_next_state <= sendRegisters; + else + register1 <= SPACE; + register2 <= SPACE; + register3 <= SPACE; + register4 <= SPACE; + register5 <= SPACE; + general_next_state <= storeChar; + report "Char look not correct" severity warning; + end if; + signSendRegisters <= '1'; - when sended => - --report "General current state is sended" severity note; - general_next_state <= waitForChar; - register1 <= SPACE; - register2 <= SPACE; - register3 <= SPACE; - register4 <= SPACE; - register5 <= SPACE; - - WHEN OTHERS => - report "General current state is BROKEN" severity warning; - general_next_state <= waitForChar; + when sendRegisters => + --report "General current state is send registers" severity note; + readChar <= '0'; + signSendRegisters <= '0'; + if signRegistersSended = '1' then + general_next_state <= sended; + report "Char is send" severity note; + else + general_next_state <= sendRegisters; + end if; - end case; + when sended => + --report "General current state is sended" severity note; + general_next_state <= waitForChar; + register1 <= SPACE; + register2 <= SPACE; + register3 <= SPACE; + register4 <= SPACE; + register5 <= SPACE; + + WHEN OTHERS => + report "General current state is BROKEN" severity warning; + general_next_state <= waitForChar; + + end case; + + end if; end process; process(reset, clock) begin - case sending_current_state is + if reset = '1' then + morseOut <= '0'; + startCounter <= '0'; + unitNb <= "000"; + signRegistersSended <= '0'; + elsif rising_edge(clock) then - when waiting => - morseOut <= '0'; - startCounter <= '0'; - unitNb <= "000"; - signRegistersSended <= '0'; - if signSendRegisters = '1' then - sending_next_state <= sendR1; - report "Start to send new char" severity note; - else + case sending_current_state is + + when waiting => + morseOut <= '0'; + startCounter <= '0'; + unitNb <= "000"; + signRegistersSended <= '0'; + if signSendRegisters = '1' then + sending_next_state <= sendR1; + report "Start to send new char" severity note; + else + sending_next_state <= waiting; + end if; + + when sendR1 => + --report "Send register1" severity note; + startCounter <= '1'; + morseOut <= '1'; + case register1 is + when SHORT => + unitNb <= "001"; + when LONG => + unitNb <= "011"; + when others => + report "Error when sending register1" severity error; + end case; + + case register2 is + when SPACE => + sending_next_state <= waitSpace; + when END_WORD => + sending_next_state <= waitEndWord; + when others => + sending_next_state <= waitR1; + end case; + + when waitR1 => + --report "Wait register1" severity note; + startCounter <= '0'; + if counterDone = '1' then + morseOut <= '0'; + sending_next_state <= sendR2; + end if; + + when sendR2 => + --report "Send register2" severity note; + startCounter <= '1'; + morseOut <= '1'; + case register2 is + when SHORT => + unitNb <= "001"; + when LONG => + unitNb <= "011"; + when others => + report "Error when sending register2" severity error; + end case; + + case register3 is + when SPACE => + sending_next_state <= waitSpace; + when END_WORD => + sending_next_state <= waitEndWord; + when others => + sending_next_state <= waitR2; + end case; + + when waitR2 => + --report "Wait register2" severity note; + startCounter <= '0'; + if counterDone = '1' then + morseOut <= '0'; + sending_next_state <= sendR3; + end if; + + when sendR3 => + --report "Send register3" severity note; + startCounter <= '1'; + morseOut <= '1'; + case register3 is + when SHORT => + unitNb <= "001"; + when LONG => + unitNb <= "011"; + when others => + report "Error when sending register3" severity error; + end case; + + case register4 is + when SPACE => + sending_next_state <= waitSpace; + when END_WORD => + sending_next_state <= waitEndWord; + when others => + sending_next_state <= waitR3; + end case; + + when waitR3 => + startCounter <= '0'; + if counterDone = '1' then + morseOut <= '0'; + sending_next_state <= sendR4; + end if; + + when sendR4 => + startCounter <= '1'; + morseOut <= '1'; + case register4 is + when SHORT => + unitNb <= "001"; + when LONG => + unitNb <= "011"; + when others => + report "Error when sending register4" severity error; + end case; + + case register5 is + when SPACE => + sending_next_state <= waitSpace; + when END_WORD => + sending_next_state <= waitEndWord; + when others => + sending_next_state <= waitR4; + end case; + + when waitR4 => + startCounter <= '0'; + if counterDone = '1' then + morseOut <= '0'; + sending_next_state <= sendR5; + end if; + + when sendR5 => + startCounter <= '1'; + morseOut <= '1'; + case register5 is + when SHORT => + unitNb <= "001"; + when LONG => + unitNb <= "011"; + when others => + report "Error when sending register5" severity error; + end case; + + sending_next_state <= waitSpace; + + when waitSpace => + startCounter <= '0'; + if counterDone = '1' then + morseOut <= '0'; + sending_next_state <= waiting; + end if; + signRegistersSended <= '1'; + + when waitEndWord => sending_next_state <= waiting; - end if; - - when sendR1 => - report "Send register1" severity note; - startCounter <= '1'; - morseOut <= '1'; - case register1 is - when SHORT => - unitNb <= "001"; - when LONG => - unitNb <= "011"; - when others => - report "Error when sending register1" severity error; - end case; - - case register2 is - when SPACE => - sending_next_state <= waitSpace; - when END_WORD => - sending_next_state <= waitEndWord; - when others => - sending_next_state <= waitR1; - end case; - - when waitR1 => - report "Wait register1" severity note; - startCounter <= '0'; - if counterDone = '1' then - morseOut <= '0'; - sending_next_state <= sendR2; - end if; - - when sendR2 => - report "Send register2" severity note; - startCounter <= '1'; - morseOut <= '1'; - case register2 is - when SHORT => - unitNb <= "001"; - when LONG => - unitNb <= "011"; - when others => - report "Error when sending register2" severity error; - end case; - - case register3 is - when SPACE => - sending_next_state <= waitSpace; - when END_WORD => - sending_next_state <= waitEndWord; - when others => - sending_next_state <= waitR2; - end case; - - when waitR2 => - report "Wait register2" severity note; - startCounter <= '0'; - if counterDone = '1' then - morseOut <= '0'; - sending_next_state <= sendR3; - end if; - - when sendR3 => - report "Send register3" severity note; - startCounter <= '1'; - morseOut <= '1'; - case register3 is - when SHORT => - unitNb <= "001"; - when LONG => - unitNb <= "011"; - when others => - report "Error when sending register3" severity error; - end case; - - case register4 is - when SPACE => - sending_next_state <= waitSpace; - when END_WORD => - sending_next_state <= waitEndWord; - when others => - sending_next_state <= waitR3; - end case; - - when waitR3 => - startCounter <= '0'; - if counterDone = '1' then - morseOut <= '0'; - sending_next_state <= sendR4; - end if; - - when sendR4 => - startCounter <= '1'; - morseOut <= '1'; - case register4 is - when SHORT => - unitNb <= "001"; - when LONG => - unitNb <= "011"; - when others => - report "Error when sending register4" severity error; - end case; - - case register5 is - when SPACE => - sending_next_state <= waitSpace; - when END_WORD => - sending_next_state <= waitEndWord; - when others => - sending_next_state <= waitR4; - end case; - - when waitR4 => - startCounter <= '0'; - if counterDone = '1' then - morseOut <= '0'; - sending_next_state <= sendR5; - end if; - - when sendR5 => - startCounter <= '1'; - morseOut <= '1'; - case register5 is - when SHORT => - unitNb <= "001"; - when LONG => - unitNb <= "011"; - when others => - report "Error when sending register5" severity error; - end case; - - sending_next_state <= waitSpace; - - when waitSpace => - startCounter <= '0'; - if counterDone = '1' then - morseOut <= '0'; + when others => sending_next_state <= waiting; - end if; - signRegistersSended <= '1'; - - when waitEndWord => - sending_next_state <= waiting; - when others => - sending_next_state <= waiting; - end case; + end case; + end if; end process; diff --git a/05-Morse/Morse/hds/.cache.dat b/05-Morse/Morse/hds/.cache.dat index c06eb7ae6652fe38233540d633a94c45d4297de4..3af39f59bb58b81ff43ba301a8797f9f885ee7bb 100644 GIT binary patch delta 53 zcmca+ea(798#BA4$UO!I?!3u$EIylWGAl5$OUnIXVDS33iS+?gQivZcY0SA;1OU@4 B5JUg~ delta 53 zcmca+ea(798#B9DSvvy*ci!YW7N5;GnH3n>#hMp0Ft{Gy#QFd#DZ~$!H0E3^0szvi B5Gw!x diff --git a/05-Morse/Morse_test/hds/.cache.dat b/05-Morse/Morse_test/hds/.cache.dat index 609d9cc296dd795705a56ba2934d92de1e0c41ea..7df61eb1a67d7c2460eb12c46b7a417bcdcf6cba 100644 GIT binary patch delta 33 pcmX@8bx>)+;0X3!T8A^n0+?yX5PrcEGcqtb3Vr<9stJE3#kAA delta 33 pcmX@8bx>