OpenCores
URL https://opencores.org/ocsvn/uart_block/uart_block/trunk

Subversion Repositories uart_block

[/] [uart_block/] [trunk/] [hdl/] [iseProject/] [uart_communication_blocks.vhd] - Blame information for rev 12

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 leonardoar
--! Top level for interconnection between communication blocks: serial_transmitter, serial_receiver, baud_generator
2
library IEEE;
3
use IEEE.STD_LOGIC_1164.ALL;
4
 
5
--! Use CPU Definitions package
6
use work.pkgDefinitions.all;
7
 
8
entity uart_communication_blocks is
9
    Port ( rst : in  STD_LOGIC;
10
           clk : in  STD_LOGIC;
11
                          cycle_wait_baud : in std_logic_vector((nBitsLarge-1) downto 0);
12
           byte_tx : in  STD_LOGIC_VECTOR ((nBits-1) downto 0);
13
           byte_rx : out  STD_LOGIC_VECTOR ((nBits-1) downto 0);
14
           data_sent_tx : out  STD_LOGIC;
15
           data_received_rx : out  STD_LOGIC;
16
                          serial_out : out std_logic;
17
                          serial_in : in std_logic;
18
           start_tx : in  STD_LOGIC);
19
end uart_communication_blocks;
20
 
21
architecture Behavioral of uart_communication_blocks is
22
 
23
-- Declare components...
24
component baud_generator is
25
    Port ( rst : in STD_LOGIC;
26
                          clk : in  STD_LOGIC;
27
           cycle_wait : in  STD_LOGIC_VECTOR ((nBitsLarge-1) downto 0);
28
                          baud_oversample : out std_logic;
29
           baud : out  STD_LOGIC);
30
end component;
31
 
32
component serial_transmitter is
33
    Port ( rst : in  STD_LOGIC;
34
           baudClk : in  STD_LOGIC;
35
           data_byte : in  STD_LOGIC_VECTOR ((nBits-1) downto 0);
36
                          data_sent : out STD_LOGIC;
37
           serial_out : out  STD_LOGIC);
38
end component;
39
 
40
component serial_receiver is
41
    Port (
42
                          rst : in STD_LOGIC;
43
                          baudClk : in  STD_LOGIC;
44
                          baudOverSampleClk : in  STD_LOGIC;
45
           serial_in : in  STD_LOGIC;
46
           data_ready : out  STD_LOGIC;
47
           data_byte : out  STD_LOGIC_VECTOR ((nBits-1) downto 0));
48
end component;
49
signal baud_tick : std_logic;
50
signal baud_tick_oversample : std_logic;
51
begin
52
        -- Instantiate baud generator
53
        uBaudGen : baud_generator port map (
54
                rst => rst,
55
                clk => clk,
56
                cycle_wait => cycle_wait_baud,
57
                baud_oversample => baud_tick_oversample,
58
                baud => baud_tick
59
        );
60
 
61
        -- Instantiate serial_transmitter
62
        uTransmitter : serial_transmitter port map (
63
                rst => not start_tx,
64
                baudClk => baud_tick,
65
                data_byte => byte_tx,
66
                data_sent => data_sent_tx,
67
                serial_out => serial_out
68
        );
69
 
70
        -- Instantiate serial_receiver
71
        uReceiver : serial_receiver port map(
72
                rst => rst,
73
                baudClk => baud_tick,
74
                baudOverSampleClk => baud_tick_oversample,
75
                serial_in => serial_in,
76
                data_ready => data_received_rx,
77
                data_byte => byte_rx
78
        );
79
 
80
end Behavioral;
81
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.