1
0
This commit is contained in:
Rémi Heredero 2024-04-17 12:50:48 +02:00
parent 8a64f5c04b
commit 14f542a674
3 changed files with 431 additions and 410 deletions

View File

@ -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 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;
WHEN OTHERS =>
report "General current state is BROKEN" severity warning;
general_next_state <= waitForChar;
when sended =>
--report "General current state is sended" severity note;
general_next_state <= waitForChar;
register1 <= SPACE;
register2 <= SPACE;
register3 <= SPACE;
register4 <= SPACE;
register5 <= SPACE;
end case;
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;

Binary file not shown.

Binary file not shown.