1 -------------------------------------------------------------------------------     2 -- File       : UartAxiLiteMaster.vhd     3 -- Company    : SLAC National Accelerator Laboratory     4 -- Created    : 2016-06-09     5 -- Last update: 2016-06-09     6 -------------------------------------------------------------------------------     7 -- Description: Ties together everything needed for a full duplex UART.     8 -- This includes Baud Rate Generator, Transmitter, Receiver and FIFOs.     9 -------------------------------------------------------------------------------    10 -- This file is part of 'SLAC Firmware Standard Library'.    11 -- It is subject to the license terms in the LICENSE.txt file found in the     12 -- top-level directory of this distribution and at:     13 --    https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.     14 -- No part of 'SLAC Firmware Standard Library', including this file,     15 -- may be copied, modified, propagated, or distributed except according to     16 -- the terms contained in the LICENSE.txt file.    17 -------------------------------------------------------------------------------    20 use ieee.std_logic_1164.
all;
    21 use ieee.std_logic_arith.
all;
    22 use ieee.std_logic_unsigned.
all;
    27  --! @ingroup protocols_uart    39       -- Transmit parallel interface    43       -- Receive parallel interface    51 end entity UartWrapper;
    55    signal uartTxData  : slv(7 downto 0);
    56    signal uartTxValid : sl;
    57    signal uartTxReady : sl;
    58    signal uartTxRdEn  : sl;
    59    signal fifoTxData  : slv(7 downto 0);
    60    signal fifoTxValid : sl;
    61    signal fifoTxReady : sl;
    63    signal uartRxData     : slv(7 downto 0);
    64    signal uartRxValid    : sl;
    65    signal uartRxValidInt : sl;
    66    signal uartRxReady    : sl;
    67    signal fifoRxData     : slv(7 downto 0);
    68    signal fifoRxValid    : sl;
    69    signal fifoRxReady    : sl;
    70    signal fifoRxRdEn     : sl;
    76    -------------------------------------------------------------------------------------------------    77    -- Tie parallel IO to internal signals    78    -------------------------------------------------------------------------------------------------    81    -------------------------------------------------------------------------------------------------    82    -- Baud Rate Generator.    83    -- Create a clock enable that is 16x the baud rate.    84    -- UartTx and UartRx use this.    85    -------------------------------------------------------------------------------------------------    86    U_UartBrg_1 : 
entity work.
UartBrg    94          clkEn => baud16x
);
             -- [out]    96    -------------------------------------------------------------------------------------------------    98    -------------------------------------------------------------------------------------------------    99    U_UartTx_1 : 
entity work.
UartTx   106          wrData  => uartTxData,
         -- [in]   107          wrValid => uartTxValid,
        -- [in]   108          wrReady => uartTxReady,
        -- [out]   111    -------------------------------------------------------------------------------------------------   112    -- FIFO to feed UART transmitter   113    -------------------------------------------------------------------------------------------------   116    fifoTxValid <= wrValid and fifoTxReady;
   117    uartTxRdEn  <= uartTxReady and uartTxValid;
   118    U_Fifo_Tx : 
entity work.
Fifo   130          wr_en    => fifoTxValid,
       -- [in]   131          din      => fifoTxData,
        -- [in]   134          rd_en    => uartTxRdEn,
        -- [in]   135          dout     => uartTxData,
        -- [out]   136          valid    => uartTxValid
);
      -- [out]   138    -------------------------------------------------------------------------------------------------   140    -------------------------------------------------------------------------------------------------   141    U_UartRx_1 : 
entity work.
UartRx   148          rdData  => uartRxData,
         -- [out]   149          rdValid => uartRxValid,
        -- [out]   150          rdReady => uartRxReady,
        -- [in]   153    -------------------------------------------------------------------------------------------------   154    -- FIFO for UART Received data   155    -------------------------------------------------------------------------------------------------   156    fifoRxRdEn     <= fifoRxReady and fifoRxValid;
   157    uartRxValidInt <= uartRxValid and uartRxReady;
   163    U_Fifo_Rx : 
entity work.
Fifo   175          wr_en    => uartRxValidInt,
    -- [in]   176          din      => uartRxData,
        -- [in]   179          rd_en    => fifoRxRdEn,
        -- [in]   180          dout     => fifoRxData,
        -- [out]   181          valid    => fifoRxValid
);
      -- [out]   183 end architecture rtl;
 in dinslv(   DATA_WIDTH_G- 1 downto  0)  
 
in wrDataslv( 7 downto  0)  
 
FIFO_ADDR_WIDTH_Ginteger   range  4 to  48:= 4
 
FWFT_EN_Gboolean  :=   false
 
in wrDataslv( 7 downto  0)  
 
out rdDataslv( 7 downto  0)  
 
out rdDataslv( 7 downto  0)  
 
DATA_WIDTH_Ginteger   range  1 to ( 2** 24):= 16
 
BAUD_RATE_Ginteger  := 115200
 
FIFO_BRAM_EN_Gboolean  :=   false
 
GEN_SYNC_FIFO_Gboolean  :=   false
 
CLK_FREQ_Greal  := 125.0e6
 
BAUD_RATE_Ginteger  := 115200
 
out doutslv(   DATA_WIDTH_G- 1 downto  0)  
 
in rstsl  :=not    RST_POLARITY_G
 
PIPE_STAGES_Gnatural   range  0 to  16:= 0
 
ADDR_WIDTH_Ginteger   range  4 to  48:= 4
 
CLK_FREQ_Greal  := 125.0E6
 
MULTIPLIER_Ginteger  := 16