Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

Commit 14e8f92c authored by Antoine's avatar Antoine

Byte FSM

parent 89ade67e
......@@ -14,8 +14,146 @@ entity ByteXFSM is
end ByteXFSM;
architecture Behavioral of ByteXFSM is
TYPE STATE_TYPE IS (Idle, Start, Tr0, Tr1, Tr2, Tr3, Tr4, Tr5, Tr6, Tr7, Stop0, Stop1);
signal state : STATE_TYPE <= Idle;
begin
-- Machine d'etat
FSM1Transition : process(Clk)
begin
If Clk'event and Clk = '1' then
CASE state IS
WHEN Idle =>
if StartBX = '1' then
state <= Start;
else
state <= Idle;
end if;
WHEN Start =>
if BdClk = '1' then
state <= Tr0;
else
state <= Start;
end if;
WHEN Tr0 =>
if BdClk = '1' then
state <= Tr1;
else
state <= Tr0;
end if;
WHEN Tr1 =>
if BdClk = '1' then
state <= Tr2;
else
state <= Tr1;
end if;
WHEN Tr2 =>
if BdClk = '1' then
state <= Tr3;
else
state <= Tr2;
end if;
WHEN Tr3 =>
if BdClk = '1' then
state <= Tr4;
else
state <= Tr3;
end if;
WHEN Tr4 =>
if BdClk = '1' then
state <= Tr5;
else
state <= Tr4;
end if;
WHEN Tr5 =>
if BdClk = '1' then
state <= Tr6;
else
state <= Tr5;
end if;
WHEN Tr6 =>
if BdClk = '1' then
state <= Tr7;
else
state <= Tr6;
end if;
WHEN Tr7 =>
if BdClk = '1' then
state <= Stop0;
else
state <= Tr7;
end if;
WHEN Stop0 =>
if BdClk = '1' then
state <= Stop1;
else
state <= Stop0;
end if;
WHEN Stop1 =>
if BdClk = '1' then
state <= Idle;
else
state <= Stop1;
end if;
END CASE;
end if;
end process;
-- Decodage
FSM1Value : process(Clk)
begin
If Clk'event and Clk = '1' then
CASE state IS
WHEN Idle =>
Tx <= '1';
Done <= '1';
BdClkEn <= '0';
WHEN Start =>
Tx <= '0';
Done <= '0';
BdClkEn <= '1';
WHEN Tr0 =>
Tx <= Data(7);
Done <= '0';
BdClkEn <= '1';
WHEN Tr1 =>
Tx <= Data(6);
Done <= '0';
BdClkEn <= '1';
WHEN Tr2 =>
Tx <= Data(5);
Done <= '0';
BdClkEn <= '1';
WHEN Tr3 =>
Tx <= Data(4);
Done <= '0';
BdClkEn <= '1';
WHEN Tr4 =>
Tx <= Data(3);
Done <= '0';
BdClkEn <= '1';
WHEN Tr5 =>
Tx <= Data(2);
Done <= '0';
BdClkEn <= '1';
WHEN Tr6 =>
Tx <= Data(1);
Done <= '0';
BdClkEn <= '1';
WHEN Tr7 =>
Tx <= Data(0);
Done <= '0';
BdClkEn <= '1';
WHEN Stop0 =>
Tx <= '1';
Done <= '0';
BdClkEn <= '1';
WHEN Stop0 =>
Tx <= '1';
Done <= '0';
BdClkEn <= '1';
END CASE;
end if;
end process;
end Behavioral;
end Behavioral;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment