Skip to content

Instantly share code, notes, and snippets.

@davilamds
Last active June 8, 2018 16:40
Show Gist options
  • Save davilamds/8da77b91af60286d355561aa79449ffd to your computer and use it in GitHub Desktop.
Save davilamds/8da77b91af60286d355561aa79449ffd to your computer and use it in GitHub Desktop.
Test UART VHDL
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity uart_test is
port(
clk, reset: in std_logic;
btn: std_logic_vector(2 downto 0);
rx: in std_logic;
tx: out std_logic
);
end uart_test;
architecture arch of uart_test is
signal tx_full, rx_empty: std_logic;
signal rec_data,rec_data1: std_logic_vector(7 downto 0);
signal btn_tick: std_logic;
begin
-- Instanciar uart
uart_unit: entity work.uart(str_arch)
port map(clk=>clk, reset=>reset, rd_uart=>btn_tick,
wr_uart=>btn_tick, rx=>rx, w_data=>rec_data1,
tx_full=>tx_full, rx_empty=>rx_empty,
r_data=>rec_data, tx=>tx);
-- Instanciar antirebote
btn_db_unit: entity work.debounce(fsmd_arch)
port map(clk=>clk, reset=>reset, sw=>btn(0),
db_level=>open, db_tick=>btn_tick);
-- Incrementar contador de recepción
rec_data1 <= std_logic_vector(unsigned(rec_data)+1);
end arch;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment