Files
XC3S400/UART.vhdl
2023-05-29 11:00:35 -03:00

66 lines
1.5 KiB
VHDL

----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 09:16:26 05/15/2023
-- Design Name:
-- Module Name: UART_TX - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity UART_TX is
Port ( DATA : in STD_LOGIC_VECTOR (7 downto 0);
LOAD : in STD_LOGIC;
CLK : in STD_LOGIC;
BUSY : out STD_LOGIC;
TX_PIN : out STD_LOGIC);
end UART_TX;
architecture Behavioral of UART_TX is
signal sending: std_logic_vector (10 downto 0);
signal to_send: std_logic_vector (9 downto 0);
begin
TX_PIN <= sending(0);
process(CLK, LOAD)
begin
if(LOAD = '1') then
--começa novo envio
sending <= '1' & DATA & '0' & '1';
BUSY <= '1';
elsif(CLK'event and CLK = '1') then
--envia próximo bit
sending <= '1' & sending(10 downto 1);
if(sending = "11111111111") then
BUSY <= '0';
end if;
end if;
end process;
end Behavioral;