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

Subversion Repositories uart_block

[/] [uart_block/] [trunk/] [hdl/] [iseProject/] [uart_wishbone_slave.vhd] - Blame information for rev 25

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

Line No. Rev Author Line
1 14 leonardoar
--! Top wishbone slave for the uart
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_wishbone_slave is
9
    Port ( RST_I : in  STD_LOGIC;
10
           CLK_I : in  STD_LOGIC;
11
           ADR_I0 : in  STD_LOGIC_VECTOR (1 downto 0);
12
           DAT_I0 : in  STD_LOGIC_VECTOR (31 downto 0);
13
           DAT_O0 : out  STD_LOGIC_VECTOR (31 downto 0);
14
           WE_I : in  STD_LOGIC;
15
           STB_I : in  STD_LOGIC;
16
           ACK_O : out  STD_LOGIC;
17
                          serial_in : in std_logic;
18 21 leonardoar
                          data_Avaible : out std_logic;                                                                                 -- Indicate that the receiver module got something
19 14 leonardoar
                          serial_out : out std_logic
20
                          );
21
end uart_wishbone_slave;
22
 
23
architecture Behavioral of uart_wishbone_slave is
24
component uart_control is
25
   Port ( rst : in  std_logic;                                                                                                          -- Global reset
26
           clk : in  std_logic;                                                                                                         -- Global clock
27
                          WE    : in std_logic;                                                                                                         -- Write enable
28
           reg_addr : in  std_logic_vector (1 downto 0);                                         -- Register address
29
                          start : in std_logic;                                                                                                         -- Start (Strobe)
30
                          done : out std_logic;                                                                                                         -- Done (ACK)
31
           DAT_I : in  std_logic_vector ((nBitsLarge-1) downto 0);               -- Data Input (Wishbone)
32
           DAT_O : out  std_logic_vector ((nBitsLarge-1) downto 0);              -- Data output (Wishbone)
33
                          baud_wait : out std_logic_vector ((nBitsLarge-1) downto 0);    -- Signal to control the baud rate frequency
34
                          data_byte_tx : out std_logic_vector((nBits-1) downto 0);               -- 1 Byte to be send to serial_transmitter
35
                          data_byte_rx : in std_logic_vector((nBits-1) downto 0);        -- 1 Byte to be received by serial_receiver
36
           tx_data_sent : in  std_logic;                                                                                        -- Signal comming from serial_transmitter
37
                          tx_start : out std_logic;                                                                                             -- Signal to start sending serial data...
38 21 leonardoar
                          rst_comm_blocks : out std_logic;                                                                              -- Reset Communication blocks                     
39 14 leonardoar
           rx_data_ready : in  std_logic);
40
end component;
41
 
42
component uart_communication_blocks is
43
    Port ( rst : in  STD_LOGIC;
44
           clk : in  STD_LOGIC;
45
                          cycle_wait_baud : in std_logic_vector((nBitsLarge-1) downto 0);
46
           byte_tx : in  STD_LOGIC_VECTOR ((nBits-1) downto 0);
47
           byte_rx : out  STD_LOGIC_VECTOR ((nBits-1) downto 0);
48
           data_sent_tx : out  STD_LOGIC;
49
           data_received_rx : out  STD_LOGIC;
50
                          serial_out : out std_logic;
51
                          serial_in : in std_logic;
52
           start_tx : in  STD_LOGIC);
53
end component;
54
signal baud_wait : std_logic_vector((nBitsLarge-1) downto 0);
55
signal tx_data_sent : std_logic;
56
signal tx_start : std_logic;
57
signal rst_comm_blocks : std_logic;
58
signal rx_data_ready : std_logic;
59
signal data_byte_tx : std_logic_vector(7 downto 0);
60
signal data_byte_rx : std_logic_vector(7 downto 0);
61
begin
62
        -- Instantiate uart_control
63
        uUartControl : uart_control port map (
64
                rst => RST_I,
65
                clk => CLK_I,
66
                WE      => WE_I,
67
                reg_addr => ADR_I0,
68
                start => STB_I,
69
                done => ACK_O,
70
                DAT_I => DAT_I0,
71
                DAT_O => DAT_O0,
72
                baud_wait => baud_wait,
73
                data_byte_tx => data_byte_tx,
74
                data_byte_rx => data_byte_rx,
75
                tx_data_sent => tx_data_sent,
76
                rst_comm_blocks => rst_comm_blocks,
77
                tx_start => tx_start,
78
                rx_data_ready => rx_data_ready
79
        );
80
 
81
        -- Instantiate uart_communication_blocks
82
        uUartCommunicationBlocks : uart_communication_blocks port map (
83
                rst => rst_comm_blocks,
84
                clk => CLK_I,
85
                cycle_wait_baud => baud_wait,
86
                byte_tx => data_byte_tx,
87
                byte_rx => data_byte_rx,
88
                data_sent_tx => tx_data_sent,
89
                data_received_rx => rx_data_ready,
90
                serial_out => serial_out,
91
                serial_in => serial_in,
92
                start_tx => tx_start
93
        );
94 21 leonardoar
 
95
        data_Avaible <= rx_data_ready;
96 14 leonardoar
 
97
end Behavioral;
98
 

powered by: WebSVN 2.1.0

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