git-svn-id: http://moon:8086/svn/vhdl/trunk@1341 cc03376c-175c-47c8-b038-4cd826a8556b
97 lines
2.7 KiB
VHDL
97 lines
2.7 KiB
VHDL
-------------------------------------------------------------------------
|
|
-- Project: JCPU, a portable 8-bit RISC CPU written in VHDL
|
|
-- This file: cpu_embedded using cpu_core and rom
|
|
--
|
|
-- Copyright (C) 2007 J. Ahrensfeld
|
|
--
|
|
-- This program is free software: you can redistribute it and/or modify
|
|
-- it under the terms of the GNU General Public License as published by
|
|
-- the Free Software Foundation, either version 3 of the License, or
|
|
-- (at your option) any later version.
|
|
--
|
|
-- This program is distributed in the hope that it will be useful,
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
-- GNU General Public License for more details.
|
|
--
|
|
-- You should have received a copy of the GNU General Public License
|
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
--
|
|
-- For questions and ideas, please contact the author at jens@jayfield.org
|
|
--
|
|
--------------------------------------------------------------------------
|
|
|
|
library IEEE;
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
|
use IEEE.numeric_std.ALL;
|
|
|
|
entity tb_juart_tx is
|
|
end;
|
|
|
|
architecture behave of tb_juart_tx is
|
|
|
|
-- Number of user data words for simulation
|
|
constant CLK_PERIOD : time := 10 ns;
|
|
|
|
signal rst : std_logic := '1';
|
|
signal clk : std_logic := '1';
|
|
signal en_16_x_baud : std_logic := '1';
|
|
signal send_character : std_logic := '0';
|
|
signal serial_out : std_logic;
|
|
signal Tx_complete : std_logic;
|
|
signal data_in : unsigned(7 downto 0) := (others => '0');
|
|
|
|
begin
|
|
|
|
inst_juart_tx : entity work.juart_tx
|
|
PORT MAP
|
|
(
|
|
rst => rst,
|
|
clk => clk,
|
|
en_16_x_baud => en_16_x_baud,
|
|
send_character => send_character,
|
|
Tx_complete => Tx_complete,
|
|
data_in => data_in,
|
|
serial_out => serial_out
|
|
);
|
|
|
|
|
|
CLK_GEN: process
|
|
begin
|
|
wait for CLK_PERIOD/2;
|
|
clk <= not clk;
|
|
end process;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
STIMULUS: process
|
|
|
|
|
|
begin
|
|
|
|
wait for 3*CLK_PERIOD;
|
|
rst <= '0';
|
|
wait for 3*CLK_PERIOD;
|
|
wait until rising_edge(clk);
|
|
data_in <= X"A5";
|
|
wait until rising_edge(clk) and Tx_complete = '1';
|
|
send_character <= '1';
|
|
wait until rising_edge(clk) and Tx_complete = '0';
|
|
send_character <= '0';
|
|
wait until rising_edge(clk) and Tx_complete = '1';
|
|
data_in <= X"AA";
|
|
wait until rising_edge(clk) and Tx_complete = '1';
|
|
send_character <= '1';
|
|
wait until rising_edge(clk) and Tx_complete = '0';
|
|
send_character <= '0';
|
|
data_in <= X"55";
|
|
wait until rising_edge(clk) and Tx_complete = '1';
|
|
send_character <= '1';
|
|
wait until rising_edge(clk) and Tx_complete = '0';
|
|
send_character <= '0';
|
|
wait;
|
|
|
|
end process;
|
|
|
|
end architecture behave;
|