-- UART Transmitter Logic
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity UART_TX is
Port ( clk : in STD_LOGIC;
tx_data : in STD_LOGIC_VECTOR(7 downto 0);
tx_out : out STD_LOGIC );
end UART_TX;
architecture Behavioral of UART_TX is
type state_type is (IDLE, START, DATA, STOP);
signal state : state_type := IDLE;
begin
-- Main Process
process(clk)
begin
if rising_edge(clk) then
case state is
when IDLE =>
tx_out <= '1';
if tx_start = '1' then state <= START; end if;
when START =>
tx_out <= '0';
state <= DATA;
when DATA =>
tx_out <= tx_shift(0);
when STOP =>
tx_out <= '1';
state <= IDLE;
end case;
end if;
end process;
end Behavioral;