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 14

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

powered by: WebSVN 2.1.0

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